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 am having trouble in ble_stack_init while building the bootloader with gcc This same project builds/executes fine with keil but when I build with gcc I notice that the execution never returns from ble_stack_init (more specifically, the system call to sd_softdevice_enable).

    Any idea what might be the issue?

    Attaching the project file which can be built from the top directory typing 'make'

    drix-bldr.zip

  • Change in bootloader_types.h bootloader_bank_code_t and bootloader_settings_t like this: typedef enum { BANK_VALID_APP = 0x01, BANK_ERASED = 0xFE, BANK_INVALID_APP = 0xFF, DUMMY_FOR_GCC = 0x7FFFFFFF /* Joe: Required to force gcc using 32 bit enum */ } bootloader_bank_code_t;

    typedef struct { bootloader_bank_code_t bank_0; /< Variable to store if bank 0 contains a valid application. */ uint16_t bank_0_crc; /< If bank is valid, this field will contain a valid CRC of the image. */ uint16_t reserved; /< Padding word */ bootloader_bank_code_t bank_1; /< Variable to store if bank 1 has been erased/prepared for new image. Bank 1 is only used in Banked Update scenario. */ uint32_t bank_0_size; /**< Size of bank0. */ } bootloader_settings_t;

    But this doesn't affect softdevice init. If SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, true) function hangs it means one of following problems:

    1. You don't have your softdevice flashed. Thy to read the softdevice and verify it.
    2. You trying to debug your code and it hangs on this line in gdb debugger. Because debugger can't debug softdevice it just hangs so it's not possible to debug your program if your program uses softdevice.
    3. Softdevice can't init LFCLK crystal (hardware problem). But if this same code was compiled with Keil and it works then it's not a problem of hardware.
Reply
  • Change in bootloader_types.h bootloader_bank_code_t and bootloader_settings_t like this: typedef enum { BANK_VALID_APP = 0x01, BANK_ERASED = 0xFE, BANK_INVALID_APP = 0xFF, DUMMY_FOR_GCC = 0x7FFFFFFF /* Joe: Required to force gcc using 32 bit enum */ } bootloader_bank_code_t;

    typedef struct { bootloader_bank_code_t bank_0; /< Variable to store if bank 0 contains a valid application. */ uint16_t bank_0_crc; /< If bank is valid, this field will contain a valid CRC of the image. */ uint16_t reserved; /< Padding word */ bootloader_bank_code_t bank_1; /< Variable to store if bank 1 has been erased/prepared for new image. Bank 1 is only used in Banked Update scenario. */ uint32_t bank_0_size; /**< Size of bank0. */ } bootloader_settings_t;

    But this doesn't affect softdevice init. If SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, true) function hangs it means one of following problems:

    1. You don't have your softdevice flashed. Thy to read the softdevice and verify it.
    2. You trying to debug your code and it hangs on this line in gdb debugger. Because debugger can't debug softdevice it just hangs so it's not possible to debug your program if your program uses softdevice.
    3. Softdevice can't init LFCLK crystal (hardware problem). But if this same code was compiled with Keil and it works then it's not a problem of hardware.
Children
No Data
Related