After I moved my firmware to sector 4 of flash memory, ChibiOS stopped working.
I changed this in linker script:
Code: Select all
flash : org = 0x08010000, len = 448k
And added this in chconf.h:
Code: Select all
#define CORTEX_VTOR_INIT 0x00010000
I erased the whole device memory, just in case. Firmware gets correctly written at its new location, and debugger shows that main() is invoked when I start. ChibiOS initialization works fine, but then as soon as a call a function as simple as chThdSleepMilliseconds, I end up in the unhandled_exception handler. More specifically, I can go as far as a call to chSysSwitch in chSchGoSleepS before the exception is triggered.
I've reduced my code to the minimum, to make sure that nothing else was interfering.
Code: Select all
int main()
{
halInit();
chSysInit();
chThdSleepMilliseconds(1);
return 0;
}
It seems that it is neither a hard fault, a memory fault nor a bus fault (checked with corresponding registers, and also tried to define matching handlers). And I don't know how to debug this kind of issue further.
This happens with both ChibiOS 16.1.4 and 16.1.7. I'm using gcc 4.9 in ChibiStudio (Eclipse) IDE. And most important, this is on a STM32F446.
Thanks.