{"id":105,"date":"2014-03-10T13:03:40","date_gmt":"2014-03-10T16:03:40","guid":{"rendered":"http:\/\/mdqinc.com\/blog\/?p=105"},"modified":"2014-03-10T13:23:59","modified_gmt":"2014-03-10T16:23:59","slug":"efm32-development-environment-on-ubuntu-linux","status":"publish","type":"post","link":"https:\/\/mdqinc.com\/blog\/2014\/03\/efm32-development-environment-on-ubuntu-linux\/","title":{"rendered":"EFM32 development environment on Ubuntu Linux"},"content":{"rendered":"<p>These are instructions on how to set up a usable development environment on Ubuntu Linux 13.10 64 bits, complete with GDB debugging over J-Link, for the <a href=\"http:\/\/www.silabs.com\/products\/mcu\/Pages\/32-bit-microcontroller-tools.aspx\" target=\"_blank\">EFM32 series development boards<\/a> by <a href=\"http:\/\/energymicro.com\/\" target=\"_blank\">Energy Micro<\/a>.<\/p>\n<p>Start by download the <a href=\"http:\/\/cdn.energymicro.com\/dl\/packages\/studio_linux.tar.gz\" target=\"_blank\">Simplicity Studio beta installer<\/a> for Linux:<\/p>\n<pre class=\"brush:bash\">mkdir -p ~\/simplicity\r\ncd ~\/simplicity\r\nwget http:\/\/cdn.energymicro.com\/dl\/packages\/studio_linux.tar.gz\r\ntar -xvf studio_linux.tar.gz\r\ncd energymicro\r\npython studio.py<\/pre>\n<p>The script will do its process and eventually it will error out saying that &#8220;Simplicity Studio New&#8221; was not found. This is ok, the process can continue anyway:<\/p>\n<pre class=\"brush:bash\">cd studio_new\r\nchmod +x studio.py\r\n.\/studio.py<\/pre>\n<p>Now proceed to install everything you are offered (it&#8217;ll take some time).<\/p>\n<p>The next thing you need is the J-Link software to be able to connect to the board via JTAG over USB. Go to <a href=\"http:\/\/www.segger.com\/jlink-software.html\" target=\"_blank\">Segger&#8217;s website<\/a> and download the package titled &#8220;<a href=\"http:\/\/www.segger.com\/jlink-software.html?step=1&amp;file=JLinkLinuxDEB32_4.80.8\" target=\"_blank\">Software and documentation pack for Linux V4.80h, DEB Installer 32-bit version<\/a>&#8220;. Do note that you have to get the 32 bit version even if you have a 64 bit Linux OS.<\/p>\n<pre class=\"brush:bash\">sudo dpkg -i jlink_4.80.8_i386.deb<\/pre>\n<p>You also need a toolchain to compile the examples (and your own code) to ARM. The toolchain required is called arm-none-eabi (ARM processor, no distro\/bare metal, &#8220;eabi&#8221; ABI specification). There&#8217;s an <a href=\"https:\/\/launchpad.net\/~terry.guo\/+archive\/gcc-arm-embedded\" target=\"_blank\">Ubuntu PPA that provides this<\/a>. There&#8217;s no packages for Ubuntu 13.10, but those for 13.04 work just fine, so you can do:<\/p>\n<pre class=\"brush:bash\">sudo add-apt-repository ppa:terry.guo\/gcc-arm-embedded<\/pre>\n<p>And then edit \/etc\/apt\/sources.list.d\/terry_guo-gcc-arm-embedded-saucy.list replacing &#8220;saucy&#8221; by &#8220;raring&#8221;, so the file ends up like this:<\/p>\n<pre>deb http:\/\/ppa.launchpad.net\/terry.guo\/gcc-arm-embedded\/ubuntu raring main<\/pre>\n<p>&nbsp;<\/p>\n<p>After that:<\/p>\n<pre class=\"brush:bash\">sudo apt-get update\r\nsudo apt-get install gcc-arm-none-eabi<\/pre>\n<p>For convenience, you can set up a few aliases in your ~\/.bashrc or ~\/.bash_profile file:<\/p>\n<pre class=\"brush:bash\">alias efm32gdb=\"\/usr\/bin\/arm-none-eabi-gdb\"\r\nalias efm32gdbserver=\"JLinkGDBServer -if SWD\"<\/pre>\n<p>The first alias just points the command efm32gdb to the right gdb version and the other alias starts a GDB server over J-Link using the Single Wire protocol.<\/p>\n<p>At this point you should be pretty much set up. If you want to compile Simplicity Studio&#8217;s examples, use the armgcc Makefiles provided, setting the LINUXCS environment variable to &#8220;\/usr&#8221;<\/p>\n<pre>LINUXCS=\/usr Makefile -f Makefile.someproject<\/pre>\n<p>&nbsp;<\/p>\n<p>If the process completes successfully, you&#8217;ll get two files in the exe folder. something.bin is the file you should flash using Simplicity Studio&#8217;s Energy Commander &#8220;Flash&#8221; panel. something.out is the file you can use for debugging.<\/p>\n<pre class=\"brush:bash\">efm32gdbserver &amp;\r\nefm32gdb -x mygdbinitscript<\/pre>\n<p>mygdbinitscript should look like:<\/p>\n<pre>file armgcc\/exe\/something.out\r\ntarget remote :2331\r\n#set tdesc filename target-m3.xml\r\nmon flash download = 1\r\n#mon flash device = EFM32GG990F1024\r\nset mem inaccessible-by-default off\r\n#set remote memory-read-packet-size 1200\r\n#set remote memory-read-packet-size fixed\r\nmon speed 4000\r\nmon endian little\r\nmon reset 1\r\ntbreak main\r\ncont<\/pre>\n<p>As a matter of personal taste I use KDevelop as my IDE, because it makes integrating all this in your own project dead simple. All in all it takes some effort to set up the environment, but once you do everything works like a charm, and you can debug seamlessly from within a top notch IDE. I also did try using QtCreator, but given it does not allow you (as of this writing) to customize the GDB binary, you can not do remote debugging as you do with KDevelop.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>These are instructions on how to set up a usable development environment on Ubuntu Linux 13.10 64 bits, complete with GDB debugging over J-Link, for the EFM32 series development boards by Energy Micro. Start by download the Simplicity Studio beta installer for Linux: mkdir -p ~\/simplicity cd ~\/simplicity wget http:\/\/cdn.energymicro.com\/dl\/packages\/studio_linux.tar.gz tar -xvf studio_linux.tar.gz cd energymicro [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[12,3,6],"tags":[],"_links":{"self":[{"href":"https:\/\/mdqinc.com\/blog\/wp-json\/wp\/v2\/posts\/105"}],"collection":[{"href":"https:\/\/mdqinc.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mdqinc.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mdqinc.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mdqinc.com\/blog\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":5,"href":"https:\/\/mdqinc.com\/blog\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":110,"href":"https:\/\/mdqinc.com\/blog\/wp-json\/wp\/v2\/posts\/105\/revisions\/110"}],"wp:attachment":[{"href":"https:\/\/mdqinc.com\/blog\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mdqinc.com\/blog\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mdqinc.com\/blog\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}