Bug in MikroBasic Compiler

Beta Testing discussion on mikroBasic PRO for AVR.
Post Reply
Author
Message
JerryHRoss
Posts: 41
Joined: 31 Jan 2008 14:27

Bug in MikroBasic Compiler

#1 Post by JerryHRoss » 08 Aug 2008 02:52

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.

User avatar
srdjan
mikroElektronika team
Posts: 1552
Joined: 28 Dec 2005 12:47
Location: Serbia

Re: Bug in MikroBasic Compiler

#2 Post by srdjan » 11 Aug 2008 18:02

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.

Post Reply

Return to “mikroBasic PRO for AVR Beta Testing”