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

  • 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!

  • Well, it's because it's two memory variables m_boot_settings and m_uicr_bootloader_start_address i.e. initialized data, so it displayed as such. In Joe Merten's code he doesn't initialize this sections, so it don't displayed in any section. I have only this version of his code: BleblGcc-V2.zip devzone.nordicsemi.com/.../91147761347a17943df78d3a4bf1fc24

  • Dear all,

    I have somewhat strange DFU behaviour, the bootloader starts and advertises, connection is also possible, but as soon as I press "Upload" it fails. I couldnt debug it while in the SoftDevice.

    Tried both ios apps "nRF Loader" and DFU from "nRF Toolbox", also same failer with hex or bin file. With the sniffer I can see some packages sent, the progressbar goes to 1% and then "asserts"/fails.

    Anyone has had similar issue?

    Here is my env: s110_nrf51822_6.0.0_softdevice.hex nrf51_sdk_v5_2_0_39364 is used, on the DevKit nrg6310 board.

    my src zip is attached, I read again and again this thread, seems to have all your comments in. Or am I missing something? DFU_GCC_OL.zip

    image description

    EDIT: make log file attached

  • Attach the console output of your make, please. Have you successfully compiled & ran e.g hrs example?

Related