This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

HardFault_Hander before os_sys_init

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

os_sys_init

??