Hello,
I searched the whole Keil/ARM Support Resources on how to use the ini File for a debug session. I found the commands for it but no really helpful example how to use them for debbugging.
For example my ini File is following:
FUNC void EnableTPIU (void) { // ETM HW Ports on CPU _WDWORD(0x4002381C, _RDWORD(0x4002381C) | 0x00000010); // RCC_AHBENR:IO port E clock enable _WDWORD(0x40021000, 0x00002AA0); //GPIOE_MODER: PE2..PE6 = Alternate function mode _WDWORD(0x40021008, 0x00002AA0); // GPIOx_OSPEEDR: PE2..PE6 = 10 MHz Medium speed _WDWORD(0x4002100C, 0x00001550); // GPIOx_PUPDR: PE2..PE6 = Pull-up _WDWORD(0x40021020, 0x00000000); // GPIOx_AFRL: PE2..PE6 = AF0 _WDWORD(0xE0042004, 0x00000020); // DBGMCU_CR } EnableTPIU(); // Debugger Setup /*------------------------------------------------------------------- ** Execute upon software RESET **-----------------------------------------------------------------*/ FUNC void OnResetExec(void) { EnableTPIU(); // Debugger Setup }
Can anyone tell me when, which function gets called? For example, where it is defined when to start the function "OnResetExec"? Or gets the complete file executed at start of debugger? The online help is not very helpful.
My goal is to automatically start logging the serial communication into a defined file with SLOG. I made it manual by typing into commands window and it worked. But I want to open and write Files depending on where my serial printf's are. So for TestFunc001 a File called for example "LogTestFunc001.txt" or for function TestFunc002 a log file "LogTestFunc001.txt". As I read in online help it should be possible to use some symbols. But I don't know how to provide symbols or variables of source code to the debugger.
Are there more detailed helps for how to use debugger commands? Does anyone has a similar use case?
Thanks.
Kind regards
Andi
Hi Andy,
The user function OnResetExec is called after every reset if it exists. Since a reset is executed by starting a debug session, this function is also called at the very beginning of a debug session. The following link explains this: http://www.keil.com/support/man/docs/uv4/uv4_db_trace_init.htm
You can specify the SLOG command at the end of your INI file (after function OnResetExec) to log the content of the Debug(printf) Viewer window into this file. With SLOG you can only open one file at the same time. I did not try this in an example, but I would try to split the output into several log files by using breakpoints on function entries where you open/close different log files. The execution of your application would be interrupted for short times so this would be a intrusive test.
I think I would print a prefix character for the "log channel" and have a post-processing step present the information as individual streams when that is meaningful - often it is important to see the different streams intermixed since that relates to the sequencing of the different "tasks" in the application.
Using a post-processing program would also allow a single prefix character (or some bits of the channel prefix character) to describe log level - debug, info, error, critical - allowing you to just focus on errors and then "zoom out" and look at any debug/info messages leading up to that error.