In order to get chibi state via the plugin I've installed ChibiStudio - and suddenly I was not able to reproduce the issue.
I know it might sound lame and wishful thinking, but it seems like using 4.9.3 AND fresh version of a makefile makes the issue either disappear or at least become much, much less often.
my older 4.8.3 with my makefile (based on older chibi makefile) fails after some iterations. my makefile with 4.9.3 fails after some iterations. it has to be 4.9.3 AND fresh chibi makefile
I wound understand if compiler would be creating faulty code, but how is it possible that compiler version or compiler options make a code which runs for 400 times and then fails? It's not like we have any JIT compilers here.
here's verbose of 'my' 'older' makefile:
arm-none-eabi-g++ -c -mcpu=cortex-m4 -std=c++11 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -Werror=write-strings -Werror=type-limits -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -Wall -Wextra -Wa,-alms=build/lst/main.lst -DST_STM32F4_DISCOVERY -DCORTEX_USE_FPU=TRUE -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -MD -MP -MF .dep/main.o.d -mthumb -DTHUMB -I. -Ichibios/os/ports/common/ARMCMx/CMSIS/include -Ichibios/os/ports/common/ARMCMx -Ichibios/os/ports/GCC/ARMCMx -Ichibios/os/ports/GCC/ARMCMx/STM32F4xx -Ichibios/os/kernel/include -Ichibios/os/hal/include -Ichibios/os/hal/platforms/STM32F4xx -Ichibios/os/hal/platforms/STM32 -Ichibios/os/hal/platforms/STM32/GPIOv2 -Ichibios/os/hal/platforms/STM32/I2Cv1 -Ichibios/os/hal/platforms/STM32/OTGv1 -Ichibios/os/hal/platforms/STM32/RTCv2 -Ichibios/os/hal/platforms/STM32/SPIv1 -Ichibios/os/hal/platforms/STM32/TIMv1 -Ichibios/os/hal/platforms/STM32/USARTv1 -Ichibios/boards/ST_STM32F4_DISCOVERY -Ichibios/os/various/cpp_wrappers -Ichibios/os/various -Iconfig/stm32f4ems -Iconfig/engines -Iconfig -Ichibios/os/various -Iext -Iext_algo -Iutil -Iconsole_util -Iconsole -Iconsole/tunerstudio -Ihw_layer -Ihw_layer/serial_over_usb -Ihw_layer/algo -Ihw_layer/lcd -Ihw_layer/stm32f4 -Idevelopment -Idevelopment/hw_layer -Idevelopment/test -Icontrollers -Icontrollers/sensors -Icontrollers/system -Icontrollers/algo -Icontrollers/core -Icontrollers/math -Icontrollers/trigger main.cpp -o build/obj/main.o
here's verbose of newer chibi makefile adopted for my project;
arm-none-eabi-g++ -c -mcpu=cortex-m4 -O2 -ggdb -std=gnu99 -fomit-frame-pointer -falign-functions=16 -ffunction-sections -fdata-sections -fno-common -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fsingle-precision-constant -std=c++11 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -Werror=write-strings -Werror=type-limits -Wall -Wextra -Wa,-alms=build/lst/main.lst -DCORTEX_USE_FPU=TRUE -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -MD -MP -MF .dep/main.o.d -mthumb -DTHUMB -I. -Ichibios/os/ports/common/ARMCMx/CMSIS/include -Ichibios/os/ports/common/ARMCMx -Ichibios/os/ports/GCC/ARMCMx -Ichibios/os/ports/GCC/ARMCMx/STM32F4xx -Ichibios/os/kernel/include -Ichibios/os/hal/include -Ichibios/os/hal/platforms/STM32F4xx -Ichibios/os/hal/platforms/STM32 -Ichibios/os/hal/platforms/STM32/GPIOv2 -Ichibios/os/hal/platforms/STM32/I2Cv1 -Ichibios/os/hal/platforms/STM32/OTGv1 -Ichibios/os/hal/platforms/STM32/RTCv2 -Ichibios/os/hal/platforms/STM32/SPIv1 -Ichibios/os/hal/platforms/STM32/TIMv1 -Ichibios/os/hal/platforms/STM32/USARTv1 -Ichibios/boards/ST_STM32F4_DISCOVERY -Ichibios/os/various -Iconfig/stm32f4ems -Iconfig/engines -Iconfig -Ichibios/os/various -Iext -Iext_algo -Iutil -Iconsole_util -Iconsole -Iconsole/tunerstudio -Ihw_layer -Ihw_layer/serial_over_usb -Ihw_layer/algo -Ihw_layer/lcd -Ihw_layer/stm32f4 -Idevelopment -Idevelopment/hw_layer -Idevelopment/test -Icontrollers -Icontrollers/sensors -Icontrollers/system -Icontrollers/algo -Icontrollers/core -Icontrollers/math -Icontrollers/trigger main.cpp -o build/obj/main.o
some of the differences between makefiles are
-fsingle-precision-constant
-falign-functions=16 -ffunction-sections -fdata-sections
-fno-common
I also have reports that 4.9.2 works with my 'older' style makefile. If the difference between 4.9.2 and 4.9.3 actually makes a difference it would be pretty upsetting.
I am logging the result of running same test with different makefiles and different compilers @
https://sourceforge.net/p/rusefi/tickets/155/