[Issue] Stack overflow error when calling dataAcquisition.setTwistChannelsUserCalibrationFactors
With the following main file main.cpp
Two behaviours appear when pressing "k" which starts dataAcquisition.setTwistChannelsUserCalibrationFactors:
- The first one : stack overflow error
Ty[00:00:07.180,000] ␛[1;31m<err> os: ***** MPU FAULT *****␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: Stacking error (context area might be not valid)␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: r0/a1: 0x00000000 r1/a2: 0x00000001 r2/a3: 0x00000001␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: r3/a4: 0x0800f92f r12/ip: 0x0800f7e7 r14/lr: 0x0800f7f3␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: xpsr: 0x0800f800␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: s[ 0]: 0x00000000 s[ 1]: 0x00000000 s[ 2]: 0x00000000 s[ 3]: 0x00000000␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: s[ 4]: 0x00000000 s[ 5]: 0x00000000 s[ 6]: 0x00000000 s[ 7]: 0x00000000␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: s[ 8]: 0x00000000 s[ 9]: 0x00000000 s[10]: 0x00000002 s[11]: 0x00000000␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: s[12]: 0x00000000 s[13]: 0x00000000 s[14]: 0x00000000 s[15]: 0x00000000␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: fpscr: 0x00000000␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: Faulting instruction address (r15/pc): 0x0800f805␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0␛[0m
[00:00:07.180,000] ␛[1;31m<err> os: Current thread: 0x20001568 (unknown)␛[0m
[00:00:07.185,000] ␛[1;31m<err> os: Halting system␛[0m
- The second one : No stack error but terminal freeze.
Note: for a given flash, the behavior (stack error/overflow) is always the same. To trigger the other error, you must reflash the target and the error will eventually change.
- When using debugger, it is possible to enter several gains (not always the same count) until overflow error. An overflow error will invariably occurs.
Note that the error won't occur at the same line of the code with debugger than without. With debugger it is on line 309 of shield_channels.cpp, in the function
_shield_channels_get_calibration_coefficients
:
VHigh gain applied will be : [00:00:15.507,000] ␛[1;31m<err> os: ***** MPU FAULT *****␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: Stacking error (context area might be not valid)␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: r0/a1: 0x000a6f66 r1/a2: 0x72614809 r2/a3: 0x75614664␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: r3/a4: 0x7720746c r12/ip: 0x6f687469 r14/lr: 0x48207475␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: xpsr: 0x21000000␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: s[ 0]: 0x00000000 s[ 1]: 0x00000002 s[ 2]: 0x00000000 s[ 3]: 0x00000000␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: s[ 4]: 0x00000000 s[ 5]: 0x00000000 s[ 6]: 0x00000000 s[ 7]: 0x00000002␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: s[ 8]: 0x00000000 s[ 9]: 0x00000000 s[10]: 0x00000000 s[11]: 0xffffffff␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: s[12]: 0x00000000 s[13]: 0x00000000 s[14]: 0x00000000 s[15]: 0x00000000␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: fpscr: 0x08000000␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: Faulting instruction address (r15/pc): 0x08003164␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0␛[0m
[00:00:15.507,000] ␛[1;31m<err> os: Current thread: 0x20001560 (unknown)␛[0m
[00:00:15.513,000] ␛[1;31m<err> os: Halting system␛[0m
Note that the code started to print the beginning of the line before crashing:
printk("%s %s applied will be : %f\n", physicalParameter, gainOrOffset, parameterCoefficient);