This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Program flash default data defined by file with Keil

Hello,

Is there any way to configure the flash data default values during programming phase with Keil IDE?

In IAR, it is possible using a file ".s43" included in the project which defines all the default flash data.

Best regards

Parents
  • I am not an expert in IAR but i am assuming the in .s43 file you give default values to be set in the flash memory addresses.

    In KEIL you can do something like this for the flash addresses you want to set in any .c or .h file (as it suits you) using the attribute feature

    #if defined ( __CC_ARM )
    
    #define SETTING_ADDRESS_IN_FLASH  0x20007F60
    #define SETTINGS_VALUE  0x200
    uint32_t some_setting_in_flash  __attribute__((at(SETTING_ADDRESS_IN_FLASH))) = SETTINGS_VALUE;
    
    #endif
    

    The compiler will then generate the hex file with flash address and the value for it which will automatically flashed while programming your application into the device.

Reply
  • I am not an expert in IAR but i am assuming the in .s43 file you give default values to be set in the flash memory addresses.

    In KEIL you can do something like this for the flash addresses you want to set in any .c or .h file (as it suits you) using the attribute feature

    #if defined ( __CC_ARM )
    
    #define SETTING_ADDRESS_IN_FLASH  0x20007F60
    #define SETTINGS_VALUE  0x200
    uint32_t some_setting_in_flash  __attribute__((at(SETTING_ADDRESS_IN_FLASH))) = SETTINGS_VALUE;
    
    #endif
    

    The compiler will then generate the hex file with flash address and the value for it which will automatically flashed while programming your application into the device.

Children
Related