{"id":6129,"date":"2020-06-16T08:24:29","date_gmt":"2020-06-16T15:24:29","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=6129"},"modified":"2020-06-16T08:24:29","modified_gmt":"2020-06-16T15:24:29","slug":"debugging-multi-core-nxp-devices-with-lpc-link-and-visualgdb","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/arm\/nxp\/multicore\/","title":{"rendered":"Debugging Multi-Core NXP Devices with LPC-Link and VisualGDB"},"content":{"rendered":"<p>This tutorial shows how to debug multi-core NXP devices, such as LPC55S69, using VisualGDB and the LPC-Link debug tools. Before you begin, make sure you can successfully build and debug a basic single-core project for the same device by following our <a href=\"https:\/\/visualgdb.com\/tutorials\/arm\/nxp\/mcuxpresso\">MCUXpresso tutorial<\/a>.<\/p>\n<ol>\n<li>In this tutorial, we will create a separate project for each core and will use 2 instances of Visual Studio to debug it. Start the first instance of Visual Studio and launch the VisualGDB Embedded Project Wizard. Pick the name and location for the first project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/01-prj0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6130\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/01-prj0.png\" alt=\"\" width=\"966\" height=\"624\" \/><\/a><\/li>\n<li>Proceed with the default settings on the first page of the Embedded Project Wizard:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/03-msb-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6112\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/03-msb-1.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>Locate your device on the <strong>Device Selection<\/strong> page. Each core will be represented by a separate device entry. Select the <strong>CORE0<\/strong> entry and click &#8220;Next&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/02-core0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6131\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/02-core0.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>On the next page, locate one of the multi-core examples. In this example, we will use the <strong>hello_world_cm33_core0<\/strong> example:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/03-hello.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6132\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/03-hello.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>Make sure the <strong>Debug Method<\/strong> page has the <strong>core #0<\/strong> selected, then press &#8220;Finish&#8221; to generate a project: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/04-debug0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6133\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/04-debug0.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>Initially you won&#8217;t be able to build the project, as the firmware for core #0 includes a pre-built binary for the core #1:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/05-fail.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6134\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/05-fail.png\" alt=\"\" width=\"1183\" height=\"759\" \/><\/a><\/li>\n<li>Start another instance of Visual Studio and create another project. This time, select <strong>CORE1<\/strong>:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/06-core1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6135\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/06-core1.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>Make sure you select the <strong>core1<\/strong> counterpart on the Sample Selection page:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/07-target.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6136\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/07-target.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>Also ensure that you have the core #1 selected on the Debug Method page: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/08-debug1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6137\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/08-debug1.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>In order to observe what the firmware is doing without stopping it, we will add a static variable (<strong>s_Core1Iteration<\/strong>) to the main loop in <strong>main()<\/strong>. Build the project and ensure it succeeds:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/09-build1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6138\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/09-build1.png\" alt=\"\" width=\"1183\" height=\"759\" \/><\/a><\/li>\n<li>Update the project for the core #0 to include the correct binary for core #1: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/10-path.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6139\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/10-path.png\" alt=\"\" width=\"1183\" height=\"759\" \/><\/a><\/li>\n<li>Add another static variable to monitor the state of core #0: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/11-build0.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6140\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/11-build0.png\" alt=\"\" width=\"1183\" height=\"759\" \/><\/a><\/li>\n<li>Now you can start debugging core #0. Note that the main loop won&#8217;t start running until you attach a debugger to core #1: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/12-stalled.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6141\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/12-stalled.png\" alt=\"\" width=\"1183\" height=\"759\" \/><\/a><\/li>\n<li>If you stop the core #0 now, you will see that it is waiting for core #1 to start in the <strong>MCMGR_StartCore()<\/strong> function:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/13-waiting.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6142\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/13-waiting.png\" alt=\"\" width=\"1183\" height=\"759\" \/><\/a><\/li>\n<li>Go to the second Visual Studio instance that has the project for core #1 and begin debugging. The <strong>s_Core1Iteration<\/strong> variable will start counting up: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/14-core1count.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6143\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/14-core1count.png\" alt=\"\" width=\"1183\" height=\"759\" \/><\/a><\/li>\n<li>The first instance of Visual Studio will show that the main loop of core #0 has started as well: <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/15-core0count.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6144\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2020\/05\/15-core0count.png\" alt=\"\" width=\"1183\" height=\"759\" \/><\/a>You can use the 2 instances of Visual Studio to debug each of the cores independently. Stopping one of the cores will not affect the state of the other core.<\/li>\n<\/ol>\n<p>You can find the source code for the project shown in this tutorial in our <a href=\"https:\/\/github.com\/sysprogs\/tutorials\/tree\/master\/visualgdb\/ARM\/nxp\/MultiCore\">GitHub repository<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to debug multi-core NXP devices, such as LPC55S69, using VisualGDB and the LPC-Link debug tools. Before<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89],"tags":[208,192,207],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/6129"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=6129"}],"version-history":[{"count":1,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/6129\/revisions"}],"predecessor-version":[{"id":6145,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/6129\/revisions\/6145"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=6129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=6129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=6129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}