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

nRF51822 over the air bootloader with gcc

For my current project, I need to compile the »over the air bootloader« with gcc (because our buildserver runs on linux, developers using Mac … no Windows and no Keil so far).

But unfortunaly, the bootloader example from the sdk (5.1) examples won't compile with gcc. It's missing gcc makefile and even there are at least 2 Keil specific files in the project (arm_startup_nrf51.s and bootloader_util_arm.c).

Could you provide support to help me on this topic?

I'd also checked:- devzone.nordicsemi.com/index.php/nrf51822-bootloader-with-gcc

Parents
  • I try to modify the code based on Nikita's method,

    uint8_t __attribute__((section (".bootloader_settings_sect"))) m_boot_settings[CODE_PAGE_SIZE] __attribute__((used));
    uint32_t __attribute__((section (".NRF_UICR_BOOT_START_SECT"))) m_uicr_bootloader_start_address = BOOTLOADER_REGION_START;
    

    and in the linkscript, I modified like this,

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x0003C000, LENGTH = 0x3C00
      bootloader_settings (rwx) : ORIGIN = 0x0003FC00, LENGTH = 0x400
      NRF_UICR_BOOT_START (rwx) : ORIGIN = 0x10001014, LENGTH = 0x4
      RAM (rwx) :  ORIGIN = 0x20002000, LENGTH = 0x2000
    }
    

    And the following code is added to the common link script,

    .bootloader_settings_block 0x0003FC00 :
    {
    	KEEP(*(.bootloader_settings_sect))
    } > bootloader_settings
    
    .NRF_UICR_BOOT_START_BLOCK 0x10001014 :
    {
    	KEEP(*(.NRF_UICR_BOOT_START_SECT))
    } > NRF_UICR_BOOT_START
    

    but seems that the bootloader_settings section is treated as a .data section, will it consume real memory ? I checked the map file, seems the real .data section only consumes one thunder bytes of memory.

      text    data     bss     dec     hex
     12197    1128    4728   18053    4685
    

    Anyone has the same issue?

    BTW, I cannot find Joe Merten's code from this page, could anyone help to put it to this page again? Thanks a lot!

Reply
  • I try to modify the code based on Nikita's method,

    uint8_t __attribute__((section (".bootloader_settings_sect"))) m_boot_settings[CODE_PAGE_SIZE] __attribute__((used));
    uint32_t __attribute__((section (".NRF_UICR_BOOT_START_SECT"))) m_uicr_bootloader_start_address = BOOTLOADER_REGION_START;
    

    and in the linkscript, I modified like this,

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x0003C000, LENGTH = 0x3C00
      bootloader_settings (rwx) : ORIGIN = 0x0003FC00, LENGTH = 0x400
      NRF_UICR_BOOT_START (rwx) : ORIGIN = 0x10001014, LENGTH = 0x4
      RAM (rwx) :  ORIGIN = 0x20002000, LENGTH = 0x2000
    }
    

    And the following code is added to the common link script,

    .bootloader_settings_block 0x0003FC00 :
    {
    	KEEP(*(.bootloader_settings_sect))
    } > bootloader_settings
    
    .NRF_UICR_BOOT_START_BLOCK 0x10001014 :
    {
    	KEEP(*(.NRF_UICR_BOOT_START_SECT))
    } > NRF_UICR_BOOT_START
    

    but seems that the bootloader_settings section is treated as a .data section, will it consume real memory ? I checked the map file, seems the real .data section only consumes one thunder bytes of memory.

      text    data     bss     dec     hex
     12197    1128    4728   18053    4685
    

    Anyone has the same issue?

    BTW, I cannot find Joe Merten's code from this page, could anyone help to put it to this page again? Thanks a lot!

Children
Related