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

Basic Bootloader Interrupt Forwarding

Dear all,

I am using SES, I have an application that relies on a softdevice. For it I developed a custom bootloader that DOES NOT rely on the softdevice and only transfers data from and to an external SPI flash. The main looks like this:

#include <stdint.h>
#include <stdio.h>

extern "C"
{
	#include "boards.h"
	#include "nrf_bootloader_info.h"
	#include "nrf_bootloader_app_start.h"
	#include "nrf_nvmc.h"
    #include "app_scheduler.h"
	#include "app_timer.h"
}

void app_error_handler_bare(uint32_t error_code)
{
    (void)error_code;
    //NRF_LOG_ERROR("received an error: 0x%08x!\r\n", error_code);
    NVIC_SystemReset();
}


int main()
{
	nrf_drv_ppi_init();
	nrf_drv_gpiote_init();

    // necessary SPI transfers here

	nrf_bootloader_app_start();

	return 0;
}

Now, the problem is that if I build said bootloader with the NO_VTOR_CONFIG flag, any event (for instance from SPI) will hang the system. If I remove all SPI functionality and only leave the nrf_bootloader_app_start() instruction the application starts fine, as no event is ever generated inside the bootloader.

If I compile without the NO_VTOR_CONFIG flag, all SPI functionality in the bootloader works well but then the application hangs after nrf_bootloader_app_start(), which makes me think that I am doing something wrong or missing something.

I would like to keep my bootloader fairly independent from the presence (or lack) of a softdevice. More specifically I would like to have as little dependencies as possible (includes, libraries and so on). What would be the simplest, most generic way to fix this issue?

Thank you

Related