Page 1
AT32 Printf Debug Demo AN0015 Application Note AT32 Printf Debug Demo Introduction It is common for the user to check the debug process information in the process of application code debug. In most cases, this action can be done through the serial port debugging assistant.
AT32 Printf Debug Demo Overview This application note describes how to use the printf function of AT chips in the environment of Keil and IAR. There are five methods to be listed in the table below, with each of them being detailed in this document.
AT32 Printf Debug Demo Detailed information Printf via Terminal I/O in IAR 2.1.1 Introduction The IAR driver linked to the Terminal contains standard input and output driver functions such as scanf and printf so that the information interaction of the project files can be done via the Terminal I/O.
AT32 Printf Debug Demo Redirect Printf as serial ports in IAR 2.2.1 Introduction Redirect the Printf function to a set of actual serial ports in the chip, and output via TX pin and finally implement information interaction through the serial port debugging assistant.
AT32 Printf Debug Demo 2.2.4 Software 2.2.4.1 Header files Add the “stdio.h” to the code project files. 2.2.4.2 Redirection settings Initialize the serial ports and redirect the Printf function to the actual serial ports. The redirection function is as follows: PUTCHAR_PROTOTYPE USART_SendData(AT32_PRINT_UART, ch);...
AT32 Printf Debug Demo Printf via Debug (printf) Viewer in Keil 2.3.1 Introduction The Keil platform comes with a Debug (printf) Viewer that can be used for standard Printf interaction on the premise that the ARM core integrates standard input and output driver functions such as scanf and printf.
AT32 Printf Debug Demo 2.3.4.3 Printf mapping int fputc(int c, FILE *f) if (c == '\n') SER_PutChar('\r'); return (SER_PutChar(c)); int 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...
AT32 Printf Debug Demo Redirect Printf as serial ports in Keil (using MicroLIB) 2.4.1 Introduction The Keil environment comes with a MicroLIB that contains some codes supporting Printf function. Tick the MicroLIB option to implement information interaction through the serial port debugging assistant when the Printf is redirected to the serial ports.
AT32 Printf Debug Demo Redirect Printf as serial ports in Keil (not use MicroLIB) 2.5.1 Introduction The Keil environment has a MicroLIB that contains some codes supporting Printf function. When the Printf is redirected to the serial ports and the MicroLIB option box is not ticked, the information interaction can be done through the serial port debugging assistant after adding the codes that supports Printf to the engineering project files.
AT32 Printf Debug Demo 2.5.4.4 Printf function supports code addition #pragma 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”...
AT32 Printf Debug Demo Printf via JLinkRTT 2.6.1 Introduction JLink has its own debug output function that can debug the code and output to the corresponding window according to the specified instructions after the JLink RTT library code is added.
AT32 Printf Debug Demo 2.6.4.3 Output to PC Then, call either SEGGER_RTT_WriteString or SEGGER_RTT_printf command from the code and output to PC. SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal 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.
AT32 Printf Debug Demo 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 2019.08.05 Rev 1.0.2...
AT32 Printf Debug Demo 2. Click on OK,then click on OK again in the pop-up window, and input and 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.
AT32 Printf Debug Demo Notes Only J-Link can be used for the testing in the section 2.3 and 2.6, and AT-Link is not supported; For the testing in the section 2.1 and section 2.2, if the AT-Link is used, in the Options-- >CMSIS DAP-->Reset, either Hardware or System must be selected, otherwise it will not be...
AT32 Printf Debug Demo Revision history Document revision history Table 11. Date Revisio 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. 2019.08.05 Rev 1.0.2 www.arterytek.com...
Page 26
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 customer or end user for use as critical components in (a) any medical, life saving or life support device...
Need help?
Do you have a question about the AT32 and is the answer not in the manual?
Questions and answers