This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

uVision5 still skips codes under -O0 optimization level


I am new to Keil and I am implementing some crypto algorithms on a platform using ARM cortex M23. The platform has 3KB RAM and 30KB ROM.

When I debug, if the plain text size is small (2048bytes), everything is fine. But if I increase the size of plain text to 3072 or 4096, the encryption will be skipped and I cannot see the result.

I added breakpoint right before and after the encryption function call but it doesn't stop. It goes back to the beginning of the whole program directly after I click "step over" before function call.

It seems like the text is too large to be encrypted correctly, maybe there is an overflow? But the builder did not report any error, the RO/RW size does not exceed 30KB/3KB either.

I saw many people suggest to lower the optimization level of Keil, but I am always at -O0, why this still happens?

Thanks in advance.