chThdSleepMilliseconds crashes
Posted: Fri Feb 06, 2015 3:02 pm
Good afternoon,
I'm currently writing a bootloader for the STM32F407 Discovery board. Im flashing by a serial connection writing the first bytes at position 0x0801 0000. The bootloader which I'm using is taken from a STM32F3-Bootloader. Now I wanna boot a demo program which looks like this:
It does its job but as soon I'm going to replace the NOP parts by chThdSleepMilliseconds() the whole system freezes. I've tried to debug whats going on. The MCU is finally freezing at point:
0x08000cc0: b.n 0x8000cc0 <_unhandled_exception>
My idea is, that I probably forgot to disable a specific timer in the bootloader. Thats my bootloader code:
Regards
I'm currently writing a bootloader for the STM32F407 Discovery board. Im flashing by a serial connection writing the first bytes at position 0x0801 0000. The bootloader which I'm using is taken from a STM32F3-Bootloader. Now I wanna boot a demo program which looks like this:
Code: Select all
int main(void)
{
halInit();
uint32_t i;
palSetPadMode(GPIOE, 8, PAL_MODE_OUTPUT_PUSHPULL);
while (TRUE) {
palSetPad(GPIOE, 8);
for(i=0; i<0xFFFFFF; i++)
palSetPad(GPIOE, 0); // NOP
palClearPad(GPIOE, 8);
for(i=0; i<0xFFFFFF; i++)
palClearPad(GPIOE, 0); // NOP
}
}
It does its job but as soon I'm going to replace the NOP parts by chThdSleepMilliseconds() the whole system freezes. I've tried to debug whats going on. The MCU is finally freezing at point:
0x08000cc0: b.n 0x8000cc0 <_unhandled_exception>
My idea is, that I probably forgot to disable a specific timer in the bootloader. Thats my bootloader code:
Code: Select all
#define FLASH_USER_BASE 0x08000000
#define FW_BASE 0x10000
static void jumpToApp(uint32_t address)
{
//SysMemBootJump=(void (*)(void)) (*((u32 *) address));
typedef void (*pFunction)(void);
pFunction Jump_To_Application;
/* variable that will be loaded with the start address of the application */
vu32* JumpAddress;
const vu32* ApplicationAddress = (vu32*)address;
/* get jump address from application vector table */
JumpAddress = (vu32*) ApplicationAddress[1];
/* load this address into function pointer */
Jump_To_Application = (pFunction) JumpAddress;
/* reset all interrupts to default */
chSysDisable();
/* Clear pending interrupts just to be on the save side*/
SCB_ICSR = ICSR_PENDSVCLR;
/* Disable all interrupts */
int i;
for(i=0; i<8; i++)
NVIC->ICER[i] = NVIC->IABR[i];
__set_MSP((u32) (ApplicationAddress[0]));
Jump_To_Application();
}
void main() {
// Doing some flashing actions
jumpToApp(FLASH_USER_BASE + FW_BASE);
}
Regards