Page 1 of 2
STM32F767 freeze on chibios update
Posted: Tue Mar 03, 2020 9:31 pm
by tsm
Hi all,
I've been searching for related posts but to no avail. If I missed anything please direct me there.
I'm rebooting a project, started by someone else, where chibios is at the following revision:
Code: Select all
commit 1d3bbc72c326e87bb688cbce39ea93b71b4406d3 (origin/master, origin/HEAD)
Author: Giovanni Di Sirio <[email protected]>
Date: Fri Mar 23 14:46:11 2018 +0000
Restored launch files.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11850 110e8d01-0319-4d1e-a829-52ad28d1bb01
I updated chibios to
ver-2019.1.3 as well as my
chconf.h file (so that RT version went from 5 to 6) and found that my board freezes. When pausing with a debugger I see that it is always stopped at the following line in
chSysInit:
Code: Select all
#if CH_DBG_STATISTICS == TRUE
/* Starting measurement for this thread.*/
chTMStartMeasurementX(&currp->stats);
#endif
but I'm not sure if this is just an artifact of the debugger.
After a bit of searching (and git blame) I seem to conclude that the cause is updating RT to version 6 (_CHIBIOS_RT_CONF_VER_6_0_) on this commit:
Code: Select all
commit 26db32042bd7a2437246765ccf9157dd17ec824b
Author: Giovanni Di Sirio <[email protected]>
Date: Sat Jun 16 13:55:17 2018 +0000
Moved RT version to 6.0, updated all chconf.h files.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12106 110e8d01-0319-4d1e-a829-52ad28d1bb01
By testing with it's previous commit (and RT version 5 on my chconf) all works well. I've compared my
chconf with the one provided in the demos and the only difference I see is that all definitions are guarded by an
#if !defined(...) (which I tried as well) and some CH_DBG_ flags that were setup already.
Do I need to update any other file? mcuconf or halconf?
Thank you
Re: STM32F767 freeze on chibios update
Posted: Tue Mar 03, 2020 9:50 pm
by Giovanni
Hi,
In general you should take all configuration files AND makefiles from the version you are using.
Your description does not give ma an hint about what the problem could be. That function is the calibration for time measurement, you could disable time measurement in chconf.h but that would be a workaround not a solution.
Could you try the latest officially release one? 19.1.3. Taking the latest subversion trunk code would be fine too.
Giovanni
Re: STM32F767 freeze on chibios update
Posted: Wed Mar 04, 2020 10:09 am
by tsm
Hi Giovanni,
thanks for helping.
I forgot to say that on openocd's trace I get the following:
Info : Successfully loaded memory map of ChibiOS/RT target running version 6.0.3
Error: ChibiOS registry integrity check failed, double linked list violation
Info : Only showing current execution because of a broken ChibiOS thread registry
I'll review the makefiles and configuration as suggested and comeback with more information.
Thank You
EDIT:
I've tested with 19.1.3 as well (in the following revision). That was my first test before bisecting the logs.
Code: Select all
commit 313416b8fda90d9973a749a0a35970956852c286 (HEAD, tag: ver19.1.3)
Merge: bbc61c3df 14e10a2e8
Author: Giovanni Di Sirio <[email protected]>
Date: Sun Jul 14 07:26:31 2019 +0000
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/tags/ver19.1.3@12914 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
Re: STM32F767 freeze on chibios update
Posted: Wed Mar 04, 2020 1:12 pm
by tsm
I've updated my chconf and nothing changed. By comparing makefiles I also don't see any changes besides the original ones that were made on my project. I have also reduced my main to a LED blinker but the problem persists.
By disabling all the debug flags and pausing execution with the debugger the thred stops at:
Re: STM32F767 freeze on chibios update
Posted: Wed Mar 04, 2020 1:34 pm
by Giovanni
It should never stop there unless crt0_xxx.S is missing. I suggest you to review your makefile, in case of doubt just try to build one of the existing demos and verify functionality.
Giovanni
Re: STM32F767 freeze on chibios update
Posted: Wed Mar 04, 2020 8:20 pm
by tsm
hm I compared makefiles and haven't seen any relevant difference yet. When disassembling the .elf file I can see the crt0_entry:
Code: Select all
00200210 <_crt0_entry>:
200210: b672 cpsid i
200212: 4839 ldr r0, [pc, #228] ; (2002f8 <endfiniloop+0x6>)
200214: f380 8808 msr MSP, r0
200218: 4838 ldr r0, [pc, #224] ; (2002fc <endfiniloop+0xa>)
20021a: f380 8809 msr PSP, r0
(...)
I noticed when pausing and then resuming with the debugger the debugging session stops with:
Code: Select all
Info : The target is not running when halt was requested, stopping GDB.
Warn : target stm32f7x.cpu is not halted (gdb fileio)
Info : Successfully loaded memory map of ChibiOS/RT target running version 6.0.3
Error: ChibiOS registry integrity check failed, double linked list violation
Info : Only showing current execution because of a broken ChibiOS thread registry.
Info : dropped 'gdb' connection
What does the following mean?
Code: Select all
Error: ChibiOS registry integrity check failed, double linked list violation
Info : Only showing current execution because of a broken ChibiOS thread registry.
Re: STM32F767 freeze on chibios update
Posted: Wed Mar 04, 2020 8:43 pm
by Giovanni
That message about the broken list probably is caused by the OS not yet initialized at that point.
Try compiling using -O0 and disabling LTO, you need to understand exactly where it fails. Also enable assertions and state checker in chconf.h.
Giovanni
Re: STM32F767 freeze on chibios update
Posted: Sat Mar 07, 2020 8:30 pm
by tsm
Giovanni wrote:That message about the broken list probably is caused by the OS not yet initialized at that point.
Try compiling using -O0 and disabling LTO, you need to understand exactly where it fails. Also enable assertions and state checker in chconf.h.
Giovanni
I've tried with without LTO and O0 but no luck. After updating makefiles, I generated compile_commands.json and noticed the following differences on the non-working branch:
- I'm compilling an extra file
chibios/os/hal/ports/STM32/LLD/EXTIv1- I had
-mthumb mode enabled. I've restored this which entailed removing
-mthumb and adding
-mno-thumb-interwork -DTHUMB_NO_INTERWORKING. But still the same behaviour
I've reduced my main() to simply blinking some LEDS and started removing cpp files until things work. Odd enough it works without two files: one class which is a thin wrapper around
SerialDriver and a Syslog class that sends some data through TCP (using lwip). This syslog uses
chThdCreateStatic with a stack size of 512, but I'm a bit lost to why it works this way
Re: STM32F767 freeze on chibios update
Posted: Sat Mar 07, 2020 8:56 pm
by Giovanni
Those things are out of my visibility, can't really help with that.
My generic advice is to remove everything then re-introduce things one at time.
Giovanni
Re: STM32F767 freeze on chibios update
Posted: Sun Mar 08, 2020 8:52 am
by rew
tsm wrote:- I'm compilling an extra file chibios/os/hal/ports/STM32/LLD/EXTIv1
- I had -mthumb mode enabled. I've restored this which entailed removing -mthumb and adding -mno-thumb-interwork -DTHUMB_NO_INTERWORKING. But still the same behaviour
If you need the "EXTIv1 driver", (or not) you seem to be using and STM32xxxx CPU. These are "cortex-M" arm-variants. These do not have the original ARM instruction set, but only the thumb instruction set.
So... I would expect that you NEED the -
mthumb option to the compiler.