Hi,
I am trying to get debug messages out to GDB elf/prorgam console when debuging:
I am using STM32F207IG CPU. The init code looks like:
Display All
The messages/data are going out from CPU at baud speed 19200. When i start JLink.exe and type SWOStart, i can see in SWV control panel that data is arriving .
I need few things:
1.] How to enable SWV support on JLINK GDB server. By typing:
JLinkGDBServerCL.exe -SWOPort 4444
it opens the port 4444 but no messages are inside. Maybe missing protocol
2.] What kind of protocol i have to use to transfer data/messages between CPU a GDB elf console.
Somehow it must work becouse i can clearly see that GDB server sends some messages to client side console like:
Resetting target...and so on
3.] How can i change the baud rate from 19200 to something else?
Is there any documentation about that part? Because i cant find them in standart Docs, and in your market brosure you writing:
Serial Wire Debug (SWD) and Serial Wire Viewer (SWV) support
Thank you,
Regards
Ing.Tomas Kamenicky
Green CENTER s.r.o.
I am trying to get debug messages out to GDB elf/prorgam console when debuging:
I am using STM32F207IG CPU. The init code looks like:
Source Code
- uint32_t SWOSpeed = 19200; //Baud rate
- uint32_t SWOPrescaler = (120000000 / SWOSpeed) - 1; // SWOSpeed in Hz
- CoreDebug->DEMCR = 1<<CoreDebug_DEMCR_TRCENA_Pos;
- DBGMCU->CR = 0x00000027; //Enabling TRACE_IOEN, DBG_STANDBY, DBG_STOP, DBG_SLEEP
- //Set TPIU register->Selected pinprotocol = 10b: Serial Wire Output - NRZ
- *((volatile unsigned *) 0xE00400F0) = 0x00000002; // "Selected PIN Protocol Register": Select which protocol to use for trace output (2: SWO)
- //Set TPIU -> Async Clock Prescaler Register [bits 0-12]
- *((volatile unsigned *) 0xE0040010) = SWOPrescaler; // "Async Clock Prescaler Register". Scale the baud rate of the asynchronous output
- //Lock Access Register
- *((volatile unsigned *) 0xE0000FB0) = 0xC5ACCE55; // ITM Lock Access Register, C5ACCE55 enables more write access to Control Register 0xE00 :: 0xFFC
- *((volatile unsigned *) 0xE0000E80) = 0x0001000D; // ITM Trace Control Register
- *((volatile unsigned *) 0xE0000E40) = 0x0000000F; // ITM Trace Privilege Register
- *((volatile unsigned *) 0xE0000E00) = 0x00000001; // ITM Trace Enable Register. Enabled tracing on stimulus ports. One bit per stimulus port.
- *((volatile unsigned *) 0xE0001000) = 0x400003FE; // DWT_CTRL
- //And this is really tricky! No document for this register at ARM site.
- *((volatile unsigned *) 0xE0040304) = 0x00000100; // Formatter and Flush Control Register
- uint8_t buf[]="Some text to print out the console";
- while(buf!=0) {
- if (CoreDebug->DEMCR & CoreDebug_DEMCR_TRCENA_Msk) // Trace enabled
- {
- if (ITM->TCR & ITM_TCR_ITMENA_Msk) // ITM enabled
- {
- if (ITM->TER & (1ul << 0)) // ITM Port #0 enabled
- {
- while (ITM->PORT[0].u32 == 0) ;
- ITM->PORT[0].u8 = (uint8_t) *buf;
- }
- }
- }
- buf++;
- }
The messages/data are going out from CPU at baud speed 19200. When i start JLink.exe and type SWOStart, i can see in SWV control panel that data is arriving .
I need few things:
1.] How to enable SWV support on JLINK GDB server. By typing:
JLinkGDBServerCL.exe -SWOPort 4444
it opens the port 4444 but no messages are inside. Maybe missing protocol
2.] What kind of protocol i have to use to transfer data/messages between CPU a GDB elf console.
Somehow it must work becouse i can clearly see that GDB server sends some messages to client side console like:
Resetting target...and so on
3.] How can i change the baud rate from 19200 to something else?
Is there any documentation about that part? Because i cant find them in standart Docs, and in your market brosure you writing:
Serial Wire Debug (SWD) and Serial Wire Viewer (SWV) support
Thank you,
Regards
Ing.Tomas Kamenicky
Green CENTER s.r.o.