I have FreeRtos running on ETT STM32F103 evaluation board, which has STM32F103RBT6 microcontroller. I debug it with IAR Jlink in IAR541 environment. My application starts at ROM address 0x8003000. Being downloaded and run from debugger it works stable for many days.
I wrote a very simple loaders, only executes jump to application. Basic part of it is:
static bool jump_to( unsigned char* dest )
{
void (*prog_start)(void);
if (( *(unsigned long*)dest & 0x3FFF8000 ) == 0x20000000 ) // looks like a stack pointer?
{
__disable_interrupt();
prog_start = (void(*)(void))*(unsigned long*)(dest + 4); // load program start address
__MSR_MSP( *(unsigned long*)dest ); // load user stack
prog_start(); // now jump
}
return ( false );
}
where dest is 0x8003000.I download FreeRtos program, after that – dowload loader and start it. The FreeRtos program runs up to Scheduler and crashes. If I enable Watchdog it restarts all t he time. Unfortunately I cannot break the program there using JTAG. I can assume that it gets into HardFaultException If instead of FreeRtos application I use some simple LED blinking program everything works perfectly. Could somebody give a clue?