I am trying to use SEGGER Embedded Studio with the GNU Linker to place a flag at a specific location in flash memory to allow the bootloader and application to interact via the flag.
To do this, I am using this line in flash_placement.xml:
Along with this Section Placement Macro in the Linker Options:
This is the application code that’s used to populate this flag:
I have two build configurations (“Release” and “Debug”) that are very similar. The “Release” build configuration places the correct 0x01 0x02 0x03 0x04 values at location 0x3600. The “Debug” build configuration does not, but instead fills with 0xFF 0xFF 0xFF 0xFF. I suspect that the problem may be related to optimization, as the flag_boot variable is not used anywhere in the application code, but is simply used to populate the values for the bootloader to access.
The “Release” build configuration has the following optimization settings:
For the Solution, Code Generation => Optimization Level is set to “Optimize For Size”. Strangely, this is not actually one of the options in the dropdown menu for that item.
For the Project, Code Generation => Optimization Level is set to “Level 0”.
The “Debug” build configuration has the following optimization settings:
For the Solution, Code Generation => Optimization Level is set to “None”.
For the Project, Code Generation => Optimization Level is set to “None”.
If I change the Solution, Code Generation => Optimization Level of the “Release” build configuration to “Level 0” it no longer works – the locations get filled with 0xFF.
Once I make a change to the “Release” build configuration I’m not able to get it back to the state where it works without reverting to the prior version. This makes me wonder if I have some type of problem with the .emProject file.
In any case, I’m wondering if anyone can help me determine how to get the flag_boot variable placed into the specified location regardless of optimization settings, as I will want to turn optimization on at some point. I’ve tried the following so far without success:
Thanks in advance,
Andy
To do this, I am using this line in flash_placement.xml:
This is the application code that’s used to populate this flag:
I have two build configurations (“Release” and “Debug”) that are very similar. The “Release” build configuration places the correct 0x01 0x02 0x03 0x04 values at location 0x3600. The “Debug” build configuration does not, but instead fills with 0xFF 0xFF 0xFF 0xFF. I suspect that the problem may be related to optimization, as the flag_boot variable is not used anywhere in the application code, but is simply used to populate the values for the bootloader to access.
The “Release” build configuration has the following optimization settings:
For the Solution, Code Generation => Optimization Level is set to “Optimize For Size”. Strangely, this is not actually one of the options in the dropdown menu for that item.
For the Project, Code Generation => Optimization Level is set to “Level 0”.
The “Debug” build configuration has the following optimization settings:
For the Solution, Code Generation => Optimization Level is set to “None”.
For the Project, Code Generation => Optimization Level is set to “None”.
If I change the Solution, Code Generation => Optimization Level of the “Release” build configuration to “Level 0” it no longer works – the locations get filled with 0xFF.
Once I make a change to the “Release” build configuration I’m not able to get it back to the state where it works without reverting to the prior version. This makes me wonder if I have some type of problem with the .emProject file.
In any case, I’m wondering if anyone can help me determine how to get the flag_boot variable placed into the specified location regardless of optimization settings, as I will want to turn optimization on at some point. I’ve tried the following so far without success:
Andy