Hello,
i am writing a nortos baremetal bootloader, which should handover to a freertos app for an ARM Cortex M0 (without the VTOR)
the ‘standalone’ (no bootloader involved) freertos application works fine (3 tasks, everyone gets scheduled).
to implement the bootloader the app was moved 32k downwards the flash, and the bootloader lives on the very beginning of the flash.
as the hardware involved is a ARM M0 - without VTOR - i have a variable in reserved boot ram called application_active space determining which IRQ code is to be executed. handover is done this way:
static void __attribute__((naked)) start_app(uint32_t pc, uint32_t sp) {
__asm(" \n\
msr msp, r1 /* load r1 into MSP */\n\
bx r0 /* branch to the address at r0 */\n\
");
}
int main(void) {
...
// handover to application
__DISABLE_IRQ();
PH_HAL_NVIC_DISABLE_ALL_INTERRUPTS();
phHal_Nvic_ClearAllPendingInterrupt();
application_active = 1;
uint32_t *app_code = (uint32_t *)USER_APP_FLASH_START;
uint32_t app_sp = app_code[0];
uint32_t app_start = app_code[1];
start_app(app_start, app_sp);
while(1) {
;;
}
}
all the VT handlers have a structure like this, with pUserAppVector pointing to the beginning of the app flash section (where SP + handler adreses are)
void SysTick_Handler(void )
{
if(application_active) {
(*pUserAppVector->vtTable[14])();
} else {
// run 'normal' bootloader irq code
}
}
after handover i can see the app starting, create the tasks/timers/queues, and then each tasks blocks on its own mqueue. i can trigger a gpio irq, which creates a message and should unblock on of the tasks - but this never happens.
i believe i have done the vector remapping (yes - i have searched for ‘bootloader’ entries in this forum) correctly as the app creates an usb ccid device - which becomes visible on the connected host pc. also, the gpio irq described above seems to be correctly routed from bootloader irq vector to freertos irq handler.
also, i can see the ARM0 ported xPortSysTickHandler() beeing called regularly (trigger a led every 100 times). BUT it seems that xTaskIncrementTick() is never called(verified via another led).
before diving into the internals of the scheduler and the unblocking mechanism - has anyone an idea about this problem?
thx in advance!
hari