2014-05-19 01:23 AM
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-freertos2014-05-19 07:52 AM
I put a breakpoint on the SVCHandler in my application.
In fact, when the FreeRTOS launch the svc call, the SVChandler has never been called.What does it mean ?ThanksPascal2014-05-19 08:06 AM
What does it mean ?
I don't know, do you have linkage via the vector table? Does your Hard Fault handler output any diagnostic information? What debugger are you using?My example didn't disable interrupts, the expectation at the hand-over is that you've cleaned up the operating environment, and that the application can handle whatever is left.Other Thread
https://community.st.com/0D50X00009XkiGuSAJ
EDIT: Fixed DEAD LINK, Original from 14-May-2014
2014-05-19 08:28 AM
Hi
Reading the thread from top to bottom - I think you are confused as to what is doing what. ''I've develop a specific bootloader which calling my application. My application is based on FreeRTOS.'' It is unclear now whether the bootloader is running FreeRTOS. Does the bootloader run with FreeRTOS? If so - why? The bootloader only needs to : download application code binary via USB Program code into Flash. Check if valid application code is in Flash If Application code is valid - start it. There is no need for the bootloader to run FreeRTOS - it only complicates the bootloader. If the bootloader does not run FreeRTOS - the jump does not need to be in the SVC - simplifying your problem.2014-05-19 08:43 AM
How can I see if I have the linkage with the vector table?
I can read memory or the registers via the debugger.I'm using GDB under Eclipse IDE.Yes, I think your're right, the processor call the HardFault Handler because it didn't find any handler for SVC.But, I'm sure that the VTOR points on 0x800C000.''the expectation at the hand-over is that you've cleaned up the operating environment''But the systemInit and main initialisation has been called before launch SVC.Thanks for your help.Pascal2014-05-19 08:52 AM
No, my bootloader doesn't run with FreeRTOS, but, my application does.
OK, I try a call from bootloader without SVC.But, I do that before and I have the same problem.Best regards,Pascal2014-05-19 08:59 AM
But, I'm sure that the VTOR points on 0x800C000.
If you are in the boot loader, then SCB->VTOR should point at THAT, the application should fix up it's vector address in SystemInit() You are attempting to start an application image at 0x0800C000 from a boot loader at 0x08000000, right?''the expectation at the hand-over is that you've cleaned up the operating environment''
But the systemInit and main initialization has been called before launch SVC.
Ok, but my point is that you shouldn't be leaving the kitchen messy, ie no random SysTick or TIM IRQ firing, and no DMA mid transaction.2014-05-19 09:03 AM
2014-05-19 11:57 PM
Clive,
You are attempting to start an application image at 0x0800C000 from a boot loader at 0x08000000, right?Yes, that's right.And the SystemInit in BootLoader fixes up the VTOR to 0x8000000 and the Application fixes up to 0x800C000 in SystemInit to.Ok, but my point is that you shouldn't be leaving the kitchen messy, ie no random SysTick or TIM IRQ firing, and no DMA mid transaction.How can avoid these? Disable irq is not sufficient?Thanks,Pascal2014-05-20 12:01 AM
sung.chen_chung,
OK, I definitivly don't use the SVC in my bootloader.The application MUST disable the SysTick as soon as possibleOK, I will try it.Thanks for your support,Pascal
2014-05-20 01:52 AM
I've disabled SysTick at starting in my application.
Nothing change, I still have the same issue.I simplify my application to not use FreeRTOS but simply call SVC at the beginning (__asm volatile(''svc 0'')).The HardFault Handler is called immediatly.It looks like that no handler will be load for treating SVC interrupt.How can I verify that the vector table is loaded?Best regards,Pascal