Fabrizio
You will need to change the linker script file to do this but you can copy the method used for locating the Flash configuration area.
1. [simplified for GCC but see original code for other compilers]
// Flash configuration - this is linked at address 0x00000400 (when working with standalone-build)
//
const KINETIS_FLASH_CONFIGURATION __attribute__((section(".f_config"))) __flash_config
= {
KINETIS_FLASH_CONFIGURATION_BACKDOOR_KEY,
KINETIS_FLASH_CONFIGURATION_PROGRAM_PROTECTION,
KINETIS_FLASH_CONFIGURATION_SECURITY,
KINETIS_FLASH_CONFIGURATION_NONVOL_OPTION,
KINETIS_FLASH_CONFIGURATION_EEPROM_PROT,
KINETIS_FLASH_CONFIGURATION_DATAFLASH_PROT
};
2. In the linker script file you need to add a section that is referenced by the __attribute__ (.f_config) in above case
.f_config ALIGN(__Fconfig_segment_start__ , 4) :
{
__flash_config = .;
KEEP(*(.f_config .f_config.*))
}
This will put your const values into a section.
Note the KEEP() which informs that linker that it should ALWAYS put the values there, even if it doesn't think that they are being used.
3. The physical address range of the section then also needs to be define in the linker script
__Fconfig_segment_start__ = 0x00000400;
__Fconfig_segment_end__ = 0x0000040f;
In the case of the flash configuration it starts at 0x400 and can be 0x10 bytes long
If you do the equivalent for a new section/segment you will be able to locate const values there.
Good luck
Regards
Mark