cancel
Showing results for 
Search instead for 
Did you mean: 

Custom BootLoader jump to FreeRTOS application

pfifre
Associate II
Posted on May 19, 2014 at 10:23

Hi all,

I've develop a specific bootloader which calling my application.

My application is based on FreeRTOS.

When the application starts after the jump, the firmware crashes in hardfault.

It works fine when I don't use the FreeRTOS scheduler.

I've tested my application (with FreeRTOS enabled) by loading it with the debugger and it works fine.

FreeRTOS starts their tasks by calling SVC.

Then, i've try also to replace the FreeRTOS scheduler starting by a simply __asm volatile (''svc 0'') and I reproduce the same issue.

The application address is 0x0800C000.

Like clive suggested, I have use a system call in my bootloader :

void SVC_Handler(void)

{

pFunction  Jump_To_Application;

uint32_t  JumpAddress;

/* Jump to user application */

JumpAddress = *(__IO uint32_t*) (APPLICATION_ADDRESS + 4);

Jump_To_Application = (pFunction) JumpAddress;

__disable_irq();

/* Initialize user application's Stack Pointer */

__set_MSP(*(__IO uint32_t*) APPLICATION_ADDRESS);

Jump_To_Application();

}

I've checked the VECT_TAB_OFFSET in system_stm32f4xx.c to set it to 0xC000.

Can anybody help me ?

Thanks a lot,

Pascal

#stm32-freertos
30 REPLIES 30
chen
Associate II
Posted on May 19, 2014 at 10:39

Hi

Try

VECT_TAB_OFFSET in system_stm32f4xx.c to set it to 0x0800C000

(This should be done in the application NOT the bootloader, in the booloaders the

VECT_TAB_OFFSET

MUST be 0)

Otherwise the jump code looks OK

pfifre
Associate II
Posted on May 19, 2014 at 11:28

Hi,

First, I want to thank you for your help.

Yes, of course, I've already set the VECT_TAB_OFFSET to 0xC000 in application and 0x0000 in bootloader.

In fact, my application works fine with this initialisation when I program it with the debugger. That proves that my init is fine, no?

It crashes only when I jump to it with the bootloader.

Best regards,

Pascal

chen
Associate II
Posted on May 19, 2014 at 12:16

'' I've already set the VECT_TAB_OFFSET to 0xC000 in application''

Try 0x0800C000

By the time the application is running, the internal Flash address has been remapped to 0x8000000

pfifre
Associate II
Posted on May 19, 2014 at 14:09

I did it, but nothing change, I still have the issue.

I think that the problem comes with the SVC call in FreeRTOS, but why this problem appears after a jump from bootlaoder and disappears when no SVC is made?

Best regards,

Pascal

chen
Associate II
Posted on May 19, 2014 at 14:51

Can you debug from when the jump is happening?

(unfortunately, the application debug will be in assembler but the start section is in assembled anyway).

If you cannot, then you will have to try and work out from the limited information what cause the Hardfault.

rigomate2
Associate II
Posted on May 19, 2014 at 16:19

You said:

I've tested my application (with FreeRTOS enabled) by loading it with the debugger and it works fine.

What does this actually mean.

Have you successfully run the Freertos software on your MCU, without using the bootloader?

I've had a couple of times when Freertos died at the SVC handler call, even without using a bootloader. I can't remember exactly what the cause was, but it had to do with some missimplementation I did in the project.

So, are you sure the Freertos runs on a bare MCU?

pfifre
Associate II
Posted on May 19, 2014 at 16:34

Yes, I debug the starting of application after the Jump.

The application starts well.

But, when the SVC call (__asm volatile (''svc 0'')) is made by FreeRTOS, the processor craches in HardFaultHandler.

Best regards,

Pascal

pfifre
Associate II
Posted on May 19, 2014 at 16:34

Yes, I debug the starting of application after the Jump.

The application starts well.

But, when the SVC call (__asm volatile (''svc 0'')) is made by FreeRTOS, the processor craches in HardFaultHandler.

Best regards,

Pascal

pfifre
Associate II
Posted on May 19, 2014 at 16:37

Yes, I've developped a firmware with the STM32F407 MCU and FreeRTOS since end of 2013 and it works fine.

I've now started the developpement of a custom BootLoader to upgrade this application trough USB device port.

Best regards,

Pascal