Forum : ST7/STM8
Post Information | Post |
---|---|
February 8, 2011 - 12:35pm
|
Hello everybody, here's a problem I discovered after the upgrade from RKit-STM8 Version 2.26.09.0317 to Version 2.32.10.0307. if(UART1_RX_Index < UART1_RX_BUFFER_SIZE) Here's the variable definitions: unsigned char UART1_RX_Index; When the "UART1_RX_Index" has a zero value, the test is (wrongly) negative, instead of (correctly) positive. C60000 LD A,UART1_RX_Index The compiler uses the JRSGE instructionj instead of the JRNC, and this seems to originate the problem. if((u16)UART1_RX_Index < (u16)UART1_RX_BUFFER_SIZE) The compiler listing changed as follows: C601EA LD A,UART1_RX_Index The JRNC is correctly used, and the software flow is correct. I'm now thinking about downgrading the RKit-STM8, since it seems to be a compiler bug. Thank You, Lorenzo. |
Hi Lorenzo,
Thanks for this report.
We have had this problem in the past, so I am surprised that you have it with our latest release.
Unfortunately, we have not been able to reproduce the problem in our Labs.
Can you send us your compiler listing file? This would help us understanding the root cause of your problem.
Best Regards,
Hi Bruno,
The file is part of a project that my copany (EFI Technology s.r.l.) sold to a customer, let me inform about the possibility of any problem in giving the file.
In the meantime I by-passed the problem lowering the optimization level.
I can confirm that the problem is present for sure with optimizazion level 3 (preference Speed), and that it's not present for sure with optimization level 0 (preference Speed).
I have no reliable information about levels 1 and 2 yet.
Hope this could help...as soon as I can I'll post you the compiler listing file.
Thanks
Hi Bruno,
I've seen that the problem is present just with optimization level 3.
I can give you the compiler listing file, but it's too big to post it here (110KB).
How can I give it to you?
Regards
Hi Lorenzo,
Thanks for your efforts on this topic.
Thanks to your listing files, we have sucessfully reproduced the problem in our labs. It comes from an invalid behavior in the compiler peephole optimizer.
We will fix this bug in the next RKit-STM8 (due early March).
In the meantime, the easy workaround is to keep the optimization level to o(2) for the failing file.
Best Regards,
Thank You Bruno.
Best Regards,
Lorenzo.