FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [September 2013 Threads] Hardfault when jumping to app from bootloaderPosted by https://www.google.com/accounts on September 3, 2013 Hi All,
I’m using an STM32F407 and IAR EWARM version 6.50.6 I have an old non FreeRTOS boot loader at address 0x08000000 and a FreeRTOS main application at address 0x08010000. I can download via my boot loader and jump to my application fine. Obviously the jump to the main application occurs when the CPU is using the MSP.
My new boot loader now contains FreeRTOS and replaces the old boot loader. When I attempt to jump from a task in the boot loader to the main application, I get a hard fault. This happens since the task in the boot loader was using the PSP and this area of SRAM gets initialized when the main application starts causing a function to return to address 0.
I have read other posts and realize I need to be using MSP when I jump to the main application, not the PSP.
I therefore generated an interrupt from within the boot loader task so the CPU was using the MSP and performed the jump. Before the jump (but from within the IRQ Handler), I stop the FreeRTOS timer, disable all IRQ’s and clear all pending IRQ’s in the NVIC. I then perform the jump to the main application from within the IRQ Handler.
The jump works fine and the main FreeRTOS based application goes through all its initialization clearing SRAM, creating tasks and queues etc. I now get a hard fault when “svc 0” is executed within vPortStartFirstTask() I assume this is caused by the fact that the IRQ_Handler I was executing within the boot loader is still “ACTIVE” as per the NVIC->IABR[].
Can anyone suggest the solution please, or correct my assumptions?
Thank, Cameron
RE: Hardfault when jumping to app from bootloaderPosted by https://www.google.com/accounts on September 4, 2013 Hi All,
I have seen the error of my ways!
The fix to my issue involved: 1. Creating the boot loader task that jumps to the main application with portPRIVILEGE_BIT set 2. __set_CONTROL(0); // Change from PSP to MSP 3. __set_MSP(*(__IO uint32_t*) APP_START_ADDRESS); 4. jumpToApplication()
I hope this post helps others.
Cheers,
Cameron
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|