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

How do I write a 0 CRC to the bootloader settings when flashing the application using J-Link?

When the bootloader in SDK 8.0.0 checks whether the application is valid, it only computes the CRC for the application if the CRC in the bootloader settings for that bank is not zero (see bootloader_app_is_valid() in bootloader.c)

I flash the soft device, bootloader and application all separately using a custom Makefile loosely based on Ole's pure-gcc makefiles. I use gcc, not Keil. How can I write a 0 CRC to the bootloader settings for bank 0 at the same time as I flash the application?

Parents
  • Well looking at the code

    dfu_types.h:#define BOOTLOADER_SETTINGS_ADDRESS     0x0003FC00    
    
    uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used));
    
    void bootloader_util_settings_get(const bootloader_settings_t ** pp_bootloader_settings)
    {
        // Read only pointer to bootloader settings in flash. 
        static bootloader_settings_t const * const p_bootloader_settings =  (bootloader_settings_t *)&m_boot_settings[0];        
    *pp_bootloader_settings = p_bootloader_settings;
    }
    
    typedef struct
    {
        bootloader_bank_code_t bank_0;          
        uint16_t               bank_0_crc;    
    ....
    } bootloader_settings_t
    

    it's at 0x3FC00 + the offset to bank_0_crc which, as it's 16-bit aligned, I would guess is 2

Reply
  • Well looking at the code

    dfu_types.h:#define BOOTLOADER_SETTINGS_ADDRESS     0x0003FC00    
    
    uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used));
    
    void bootloader_util_settings_get(const bootloader_settings_t ** pp_bootloader_settings)
    {
        // Read only pointer to bootloader settings in flash. 
        static bootloader_settings_t const * const p_bootloader_settings =  (bootloader_settings_t *)&m_boot_settings[0];        
    *pp_bootloader_settings = p_bootloader_settings;
    }
    
    typedef struct
    {
        bootloader_bank_code_t bank_0;          
        uint16_t               bank_0_crc;    
    ....
    } bootloader_settings_t
    

    it's at 0x3FC00 + the offset to bank_0_crc which, as it's 16-bit aligned, I would guess is 2

Children
No Data
Related