RED FDM 2016-05-31 Firmware Download and Debug User Manual Rev.1.0.2 2016-05-31
Contents 1 Revision History... 3 2 Firmware Development Process... 4 2.1 Development Tool (KEIL MDK-ARM)... 4 2.2 Firmware Programming... 4 2.3 Debugging... 5 2.4 Alternative solution... 5 3 Flash Download... 5 3.1 ULINK2... 5 3.2 CoLinkEx... 10 3.3 IAP UART... 19 4 Debugging... 20 4.1 Configuration for ULINK2... 20 4.2 Configuration for CoLinkEx... 21 4.3 Debugging... 21 5 Address Information... 23 2 of 23
1 Revision History Version Date Description 1.0.0 2015.03.05 Initial Release (based on PR9200 APU) 1.0.1 2015.06.08 Modified some image 1.0.2 2016.05.31 Modified section 3.3 IAP-UART 3 of 23
2 Firmware Development Process Firmware development Process is shown at Figure 1. The suitable tools and devices are required to each development state such as compile, download, debugging system. PLANNING COMPILE DOWNLOAD DEBUGGIN ULINK2/CoLinkEx ULINK2/CoLinkEx IAP(UART/SPI/I 2 C) ISP(UART/SPI) KEIL MDK-ARM Figure 1 firmware development process 2.1 Development Tool (KEIL MDK-ARM) The MDK-ARM is embedded development tool for Cortex-M microcontroller. MDK-ARM includes ARM C/C++ Compilation Tool chain, µvision4 IDE, debugger, and simulation environment. Phychips does not support KEIL MDK-ARM. For more details, please refer to http://www.keil.com 2.2 Firmware Programming PR9200 support two ways to firmware download. One is method using ULINK2 and CoLinkEx debug adapter through SWD (Serial Wire Debug). The other is method using IAP (In-Application Programming). IAP can use three type of interface, UART, SPI and I 2 C without any hardware debugger. with Hardware Flash Programming ULINK2 / CoLinkEx - Interface : SWD(Serial Wire Debug) without Hardware IAP - Interface : UART / SPI / I 2 C ISP - Interface : UART / SPI Figure 2 Methods to firmware programming 4 of 23
2.3 Debugging Firmware debugging uses ULINK2 and CoLinkEx. Using two debuggers with Keil µvision IDE can debug embedded application of PR9200 and trace firmware. Debugging Hardware Debugger Figure 3 ULINK2/CoLinkEx (with Keil MDK-ARM) - Interface : SWD(Serial Wire Debug) 2.4 Alternative solution PR9200 supports alternative solution besides ULINK2 or CoLinkEx + KEIL MDK-ARM. IDE Debugging Adopter Port Note KEIL MDK-ARM J-LINK SWD CooCox CoIDE CoLinkEx SWD Refer to related CooCox solution page, www.coocox.org. 3 Flash Download This section describe four method for flash download, ULINK2, CoLinkEx, ISP and IAP 3.1 ULINK2 ULINKS2 debug adapter connects your PC s USB port to SWD (Serial Wire Debug) of PR9200 and allows you to programming and debug embedded programs on PR9200. In order to download firmware, Keil µvision IDE is required. After connecting ULINK2 to PR9200, follow next step to success to flash download using ULINK2. USB SWD DK module KEIL MDK-ARM(in PC) Figure 4 3.1.1 Flash Download Configuration on KEIL µvision IDE 1. Select or Flash Configure Flash Tools... of pull-down menu. Figure 5 5 of 23
2. At Utilities tab, select command Use Target Device for Flash Programming and choose debugger ULINK Cortex Debugger. And open Cortex-M Target Driver setup to click settings Figure 6 3. Set Download Function as follow Figure 7 6 of 23
4. Click Add button and select PR9200_EFLASH_63KB.FLM. Figure 8 [NOTICE] First of all, copy PR9200_EFLASH_63KB.FLM to directory KEIL_INSTALL\ARM\FLASH. Flash algorithm file is included in [DK_DATA]\Firmware\Flash_algorithm/KEIL_MDK 5. Make sure that programming algorithm is added. Figure 9 6. At Debug tab, set driver setup as below Figure 10. 7 of 23
Figure 10 3.1.2 Flash Erase 1. Select Flash Erase at main windows. Figure 11 2. Check chip erase result at Build output window. Figure 12 3.1.3 Flash Download 1. Select or Flash Download to Flash Figure 13 2. Check download result from output window. 8 of 23
Figure 14 9 of 23
3.2 CoLinkEx CooCox CoLinkEx is a hardware debugging adapter which supports SW debugging and supports Cortex-M0 devices, it supports debugging in CooCox software and Keil Realview MDK. This debugger uses SWD (Serial Wire Debug) interface 3.2.1 Keil Realview MDK 3.2.1.1 Modify CoMDKPlugin(v1.4.1) Figure 15 CoLinkEx and connection CoMDKPlugin is a software that supports debugging ARM Cortex-M chips in Keil Realview MDK. First of all, install CoMDKPlugin.(Download: http://www.coocox.org/book/coocox/stop-maintananceproduct/mdkplugin/mdkplugin ) The device information provided by CoMDKPlugin is not compatible for PR9200. For loading flash erase/program algorithm for PR9200, modify the plugin file as following. [KEIL Home]\ARM\BIN\CooCox\devices\Cortex-M0.xml <?xml version="1.0" encoding="utf-8" standalone="no"?> <Device> <Name>Cortex-M0</Name> <Vendor>ARM</Vendor> <DebugSetting>$TOOLKIT_CONFIG_DIR$\debugger\cortex-m0.xml</DebugSetting> <Flash> <Block addr="0x00000000" execute="true" name="embedded Flash" read="true" size="0x10000" write="false"/> </Flash> <Ram> <Block addr="0x10004000" execute="true" name="embedded SRAM" read="true" size="0x00004000" write="true"/> </Ram> <FlashLoader> <loader select="true">$toolkit_flash_dir$\unspecified</loader> </FlashLoader> </Device> [notice] Before you use CooCox CoLinkEx, you need to update ColinkEx firmware and install CoLinkEx USB Deriver first. (Download: http://www.coocox.org/wiki/coocox/colinkex/colinkex-support#software ) 3.2.1.2 Flash Download Configuration on KEIL µvision IDE 1. Select or Flash Configure Flash Tools... of pull-down menu. 2. At Debug tab, select CooCox Debugger. Figure 16 10 of 23
3. At Utilities tab, select command Use Target Device for Flash Programming and choose debugger CooCox Debugger. And open Cortex-M Target Driver setup to click settings Figure 17 4. Set Download Function as follow 11 of 23
Figure 18 12 of 23
5. Click Add button and select PR9200_EFLASH_63KB.FLM. Figure 19 [NOTICE] First of all, copy PR9200_EFLASH_63KB.FLM to directory KEIL_INSTALL/ARM/FLASH. Flash algorithm file is included in [DK_DATA]\Firmware\Flash_algorithm/KEIL_MDK 6. Make sure that programming algorithm is added. Figure 20 7. At Debug tab, set driver setup as below Figure 10 13 of 23
3.2.1.3 Flash Erase Figure 21 1. Select Flash Erase at main windows. Figure 22 2. Check chip erase result at Build output window. Figure 23 3.2.1.4 Flash Download 1. Select or Flash Download to Flash Figure 24 2. Check download result from output window. 14 of 23
Figure 25 3.2.2 CoFlash CooCox CoFlash is a stand-alone Cortex MCU Flash Programming software for PCs. First of all, install CoFlash.(Download: http://www.coocox.org/software.html ). Then copy the PR9200.xml file to [COFLASH_INSTALL]\config\devices\Phychips\ (PR9200.xml file location : [DK_DATA]\Firmware\Device_configuration\PR9200.xml) 3.2.2.1 Flash Download Configuration on CoFlash 1. At Config tab, set Device and USB Adapter Setup as below Figure 26 Figure 26 2. Click Add button and select PR9200_EFLASH_63KB.FLM. 15 of 23
Figure 27 [NOTICE] First of all, copy PR9200_EFLASH_63KB.elf to directory COFLASH_INSTALL\flash. Flash algorithm file is included in [DK_DATA]\Firmware\Flash_algorithm/CoIDE 3. Make sure that programming algorithm is added. Figure 28 3.2.2.2 Flash Erase 1. Select Erase in Operate 16 of 23
3.2.2.3 Flash Download 1. Select firmware binary file (*.bin) 2. Select Program in Operate 17 of 23
18 of 23
3.3 IAP UART PR9200DK support IAP (In-application Programming) using UART. UART IAP help user download flash program without any extra hardware like ULINK2. UART IAP is similar to ISP, but help user download flash program without any extra hardware like ULINK2 and mode transition. User does not need any configuration for IAP. [notice] PR9200DK s GUI does not support SPI IAP. If you want IAP using SPI, refer to Protocol manual of DK. 3.3.1 UART Download Connect PC s USB to PR9200DK and execute RED utility. Open download window and select firmware binary file (*.hex) you want. Click update button and flash downloading is executed. Figure 29 After download is completed, reset PR9200 or module. [Notice] If the firmware is abnormally deleted, IAP download do not work properly. In this case, ISP mode can help you download as well as SWD. In order to enter this mode, set PR9200 pin as below table ISP_MODEb P17 P16 P15 Low Low Low Low Table Restart or reset PR9200 after this set is changed. And execute download as IAP download After download is completed, change ISP mode to normal mode as set ISP_MODEb to high. Don t forget resetting PR9200. When PR9200 operation mode is changed Normal mode to ISP mode, user must reset the chip and vice versa. 19 of 23
4 Debugging This chapter describes how to debug PR9200 firmware with ULINK2 and CoLinkEx. 4.1 Configuration for ULINK2 1. Select or Flash Configure Flash Tools at Keil µvision IDE main window 2. Select debugger to ULINK Cortex Debugger. 3. Click Settings button and setup ULINK USB-JTAG/SW Adapter as shown figure. 20 of 23
4.2 Configuration for CoLinkEx 1. Select or Flash Configure Flash Tools at Keil µvision IDE main window 2. Select debugger to CooCox Debugger. 3. Click Settings button and setup USB Adapter as shown figure. 4.3 Debugging 1. Click or Debug Start/Stop Debug Session to start debug. 21 of 23
Figure 30 2. When user want to stop debugging, click Debug Start/Stop Debug Session again. 22 of 23
5 Address Information PHYCHIPS Inc. #104, 187 Techno 2-ro, Yuseong-gu, Daejeon, Korea (Yongsan-dong, Migun Technoworld 2) http://www.phychips.com sales@phychips.com +82-42-864-2402 +82-42-864-2403 Disclaimer: PHYCHIPS reserves the right to make changes to the information in this document without prior notice. The purchase of PHYCHIPS products does not convey any license under patent rights owned by PHYCHIPS or others. PHYCHIPS does not assume any responsibility for the use of this product. It is the customer s responsibility to make sure that the system complies with regulations. 2016 PHYCHIPS, Inc. All rights reserved. The reproduction of this document is NOT allowed without approval of PHYCHIPS Inc. 23 of 23