A bootloader and an application communicate via 8 variables located in SRAM at fixed addresses (starting at 0x20007F80 in our case).If using -O0 for both (bootloader, applicatijn), all eight addresses are valid and addresses match.Using -O1 for bootloader, compiler drops some variables currently not used in bootloader and compacts memory, so that addresses of variables are no longer matching the addresses in application.How to use -O1, but force compiler not to touch this 8 variables ?Tried 'volatile' and '__attribute__((at(0x20007F80)))', but had no effect.Best regards Juergen
Hi Juergen,
I have some suggestions, which may help depending on the structure of your codebase:
Define these variables with the used attribute:https://developer.arm.com/docs/101754/0614/armclang-reference/compiler-specific-function-variable-and-type-attributes/__attribute__used-variable-attribute
The linker option --keep can be used to ensure that the object(s) defining these variables are not removed as unused:https://developer.arm.com/docs/101754/0614/armlink-reference/armlink-command-line-options/-keepsection_id-armlinkIf these don't help, I suggest opening a formal support case from the Support menu at top of this page, which will allow you to privately share code etc with ArmRegards,Ronan
I tried compiler option --no_data_reorder which seems to work.Will check your suggestions too, but need some days...Thank you for your support!Best regards, Juergen