Hello -
I thought that it will be a good FYI to share an IAR bug that I have found in both v8.10.4 and v8.11.2:
The bug is seen on a function that takes a uint16 argument and returns a uint16 result. If the function prototype is simply changed to take a uint8 argument but still return the uint16 result, there is no bug.
So in the simple project attached, you will see that this is the function I wish that I could run:
uint16 calcCrc(uint16 crc);
But the above has the bug in that only the RNDH is used to build the return value, the RNDL is not even used.
So I found a work-around with this:
uint16 calcCrc_Workaround(uint16 crc);
In the above function, the work-around is very specific - if you remove the superfluous asm() or if you leave the asm() but use RNDL instead of the uint8 tmp variable, the bug still happens.
As a reference, I got the CRC calculation example from sample TI code in bim_main.c which had a function with a prototype like this:
uint16 calcCrc_Original(uint8 page);
This is not a bug in the TI hardware, which can be verified by studying the assembly code produced by IAR in each of the 3 flavors of the functions in the simple project attached which will allow you to replicate this bug on TI hardware (it does not replicate using just the IAR Simulator because apparently the Simulator has no way to fake the SFR registers even though they are in XDATA and it should be simple to do so).