I use newest chibios from github downloaded from master yesterday (27.01.2021), because I read viewtopic.php?f=35&t=5678, unfortunately new version of chibios didn't solve the issue. I'm new in IoT programming so I have no clue how to fix it right way.
Issue:
unhandled exception if program is compiled with -O2 or -Os flag see "unhandled_exception.png". With "-Og" it works like a charm.
Inline optimalization log "-O2 -fopt-info-inline-all" https://pastebin.com/UPqmp9rp .
It works if I add "NOINLINE" to lines https://github.com/ChibiOS/ChibiOS/blob ... .h#L91-L92
Code: Select all
NOINLINE void __tm_calibration_init(tm_calibration_t *tcp);
NOINLINE void chTMObjectInit(time_measurement_t *tmp);or add " -fno-inline " flag. Flag "-finline-small-functions" does not work at all.
I tested three toolchains:
gcc-arm-none-eabi-10-2020-q4-major-win32 - does not work
gcc-arm-none-eabi-9-2019-q4-major-win32 - does not work
gcc-arm-none-eabi-7-2017-q4-major-win32- works
Board: nucleo F401RE
Devel platform: win10
I reduced program to simple shell tests:
static const ShellConfig shell_cfg1 = {
(BaseSequentialStream *)&SD2,
shell_local_commands
};
/*
* Application entry point.
*/
int main(void) {
halInit();
chSysInit();
shellInit();
while (true) {
thread_t *shelltp = chThdCreateFromHeap(NULL, 800,
"shell", NORMALPRIO + 50,
shellThread, (void *)&shell_cfg1);
chThdWait(shelltp);
chThdSleepMilliseconds(150);
palClearPad(GPIOA, GPIOA_LED_GREEN);
chThdSleepMilliseconds(100);
palSetPad(GPIOA, GPIOA_LED_GREEN);
chThdSleepMilliseconds(100 );
}
}
BTW: I use LGVL as well (but for test was removed) and it does not work at all too with GCC10 and 9 and "-O2". I didn't figure out how to fix it. ChibiOs is much more friendly for debugging. Nice piece of SW.