{"id":123,"date":"2014-02-04T17:39:32","date_gmt":"2014-02-05T01:39:32","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=123"},"modified":"2021-03-09T12:02:25","modified_gmt":"2021-03-09T20:02:25","slug":"arm-kinetis-frdm-kl25z","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/arm\/kinetis\/frdm-kl25z\/","title":{"rendered":"Developing FRDM-KL25Z firmware with Visual Studio"},"content":{"rendered":"<p>This tutorial shows how to make a basic &#8216;Blinking LED&#8217; project for the FRDM-KL25Z development platform with Visual Studio using the VisualGDB add-in.<\/p>\n<p>Before you begin ensure that you have <a href=\"http:\/\/visualgdb.com\/download\/\">VisualGDB 4.1<\/a> or later installed.<\/p>\n<ol>\n<li>Launch Visual Studio. Start creating a new project with VisualGDB Embedded Project Wizard:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/01-newprj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/01-newprj.png\" alt=\"01-newprj\" width=\"700\" height=\"408\" \/><\/a><\/li>\n<li>Proceed with the default settings (Embedded binary) on the first page:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/02-embeddedbin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/02-embeddedbin.png\" alt=\"02-embeddedbin\" width=\"702\" height=\"569\" \/><\/a><\/li>\n<li>On the second page select the arm-eabi toolchain. If it is not installed, VisualGDB will automatically download and install it for you:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/arminstall.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/arminstall.png\" alt=\"arminstall\" width=\"701\" height=\"551\" \/><\/a><\/li>\n<li>If you have not created Kinetis projects before, click &#8220;Download support for more devices&#8221; and select &#8220;Freescale Kinetis&#8221;. Once the Kinetis files are available, select the <strong>MK25Z128xxx4<\/strong> device from the list:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/03-kl25zdev.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/03-kl25zdev.png\" alt=\"03-kl25zdev\" width=\"702\" height=\"569\" \/><\/a><\/li>\n<li>Once you press &#8220;Next&#8221;, VisualGDB will test the toolchain and ensure that it can create projects with the selected settings:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/04-test.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/04-test.png\" alt=\"04-test\" width=\"484\" height=\"294\" \/><\/a><\/li>\n<li>VisualGDB will generate a basic &#8220;Blinking LED&#8221; project for you after you specify the LED port on the next page of the wizard. According to FRDM-KL25Z schematics, the red LED is connected to <strong>PTB18<\/strong>: <a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/led-schematics.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/led-schematics.png\" alt=\"led-schematics\" width=\"700\" height=\"191\" \/><\/a>To make the example blink the red LED select PTB as the port group and 18 as the port number:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/05-ledport.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/05-ledport.png\" alt=\"05-ledport\" width=\"702\" height=\"569\" \/><\/a><\/li>\n<li>The last page allows configuring debug settings. The FRDM-KL25Z board is equipped with the OpenSDA circuit that can itself be programmed to emulate various hardware debuggers. In this tutorial we will use the Segger J-Link firmware and show how to use the Segger tools. Hold the reset button on the board and plug it into the USB port <strong>while holding the button <\/strong>(use the lower connector labeled as SDA). A new drive called &#8216;BOOTLOADER&#8217; will appear in Explorer.<\/li>\n<li>Download the Segger firmware from <a href=\"http:\/\/www.segger.com\/opensda.html\">this page<\/a>, unpack the archive and drag-n-drop it to the &#8216;BOOTLOADER&#8217; drive:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/07-bootloader.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/07-bootloader.png\" alt=\"07-bootloader\" width=\"515\" height=\"458\" \/><\/a><span class=\"warning\">Warning: if the drive label is not &#8216;BOOTLOADER&#8217;, you were not holding the &#8216;Reset&#8217; button while plugging in the device. Do not copy the OpenSDA file in non-bootloader mode as it will be programmed into your KL25 microcontroller instead.<\/span><\/li>\n<li>Download and install the <a href=\"http:\/\/www.segger.com\/jlink-software.html\">Segger J-Link software package<\/a>. Reconnect your board and ensure that it is detected as &#8220;Segger J-Link&#8221; and that the Segger drivers are installed for it (the drivers will be available in the Segger directory in Program Files):<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/08-jlink.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/08-jlink.png\" alt=\"08-jlink\" width=\"661\" height=\"579\" \/><\/a><\/li>\n<li>Go to the Debug Method page in the wizard, specify the location of the J-Link software and select SWD as the target interface:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/09-seggercfg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/09-seggercfg.png\" alt=\"09-seggercfg\" width=\"702\" height=\"545\" \/><\/a><\/li>\n<li>Press the &#8220;Finish&#8221; button. VisualGDB will generate a Visual Studio project for the FRDM-KL25Z board. Build it by pressing Ctrl-Shift-B:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/10-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-11\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/10-build.png\" alt=\"10-build\" width=\"698\" height=\"614\" \/><\/a><\/li>\n<li>Press F5 to start debugging. The red part of the RGB LED will start blinking. Put a breakpoint at the line setting the <strong>PTB_BASE_PTR-&gt;PCOR<\/strong> register and wait until the breakpoint is hit:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/11-breakpoint.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/11-breakpoint.png\" alt=\"11-breakpoint\" width=\"698\" height=\"614\" \/><\/a><\/li>\n<li>Look at the board. The RGB LED will be inactive:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/led_off.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-13\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/led_off.png\" alt=\"led_off\" width=\"700\" height=\"381\" \/><\/a><\/li>\n<li>Press F10 to step over the current line. This will write the value of 1 into the 18<sup>th<\/sup> bit of the PTB_PCOR register, switching it to outputting 0 and lighting up the red part of the LED (as the other side of it is connected to +3.3V):<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/led_red.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-14\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/tutorials\/arm\/kinetis\/frdm-kl25z\/led_red.png\" alt=\"led_red\" width=\"700\" height=\"367\" \/><\/a><\/li>\n<li>Press Shift-F5 to stop debugging.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to make a basic &#8216;Blinking LED&#8217; project for the FRDM-KL25Z development platform with Visual Studio using<\/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":[53,207,59],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/123"}],"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=123"}],"version-history":[{"count":1,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/123\/revisions"}],"predecessor-version":[{"id":195,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/123\/revisions\/195"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}