{"id":355,"date":"2015-03-15T00:08:23","date_gmt":"2015-03-14T23:08:23","guid":{"rendered":"http:\/\/www.sevenwatt.com\/main\/?page_id=355"},"modified":"2016-01-10T14:13:08","modified_gmt":"2016-01-10T13:13:08","slug":"picos-arm-hw-debugger-in-eclipse-cdt","status":"publish","type":"page","link":"https:\/\/www.sevenwatt.com\/main\/picos-arm\/picos-arm-hw-debugger-in-eclipse-cdt\/","title":{"rendered":"Picos ARM &#8211; HW Debugger in Eclipse CDT"},"content":{"rendered":"<h3>Step by step guide<\/h3>\n<p>This guide describes the setup of a Eclipse \/ LPC8xx HW debugging environment in\u00a0<em><strong>Windows<\/strong><\/em>.<\/p>\n<p>ARM chips like the STM32 and the LPC8xx series as used in the PicosARM and jeelabs.org projects provide hardware debug facilities. For instance, the LPC810 has some pins providing On-Chip Debugging (OCD). Two of those pins provide the Serial Wire Debug interface, the SWD. There is a slight drawback. To use this it requires an additional hardware adapter to interface between a USB-port of your computer and the ARM-chip.\u00a0Several JTAG debuggers are around. ARM-chip makers usually provide demo-boards and some of them implement a variant of a JTAG\/SWD debugger.<\/p>\n<h5>LPC-Link<\/h5>\n<p>NXP provides LPCXpresso boards. Around EUR 16 for a LPC812 board. From reading the LPC forum and further searching the internet I get the impression that Eclipse\/OpenOCD support is substandard. and that it might only properly work with NXP&#8217;s own version of the Eclipse IDE: LPCXPresso.<\/p>\n<h5>STLink \/ ST Discovery \/ ST Nucleo boards<\/h5>\n<p>ST provides very inexpensive demo boards. Just above EUR 10. Currently the Nucleo STM32 boards. Those boards have the STLink-V2-1 SWD interface that can be used for external SWD programmable devices as well. Linux and OpenOCD support is good. Despite being designed by the supplier of the STM32 chips, it also works with NCP LPC chips! The STLink-V2-1 part of the Nucleo board is what I use in the following text.<\/p>\n<h5>Basic steps for setup<\/h5>\n<ul>\n<li>Install OpenOCD<\/li>\n<li>Configure OpenOCD for the Nucleo\/LPC8xx combination<\/li>\n<li>Install STLink-V2-1 USB drivers<\/li>\n<li>Create OpenOCD External Tool in Eclipse CDT<\/li>\n<li>Create Debug configuration with GNU debugger in Eclipse CDT<\/li>\n<li>Connect the target to the STLink device<\/li>\n<li>Build a project and start stepping through the code.<\/li>\n<\/ul>\n<h3>\u00a0Install OpenOCD<\/h3>\n<p>OpenOCD is a server that connects to the target (the LPC8xx to be debugged or programmed) and that handles debugger commands. The current release is version 0.8.0. Download a executable (binary) version from <a href=\"http:\/\/www.freddiechopin.info\/en\/download\/category\/4-openocd\" target=\"_blank\">Freddie Chopin&#8217;s site<\/a>.<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDDownload.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-387\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDDownload.png\" alt=\"OpenOCDDownload\" width=\"881\" height=\"571\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDDownload.png 881w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDDownload-300x194.png 300w\" sizes=\"auto, (max-width: 881px) 100vw, 881px\" \/><\/a><\/p>\n<p>In File explorer, create or go to the PicosARM root folder. When you followed this PicosARM guide, it is located in <code>C:\\PicosARM<\/code>. Unzip the openOCD download in the tools folder. A folder containing OpenOCD will be created in tools: <code>C:\\PicosARM\\openOCD0.8.0<\/code>.<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDInstall1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-363\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDInstall1.png\" alt=\"OpenOCDInstall1\" width=\"809\" height=\"243\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDInstall1.png 809w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDInstall1-300x90.png 300w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/a>To avoid some future maintenance, rename this folder to <code>openOCD<\/code>, without the version number in it.<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDInstall2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-364\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDInstall2.png\" alt=\"OpenOCDInstall2\" width=\"809\" height=\"243\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDInstall2.png 809w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDInstall2-300x90.png 300w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/a><\/p>\n<blockquote><p>Note: Winzip may refuse to unpack. In this case download and use 7-zip to unzip<\/p><\/blockquote>\n<h3>Configure OpenOCD<\/h3>\n<p>OpenOCD requires some additional configuration for the specific hardware we are using as HW debugger (Nucleo STM32)\u00a0and Micrcontroller target (LPC8xx). OpenOCD 0.9.0 is providing more extensive support for the LPC8xx series. It requires a slightly different configuration then OpenOCD 0.8.0. Here we proceed with the OpenOCD 0.8.0 configuration, but 0.9.0 cfg files are also available for download.<\/p>\n<p>Download the Nucleo\/LPC8xx\u00a0cfg files from the PicosARM github repository. For OpenOCD-0.8.0, this is the <a href=\"https:\/\/github.com\/SevenW\/PicosARM\/blob\/master\/openocd-config\/picosARMOpenOCD-0.8.0.zip\" target=\"_blank\">LPC8xx-Nucleo link<\/a>.<\/p>\n<p>In the just installed OpenOCD, browse to the openocd\/scripts folder and unzip\u00a0the .cfg files to\u00a0this location.<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDConfig2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-367\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDConfig2.png\" alt=\"OpenOCDConfig2\" width=\"698\" height=\"474\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDConfig2.png 698w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDConfig2-300x204.png 300w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/a><\/p>\n<p>Make sure that within the script folder an picosARM folder is created:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDConfig3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-368\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDConfig3.png\" alt=\"OpenOCDConfig3\" width=\"809\" height=\"508\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDConfig3.png 809w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/OpenOCDConfig3-300x188.png 300w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/a><\/p>\n<h3>Install STLink-V2-1 USB drivers<\/h3>\n<p>This step is specific for the exact JTAG\/SWD debugger that will be used. In this guide it is the STLink-V2-1 interface of a Nucleo STM32 board. It does not matter which of the Nucleo boards is used. All are equipped with the same STLink device. If you already have connected a Nucleo to your PC before, then you probably already performed this step.<\/p>\n<p>Download the drivers form the <a href=\"http:\/\/www.st.com\/web\/catalog\/tools\/FM147\/SC1887\/PF260218\" target=\"_blank\">ST-website<\/a>.<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/STLinkDriver.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-390\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/STLinkDriver.png\" alt=\"STLinkDriver\" width=\"854\" height=\"795\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/STLinkDriver.png 854w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/STLinkDriver-300x279.png 300w\" sizes=\"auto, (max-width: 854px) 100vw, 854px\" \/><\/a><\/p>\n<p>Unzip the downloaded file and run <code>stlink_winusb_install.bat<\/code> to install the USB drivers<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/STLinkDriver2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-393\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/STLinkDriver2.png\" alt=\"STLinkDriver2\" width=\"667\" height=\"432\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/STLinkDriver2.png 667w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/STLinkDriver2-300x194.png 300w\" sizes=\"auto, (max-width: 667px) 100vw, 667px\" \/><\/a><\/p>\n<p>Now connect the Nucleo to your computer and see whether windows properly recognizes the Nucleo board.<\/p>\n<h3>Create Eclipse CDT External Tool<\/h3>\n<p>Start Eclipse and go to the HelloLPC or Blink project. This guide uses a Blink project as example.\u00a0The second row of the screen is the toolbar. Just below the main menu. On this menu is the External Programs tool, which we can use to launch OpenOCD. To setup OpenOCD as External Program open the External Tool Configuration screen:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-372\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig0.png\" alt=\"EclipseOpenOCDConfig0\" width=\"931\" height=\"268\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig0.png 931w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig0-300x86.png 300w\" sizes=\"auto, (max-width: 931px) 100vw, 931px\" \/><\/a><\/p>\n<p>The editor is opened. Press the Create new button and fill the fileds in the main tab.<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-370\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig1.png\" alt=\"EclipseOpenOCDConfig1\" width=\"885\" height=\"646\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig1.png 885w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig1-300x219.png 300w\" sizes=\"auto, (max-width: 885px) 100vw, 885px\" \/><\/a><\/p>\n<p>Set field Name to <code>LPC810 - Nucleo<\/code><br \/>\nSet field Location to <code>C:\\PicosARM\\openocd\\bin\\openocd.exe<\/code><br \/>\nSet filed Argumets to\u00a0<code>-c \"telnet_port 4444\" -f \"picosARM\\lpc810-nucleo.cfg\"<\/code><br \/>\nAll other settings can remain unchanged.<\/p>\n<p>On the &#8220;Common&#8221; Tab, check the &#8220;Exteral Tools&#8221; as display favorite:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-371\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig2.png\" alt=\"EclipseOpenOCDConfig2\" width=\"885\" height=\"646\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig2.png 885w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDConfig2-300x219.png 300w\" sizes=\"auto, (max-width: 885px) 100vw, 885px\" \/><\/a><\/p>\n<p>The External tool is configured now.<\/p>\n<blockquote><p>This example uses a LPC810. For other LPC8xx boards, just replace all LPC810 by the proper LPC number on the &#8220;Main&#8221; Tab, for example to \u00a0LPC824.<\/p><\/blockquote>\n<h3>Create Debug configuration in Eclipse<\/h3>\n<p>Make sure the project is already build. The following step requires a firmware image to be available. Open the Debug Configuration Editor through the toolbar:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-373\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig0.png\" alt=\"EclipseDebugConfig0\" width=\"937\" height=\"287\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig0.png 937w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig0-300x92.png 300w\" sizes=\"auto, (max-width: 937px) 100vw, 937px\" \/><\/a><\/p>\n<p>Select &#8220;Debug Configurations&#8230;&#8221;<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-374\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig1.png\" alt=\"EclipseDebugConfig1\" width=\"1036\" height=\"308\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig1.png 1036w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig1-300x89.png 300w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig1-1024x304.png 1024w\" sizes=\"auto, (max-width: 1036px) 100vw, 1036px\" \/><\/a><\/p>\n<p>On this screen Select &#8220;GDB Hardware Debugging&#8221; and press the &#8220;New&#8221; button:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-375\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig2.png\" alt=\"EclipseDebugConfig2\" width=\"896\" height=\"640\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig2.png 896w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig2-300x214.png 300w\" sizes=\"auto, (max-width: 896px) 100vw, 896px\" \/><\/a><\/p>\n<p>On \u00a0the &#8220;Main&#8221; Tab enter:<br \/>\nC\/C++ Application:\u00a0<code>C:\\workspace\\Blink\\build\\firmware.elf<br \/>\n<\/code>Select &#8220;Enable auto build&#8221;<br \/>\nLeave all other fields unchanged.<\/p>\n<p>Go to the Tab &#8220;Debugger&#8221;:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-376\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig3.png\" alt=\"EclipseDebugConfig3\" width=\"896\" height=\"640\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig3.png 896w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig3-300x214.png 300w\" sizes=\"auto, (max-width: 896px) 100vw, 896px\" \/><\/a><\/p>\n<p>Enter the following, and leave other fields unchanged:<br \/>\nGDB Command: <code>arm-none-eabi-gdb<\/code><br \/>\nPort Number: <code>3333<\/code><\/p>\n<p>Go to the &#8220;Startup&#8221; Tab:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-377\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig4.png\" alt=\"EclipseDebugConfig4\" width=\"896\" height=\"654\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig4.png 896w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig4-300x219.png 300w\" sizes=\"auto, (max-width: 896px) 100vw, 896px\" \/><\/a><\/p>\n<p>Make sure to scroll to the bottom of the entry form: Enter:<br \/>\nRun Commands: <code>mon reset init<\/code><\/p>\n<p>Go to the &#8220;Common&#8221; Tab<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-378\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig5.png\" alt=\"EclipseDebugConfig5\" width=\"896\" height=\"640\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig5.png 896w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugConfig5-300x214.png 300w\" sizes=\"auto, (max-width: 896px) 100vw, 896px\" \/><\/a><\/p>\n<p>Check &#8220;Debug&#8221; as display favorite, and press &#8220;Apply&#8221;, press &#8220;Close&#8221; to exit the editor. Eclipse is now prepared for debugging!<\/p>\n<h3>Connect the target LPC8xx<\/h3>\n<p>Plugin the USB cable of the Nucleo STLinkV2-1 interface into the computer. How to connect the LPC8xx to the Nucleo boards SWD interface is described in\u00a0article\u00a0<a title=\"Picos ARM \u2013 LPC810 SWD \/ JTAG with Nucleo STM32\" href=\"\/\/www.sevenwatt.com\/main\/picos-arm\/picos-arm-lpc810-swd-jtag-with-nucleo-stm32\/\" target=\"_blank\"><em>LPC810 SWD \/ JTAG with Nucleo STM32<\/em><\/a><\/p>\n<h3>Download firmware and start flashing.<\/h3>\n<p>The following describes typical steps in a build\/download\/debug session. Build the project by pressing the hammer-tool (Build).<\/p>\n<p>Start the External Program &#8220;LPC810 &#8211; Nucleo&#8221;:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-379\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun1.png\" alt=\"EclipseDebugRun1\" width=\"933\" height=\"701\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun1.png 933w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun1-300x225.png 300w\" sizes=\"auto, (max-width: 933px) 100vw, 933px\" \/><\/a><br \/>\nWhen the HW (both Nucleo and LPC810) is connected correctly, the concole panel will report the STLink interface and the LPC810 target. When the last line reads <code>Info: lpc810.cpu: hardware has 4 breakpoints, 2 watchpoints<\/code>, everything is OK.<\/p>\n<p>When activating the External Program, two things may happen. Eclipse may suggest to switch to a debug perspective, and the Windows Firewall may ask for permision for OpenOCD using a port. Confirm (Yes\/Allow Access) these situations:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun21.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-391\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun21.png\" alt=\"EclipseDebugRun2\" width=\"531\" height=\"245\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun21.png 531w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun21-300x138.png 300w\" sizes=\"auto, (max-width: 531px) 100vw, 531px\" \/><\/a><\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDFirewall.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-369\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDFirewall.png\" alt=\"EclipseOpenOCDFirewall\" width=\"541\" height=\"351\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDFirewall.png 541w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseOpenOCDFirewall-300x195.png 300w\" sizes=\"auto, (max-width: 541px) 100vw, 541px\" \/><\/a><\/p>\n<p>Then download\/flash and run the application in Debug mode, through the toolbar:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-381\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun3.png\" alt=\"EclipseDebugRun3\" width=\"937\" height=\"698\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun3.png 937w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun3-300x223.png 300w\" sizes=\"auto, (max-width: 937px) 100vw, 937px\" \/><\/a><\/p>\n<p>Select &#8220;Blink Default&#8221;. This rebuilds the project if needed, downloads it to the target LPC, and automatically breaks at the first instruction of the program:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-382\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun4.png\" alt=\"EclipseDebugRun4\" width=\"938\" height=\"699\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun4.png 938w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun4-300x224.png 300w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/a><\/p>\n<p>Before pressing the the run\/play button, for demonstration purposes set a breakpoint in the main program source code Blink.c, at the instruction that toggles the LED, line 46. To set the breakpoint double click the line number. Now press &#8220;Play&#8221;. After a moment, the program stops at the breakpoint:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-383\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun5.png\" alt=\"EclipseDebugRun5\" width=\"938\" height=\"699\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun5.png 938w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun5-300x224.png 300w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/a><\/p>\n<p>It can now be seen that the program is suspended, and that the loop counter is set to &#8220;1&#8221; in the Variables panel. Press &#8220;Play&#8221; again. The program breaks again, and the loop counter is now updated to &#8220;2&#8221;:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-384\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun6.png\" alt=\"EclipseDebugRun6\" width=\"938\" height=\"699\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun6.png 938w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun6-300x224.png 300w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/a><\/p>\n<p>Now double click the breakpoint at line 46 again to remove it, and press &#8220;Play&#8221;. Now the program starts running uninterrupted. The LED should be blinking. Now press the pause button, and there is a good change the program breaks at the waiting loop in the delay() function:<\/p>\n<p><a href=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-385\" src=\"\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun7.png\" alt=\"EclipseDebugRun7\" width=\"938\" height=\"699\" srcset=\"https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun7.png 938w, https:\/\/www.sevenwatt.com\/main\/wp-content\/uploads\/2015\/03\/EclipseDebugRun7-300x224.png 300w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/a><\/p>\n<p>This form of debugging the code by actually tracing the execution is a very valuable tool for embedded applications. With this and the previous guide, Eclipse is configured for developement of LPC8xx applications.<\/p>\n<blockquote><p>Due to a coding error in OpenOCD there is a chance that the download fails with an error code 9 in the console of the External Tool. This is related to the size of the firmware to be flashed. A workaround is to increase the flash image by about 256 bytes. An example will be added in a separate post.<\/p><\/blockquote>\n<h3>References<\/h3>\n<ol>\n<li><a href=\"http:\/\/hertaville.com\/2012\/09\/16\/part-3-debugging-openocd-0-6-0\/\">Setting up Debugging with the Eclipse IDE (OpenOCD 0.6.x)<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Step by step guide This guide describes the setup of a Eclipse \/ LPC8xx HW debugging environment in\u00a0Windows. ARM chips like the STM32 and the LPC8xx series as used in the PicosARM and jeelabs.org projects provide hardware debug facilities. For instance, the LPC810 has some pins providing On-Chip Debugging (OCD). Two of those pins provide [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":186,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-355","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.sevenwatt.com\/main\/wp-json\/wp\/v2\/pages\/355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sevenwatt.com\/main\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.sevenwatt.com\/main\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.sevenwatt.com\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sevenwatt.com\/main\/wp-json\/wp\/v2\/comments?post=355"}],"version-history":[{"count":22,"href":"https:\/\/www.sevenwatt.com\/main\/wp-json\/wp\/v2\/pages\/355\/revisions"}],"predecessor-version":[{"id":582,"href":"https:\/\/www.sevenwatt.com\/main\/wp-json\/wp\/v2\/pages\/355\/revisions\/582"}],"up":[{"embeddable":true,"href":"https:\/\/www.sevenwatt.com\/main\/wp-json\/wp\/v2\/pages\/186"}],"wp:attachment":[{"href":"https:\/\/www.sevenwatt.com\/main\/wp-json\/wp\/v2\/media?parent=355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}