2023-05-29 11:43 PM
Hi,
I was trying to convert a code written in HAL to baremetal for reducing the size. The code in HAL has 90KB file size when build in Debug mode and has 50KB file size in Release mode. In case of baremetal 73KB and 63KB respectively for Debug and Release modes. How can I reduce the file size of baremetal code than the HAL Release mode.
Solved! Go to Solution.
2023-05-31 12:20 AM
Perhaps review .MAP and .LST, look at what's eating the most memory.
If there's repetitive stuff that could be a subroutine or otherwise factored.
Compilers are not good with intent or identifying algorithms.
A lot of register code is very inefficient, using a lot of individual RMW code that the compiler can't fold due to the volatile and in-order expectations constraining it. Understand the load-store architecture and use your overview to decide what can be folded and where the order is or is not critical.