AT32 Printf Debug Demo
2019.08.05
13
Rev 1.0.2
www.arterytek.com
Figure 5. Keil virtual terminal interaction window
Страница 1: ...l port debugging assistant However it would be a headache for users to try to observe the testing process information when the serial port assistant is not supported by the hardware To address the above concerns this application note provides a complete set of example codes describing how to output the debug process information especially when the serial port debugging assistant is not available A...
Страница 2: ...nd hardware 9 2 2 4 Software 10 2 2 5 Debug and download 10 2 3 Printf via Debug printf Viewer in Keil 11 2 3 1 Introduction 11 2 3 2 Example code 11 2 3 3 Environment and hardware 11 2 3 4 Software 11 2 3 5 Debug and download 12 2 4 Redirect Printf as serial ports in Keil using MicroLIB 14 2 4 1 Introduction 14 2 4 2 Example code 14 2 4 3 Environment and hardware 14 2 4 4 Software 15 2 4 5 Debug ...
Страница 3: ...ev 1 0 2 www arterytek com 2 5 5 Debug and download 19 2 6 Printf via JLinkRTT 20 2 6 1 Introduction 20 2 6 2 Example code 20 2 6 3 Environment and hardware 20 2 6 4 Software 20 2 6 5 Debug and download 21 3 Notes 24 4 Revision history 25 ...
Страница 4: ...onnection table without JTDO 9 Table 4 Hardware connection table USART 9 Table 5 Hardware connection table with JTDO 11 Table 6 Hardware connection table without JTDO 14 Table 7 Hardware connection table USART 14 Table 8 Hardware connection table without JTDO 17 Table 9 Hardware connection table USART 17 Table 10 Hardware connection table without JTDO 20 Table 11 Document revision history 25 ...
Страница 5: ...virtual terminal window path 12 Figure 5 Keil virtual terminal interaction window 13 Figure 6 MicroLIB settings 15 Figure 7 Serial port interaction window 16 Figure 8 MicroLIB settings 18 Figure 9 Serial port interaction window 19 Figure 10 Code debug 21 Figure 11 JLinkRTTClient window output information 22 Figure 12 JLinkRTTViewer window 22 Figure 13 Device selection window 23 Figure 14 JLinkRTTV...
Страница 6: ...led in this document Table 1 AT MCUs printf function use methods AT MCUs printf function use methods No Environment Description Remark Method 1 IAR Printf via Terminal I O See 3 1 Method 2 Redirect Printf as serial ports See 3 2 Method 3 Keil Printf via Debug printf Viewer See 3 3 Method 4 Redirect Printf as serial ports using MicroLIB See 3 4 Method 5 Redirect Printf as serial ports not use Micro...
Страница 7: ...1 2 2 1 3 2 Hardware connection J Link AT Link connection Table 2 Hardware connection table without JTDO Hardware connection table without JTDO No AT START F403_V1 2 J Link AT Link Attention 1 3 3V 3 3V None 2 PA13 SWDIO Must Pull up external 3 PA14 SWCLK Must Pull down external 4 NRST RSTn None 5 GND GND None 2 1 4 Software 2 1 4 1 Header file Add the stdio h to the code project files 2 1 4 2 Red...
Страница 8: ...AT32 Printf Debug Demo 2019 08 05 8 Rev 1 0 2 www arterytek com window Figure 1 Virtual terminal window path Figure 2 Virtual terminal interaction window ...
Страница 9: ...environment The compiling environment used in the example code is IAR_V6 7 8 with the hardware board AT START F403_V1 2 2 2 3 2 Hardware connection 2 2 3 2 1 J Link AT Link connection J Link AT Link connection Table 3 Hardware connection table without JTDO Hardware connection table without JTDO No AT START F403_V1 2 J Link AT Link Attention 1 3 3V 3 3V None 2 PA13 SWDIO Must Pull up external 3 PA1...
Страница 10: ...on to the actual serial ports The redirection function is as follows PUTCHAR_PROTOTYPE USART_SendData AT32_PRINT_UART ch while USART_GetFlagStatus AT32_PRINT_UART USART_FLAG_TRAC RESET return ch 2 2 5 Debug and download Compile the code and download it to the MCU and run it at full speed then you can see that the Hello World is displayed in the terminal interaction window Figure 3 Figure 3 Serial ...
Страница 11: ...vironment This method is used in the Keil environment The compiling environment supported by the example is Keil_V4 Keil_V5 with the hardware board AT START F403_V1 2 2 3 3 2 Hardware connection J Link AT Link connection Table 5 Hardware connection table with JTDO Hardware connection table with JTDO No AT START F403_V1 2 J Link AT Link Attention 1 3 3V 3 3V None 2 PA13 SWDIO Must Pull up external ...
Страница 12: ...SER_PutChar int c ITM_SendChar c return c 2 3 5 Debug and download Compile the code and downloaded it to the MCU and enter debug environment to call up the virtual terminal window through View Serial Windows Debug printf Viewer then run the code and Hello World is visible in the terminal interaction window Figure 5 Figure 4 Keil virtual terminal window path ...
Страница 13: ...AT32 Printf Debug Demo 2019 08 05 13 Rev 1 0 2 www arterytek com Figure 5 Keil virtual terminal interaction window ...
Страница 14: ... 1 Development environment This method is used in the Keil environment The compiling environment used in the example code is Keil_V4 Keil_V5 with the hardware board AT START F403_V1 2 2 4 3 2 Hardware connection 2 4 3 2 1 J Link AT Link connection Table 6 Hardware connection table without JTDO Hardware connection table without JTDO No AT START F403_V1 2 J Link AT Link Attention 1 3 3V 3 3V None 2 ...
Страница 15: ...f PUTCHAR_PROTOTYPE USART_SendData AT32_PRINT_UART ch while USART_GetFlagStatus AT32_PRINT_UART USART_FLAG_TRAC RESET return ch 2 4 4 3 MicroLIB settings Figure 6 MicroLIB settings 2 4 5 Debug and download Compile the code and download it into the MCU and run the code at full speed to see that the Hello World is displayed in the terminal interaction window Figure 7 ...
Страница 16: ...AT32 Printf Debug Demo 2019 08 05 16 Rev 1 0 2 www arterytek com Figure 7 Serial port interaction window ...
Страница 17: ...croLIB Project 2 5 3 Environment and hardware 2 5 3 1 Development environment This method is used in the Keil environment The compiling environment used in the example code is Keil_V4 Keil_V5 with the hardware board AT START F403_V1 2 2 5 3 2 Hardware connection 2 5 3 2 1 J Link AT Link connection Table 8 Hardware connection table without JTDO Hardware connection table without JTDO No AT START F40...
Страница 18: ...oftware 2 5 4 1 Header files Add the stdio h to the code project files 2 5 4 2 Redirect Printf PUTCHAR_PROTOTYPE USART_SendData AT32_PRINT_UART ch while USART_GetFlagStatus AT32_PRINT_UART USART_FLAG_TRAC RESET return ch 2 5 4 3 MicroLIB settings Figure 8 MicroLIB settings ...
Страница 19: ... import __use_no_semihosting struct __FILE int handle FILE __stdout _sys_exit int x x x 2 5 5 Debug and download Compile the code and download it into the MCU and run the code at full speed you can find that the Hello World is displayed in the terminal interaction window Figure 9 Figure 9 Serial port interaction window ...
Страница 20: ...e code is IAR_V6 7 8 and Keil_V4 Keil_V5 with the hardware board used AT START F403_V1 2 2 6 3 2 Hardware connection J Link connection Table 10 Hardware connection table without JTDO Hardware connection table without JTDO No AT START F403_V1 2 J Link Attention 1 3 3V 3 3V None 2 PA13 SWDIO Must Pull up external 3 PA14 SWCLK Must Pull down external 4 NRST RSTn None 5 GND GND None 2 6 4 Software 2 6...
Страница 21: ...nal Sample r n r n SEGGER_RTT_printf 0 printf Test c S c r n S 2 6 5 Debug and download 2 6 5 1 Printf via JLinkRTTClient window Compile the code and download it into the MCU and enter the debug environment open the JLinkRTTClient application in the JLink installation path Then run the code step by step you can find the print information is output to the JLinkRTTClient window as shown in Figure 10...
Страница 22: ...www arterytek com Figure 11 JLinkRTTClient window output information 2 6 5 2 Printf via JLinkRTTViewer window 1 Compile the code and download it to the MCU and open the JLinkRTTViewer window as presented in Figure 12 Figure 12 JLinkRTTViewer window ...
Страница 23: ... select the following information and then click on OK as shown in Figure 13 Figure 13 Device selection window 3 Take the aforementioned code to enter the debug environment and run it step by step the print information will be displayed in the JLinkRTTViewer window as shown in Figure 14 Figure 14 JLinkRTTViewer window output information ...
Страница 24: ...t and download the code For the testing in the section 2 2 in the Options General Options Library Configuration Library either Full or Normal must be selected otherwise it cannot be output Only when the Full or Normal is selected can the codes that support the Printf be available For the testing in the section 2 6 5 1 the program in the output window cannot designate the device temporarily so the ...
Страница 25: ...25 Rev 1 0 2 www arterytek com 4 Revision history Table 11 Document revision history Date Revisio n Changes 2019 01 07 1 0 0 Initial release 2019 07 29 1 0 1 Changed the IAR version 2019 08 05 1 0 2 Added the JLinkRTTClient description ...
Страница 26: ... otherwise a license to use third party s products and services or b licensing the third parties intellectual property rights or c warranting the third party s products and services and its intellectual property rights Purchasers hereby agrees that Artery s products are not authorized for use as and purchasers shall not integrate promote sell or otherwise transfer any Artery s product to any custo...