We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all,
I'm using Keil RV4.10 on MCBSTM32 demo board (STM32F103RB) with STM32F10x_StdPeriph_Lib_V3.1.2 and Keil RTX kernel.
My application is relocated at 0x8002800 (bootloader and configuration data are placed before).
My main just setup the clock, peripherals, interrupts, etc ... and call
os_sys_init
All seems to be ok.
Recently I had to add in infinite cicle for debug/test purposes just after clocks and irq setup, like this:
int main(void) { MicroController.Setup(); //setup clock, preiphs, irq,... while(1) { IWDG_ReloadCounter(); //DEBUG } os_sys_init(FirstTask); }
then something strange happens... during the while(1) loop the application goes into HardFault_Handler, and the debugger shows me the following call stack:
HardFault_Handler() rt_put_rdy_first() rt_systick() HAL_CM3() rt_systick()
Could this be related to the RTX kernel ?
What's happening ? Am I not allowed to do whatever I want before calling
??
These links may provide you with the info you need to answer your question....
What happens within startup code: www.embedded.com/.../200900043
RTX startup: www.keil.com/.../rlarm_ar_hints_cortex.htm
-OR-
http://www.keil.com/support/man/docs/rlarm/rlarm_ar_hints_arm.htm
Jed C,
thanks for the links, but they didn't help. I do have a large-enough main stack, my code is all privileged, and all my setup activities uses global or setup-local variables, so the stack is clean after hw initialization. Furthermore, there are no problems if I don't put an endless loop before the os_sys_init call, and the loop itself consumes very little stack... So it seems a matter of ''how long'' I indulge in the main before calling os_sys_init... From the call stack seems that the os is trying to schedule, but ther's nothing to schedule yet... hence the hardfault...
Any more specific hint ?