{"id":1955,"date":"2023-09-03T12:36:25","date_gmt":"2023-09-03T19:36:25","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=1955"},"modified":"2023-09-05T08:31:11","modified_gmt":"2023-09-05T15:31:11","slug":"developing-firmware-for-efm32-devices-with-visual-studio","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/arm\/efm32\/","title":{"rendered":"Developing firmware for EFM32 devices with Visual Studio"},"content":{"rendered":"<p>This tutorial shows how to develop firmware for the EFM32 devices with Visual Studio and VisualGDB. Before you begin, install Visual Studio and VisualGDB.<\/p>\n<ol>\n<li>Start Visual Studio and open the VisualGDB Embedded Project Wizard:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/01-newprj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8222\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/01-newprj.png\" alt=\"\" width=\"1014\" height=\"675\" \/><\/a><\/li>\n<li>Enter the name and location of the project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/02-name.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8223\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/02-name.png\" alt=\"\" width=\"1014\" height=\"675\" \/><\/a><\/li>\n<li>Proceed with the default project type (Embedded Application) and the Advanced CMake build subsystem:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/03-bin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8224\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/03-bin.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>On the next page select the ARM toolchain and choose your EFM32 device from the list. VisualGDB will automatically download the necessary support files. In this tutorial we will show how to program the <a href=\"http:\/\/www.silabs.com\/products\/mcu\/32-bit\/Pages\/efm32gg-stk3700.aspx\">EFM32 Giant Gecko Starter Kit (STK3700)<\/a>, so we select the EFM32GG990F1024 device:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/04-dev.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8225\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/04-dev.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a>If you are using a device with ARM SecureZone support, check the &#8220;<strong>Enable Armv8-M Security Extensions<\/strong>&#8221; checkbox below the device selector. It will enable the CMSE extensions required by the Gecko SDK.<\/li>\n<li>Proceed with the default LEDBlink sample. If you are using a different board, change the LED port name and pin number to match your board:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/05-port.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8226\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/05-port.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>The EFM32 Giant Gecko development board comes with a built-in Segger J-Link programmer, so we simply select the Segger J-Link debug method and the Segger J-Link software will automatically recognize the chip:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/06-jlink.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8227\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/06-jlink.png\" alt=\"\" width=\"886\" height=\"693\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; to generate the project. Build it via Build-&gt;Build Solution:<\/li>\n<li>Press F5 to automatically program the board and start debugging. Notice how the LED on the board begins to blink:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/led_on.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1967\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/led_on.jpg\" alt=\"led_on\" width=\"700\" height=\"275\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/led_on.jpg 700w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/led_on-300x118.jpg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/li>\n<li>Set a breakpoint at the second call to GPIO_PinOutClear and wait until it hits:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/07-step.png\"> <img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1962\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/07-step.png\" alt=\"07-step\" width=\"932\" height=\"675\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/07-step.png 932w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/07-step-300x217.png 300w\" sizes=\"(max-width: 932px) 100vw, 932px\" \/><\/a><\/li>\n<li>Step over the call and notice how the LED turns off:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/led_off.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1968\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/led_off.jpg\" alt=\"led_off\" width=\"700\" height=\"273\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/led_off.jpg 700w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/led_off-300x117.jpg 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/li>\n<li>You can use the Hardware Registers view to check the state of various hardware registers. E.g. you can easily see how setting pin 2 of port E to 1 changes to DOUT register of the GPIO port E (P[4]):<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/08-dout.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8229\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/08-dout.png\" alt=\"\" width=\"1128\" height=\"717\" \/><\/a><\/li>\n<li>If you want to monitor some of your program&#8217;s variables without stopping the program, use the Live Variables window to add live watches and enable plotting to view them graphically. E.g. you can plot how the TickCount value increases linearly over time:\u00a0 <a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/09-live.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8231\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/09-live.png\" alt=\"\" width=\"1128\" height=\"717\" \/><\/a>You can also click the lightning icon in the Hardware Registers window to mark specific registers as live (i.e. queried while the program is running).<\/li>\n<li>You can use the Embedded Frameworks page of the VisualGDB Project Properties to add reference to various software frameworks. E.g. you can add a reference to the EFM32 USB library if you want to use USB functionality in your code:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/10-config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8232\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2016\/06\/10-config.png\" alt=\"\" width=\"941\" height=\"602\" \/><\/a><\/li>\n<\/ol>\n<p>The VisualGDB BSP for the EFM32 devices is based on the official <a href=\"https:\/\/github.com\/SiliconLabs\/gecko_sdk\/\">Gecko SDK<\/a>. If you would like to use additional libraries from the original SDK, you can find the matching SDK version in the <strong>%LOCALAPPDATA%\\VisualGDB\\EmbeddedBSPs\\arm-eabi\\com.sysprogs.arm.silabs.efm32\\SDKVersions.txt<\/strong> file. You can then clone the Git tag mentioned in the file to a directory on your system, and begin adding files from it to your project. As long as you are using the same tag as mentioned in <strong>SDKVersions.txt<\/strong>, libraries should be compatible with VisualGDB projects.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to develop firmware for the EFM32 devices with Visual Studio and VisualGDB. Before you begin, install<\/p>\n","protected":false},"author":1,"featured_media":1969,"comment_status":"closed","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89],"tags":[],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/1955"}],"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=1955"}],"version-history":[{"count":3,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/1955\/revisions"}],"predecessor-version":[{"id":8233,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/1955\/revisions\/8233"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media\/1969"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=1955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=1955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=1955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}