Page 1 of 1

Bug in MikroBasic Compiler

Posted: 08 Aug 2008 02:52
by JerryHRoss
I just glanced over your recently posted bug list and did not find this bug listed:

The compiler generates a CLI in the preamble and a SEI in the postamble of every interrupt service routine. They are completely unnecessary as the hardware clears the IE bit in the Status register just before calling the specific ISR and the RETI causes the IE bit in the Status register to be set as it returns from the ISR.

You are being saved from the possibility of overflowing the hardware stack because the instruction following the SEI, an RETI, is executed before interrupts are actually enabled.

Please do not put any more instructions in your generated code than are absolutely necessary to get the job done as it just adds overhead to the overall application. Especially in an ISR; two extra instruction in an ISR that triggers every millisecond is two thousand extra instructions per second. You can get a lot of work done with two thousand instructions per second.

I JUST DISCOVERED THAT THE BUG LIST I NOTICED WAS FOR THE PIC COMPILER. STUPID ME... MY COMMENTS ABOVE STILL STAND, I JUST DON"T KNOW IF IT IS CONSIDERED A BUG BY THE POWERS THAT BE.

Re: Bug in MikroBasic Compiler

Posted: 11 Aug 2008 18:02
by srdjan
Hi,
JerryHRoss wrote:I just glanced over your recently posted bug list and did not find this bug listed:

The compiler generates a CLI in the preamble and a SEI in the postamble of every interrupt service routine. They are completely unnecessary as the hardware clears the IE bit in the Status register just before calling the specific ISR and the RETI causes the IE bit in the Status register to be set as it returns from the ISR.

You are being saved from the possibility of overflowing the hardware stack because the instruction following the SEI, an RETI, is executed before interrupts are actually enabled.

Please do not put any more instructions in your generated code than are absolutely necessary to get the job done as it just adds overhead to the overall application. Especially in an ISR; two extra instruction in an ISR that triggers every millisecond is two thousand extra instructions per second. You can get a lot of work done with two thousand instructions per second.

I JUST DISCOVERED THAT THE BUG LIST I NOTICED WAS FOR THE PIC COMPILER. STUPID ME... MY COMMENTS ABOVE STILL STAND, I JUST DON"T KNOW IF IT IS CONSIDERED A BUG BY THE POWERS THAT BE.
You are right about this. We are doing revision of all our avr compilers as we speak. We will make sure to solve this issue. Thank you for reporting this.