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

GCC Compiler failed at setting of BANK_VALID_APP flag

System:

-nRF51822, SDK11, Eclipse with GCC

-Project based on dfu_dualbank_s132

Intention:

Flash the combined SoftDevice, Bootloader and Application, where the device branches to the application

Recommented Solution from Nordic:

#elif defined ( __GNUC__ )
uint8_t m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used)) = {BANK_VALID_APP};

**Compiler Error Message**

error: 'at' attribute directive ignored [-Werror=attributes]
 uint8_t m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used)) = {BANK_VALID_APP};

Question

It seems to be stupid, but I have no idea, what could be missing ?

Uwe

Parents
  • Hi, the 'at address' attribute is not supported by the GCC toolchain so you need to use the section attribute instead.

    This variable is already declared in bootloader_settings.c:

    uint8_t m_boot_settings[CODE_PAGE_SIZE] __attribute__ ((section(".bootloaderSettings")));
    

    which you can change to uint8_t m_boot_settings[CODE_PAGE_SIZE] __attribute__ ((section(".bootloaderSettings"))) = {{BANK_VALID_APP}};.

    Note, you might have to remove the NOLOAD directive for .bootloaderSettings in the linker script (dfu_gcc_nrf51.ld) to ensure that it actually becomes initialized.

Reply
  • Hi, the 'at address' attribute is not supported by the GCC toolchain so you need to use the section attribute instead.

    This variable is already declared in bootloader_settings.c:

    uint8_t m_boot_settings[CODE_PAGE_SIZE] __attribute__ ((section(".bootloaderSettings")));
    

    which you can change to uint8_t m_boot_settings[CODE_PAGE_SIZE] __attribute__ ((section(".bootloaderSettings"))) = {{BANK_VALID_APP}};.

    Note, you might have to remove the NOLOAD directive for .bootloaderSettings in the linker script (dfu_gcc_nrf51.ld) to ensure that it actually becomes initialized.

Children
Related