Optimization -O1 removes (maybe unused) variables

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

More questions in this forum