Hi!
I'm not sure this is STM32 specific, anyway, I need solution for STM32.
I set breakpoint to chSysHalt function, and when ChibiOS halts for some reason, I can see this and try to find reason for this stop.
But 'reason' variable contains name of calling function only, and I have to find this function, set breakpoint, restart app, trace and try to get real reason for stopping. It is boring anyway and not always I get get same conditions when step-by-step tracing.
As I understand, chDbgCheck/chDbgAssert are receiving 'remark' const char, but not sending it next to chsysHalt function.
Why?
How can I get both __func__ and remark at sysHalt point?
I'm newbiew, and I do not know which parts of which libs I can use and where, so it is will be nice if you will provide me with code example.
Thank you in advance!
Debugging with STM32
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Debugging with STM32
Hi,
Because the remark strings would take too space and the test suite would not fit on some devices.
After stopping in chSysHalt() look at the stack trace, the debugger will show you the exact points of the halt, including the remarks string. Basically there is no need to have them in memory, the debugger can show you them from sources.
Giovanni
Because the remark strings would take too space and the test suite would not fit on some devices.
After stopping in chSysHalt() look at the stack trace, the debugger will show you the exact points of the halt, including the remarks string. Basically there is no need to have them in memory, the debugger can show you them from sources.
Giovanni
Re: Debugging with STM32
I have not so big monitor to display stack too 
But I'm absolutely sure that I have enough memory in my STM32F429 (in fact, most of it unused yet, and I can spend some memory when debugging for debugging to be more suitable for me).
Maybe it is a possibility to define my own checkDbg/assertDbg function?
What I should insert and in which file? Pleeease!
But I'm absolutely sure that I have enough memory in my STM32F429 (in fact, most of it unused yet, and I can spend some memory when debugging for debugging to be more suitable for me).
Maybe it is a possibility to define my own checkDbg/assertDbg function?
What I should insert and in which file? Pleeease!
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Debugging with STM32
It is possible, note that those functions are macros and can be redefined. You may place your own versions in chconf.h.
Giovanni
Giovanni
Re: Debugging with STM32
Sorry, but I'm newbiew.
I can use sprintf for concatenating string here, for example, but I think there is a simpler way
May be you can put here example of such function?
Thanks!
I can use sprintf for concatenating string here, for example, but I think there is a simpler way
May be you can put here example of such function?
Thanks!
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Debugging with STM32
I would use strcat(), it is simpler. You could also use chprintf() on a MemoryStream object, see HAL documentation regarding streams.
Giovanni
Giovanni
Re: Debugging with STM32
I sure I did it not optimal way, but it works..
Code: Select all
#define chDbgAssert(c, r) do { \
if (CH_DBG_ENABLE_ASSERTS != FALSE) { \
if (!(c)) { \
char error_string[128] = r; \
strcat(error_string, " ("); \
strcat(error_string, __func__); \
strcat(error_string, ")"); \
chSysHalt(error_string); \
} \
} \
} while (false)