Hi All
We have a problem with a uVision project compiling a routine but not returning using BX lr. It uses B.N plus an address instead when returning - presumably because it is in-lining the subroutine. The problem is that the small subroutien is used to program Flash (kinetis in this case) and so is copied to SRAM (only 6 instructions in length) and executed frôm there.
Normally this works fine but in one case - presumably a certain uVision version since I don't get it with any of the last 4 versions that I had installed - it causes the code to crash since the return jumps to a bad address.
I can't try any fixes myself because I don't get the problem but the user with the difficulty has tried the following pragma, which did look promising from the documentation:
static void fnFlashRoutine(volatile unsigned char *ptrFTFL_BLOCK) __attribute__((noinline));
but with no improvement.
Maybe changing to another uVision release will solve it but it would be good to understand how it can be controlled since in the future newer uVision relases may cause the problem to return again.
Regards
Mark