Despite the fact that SAM4L series microcontroller uses Cortex-M4 ARM core, I am going to reuse the same binutils, compiler, and debugger used for the Raspberry PI.
Those tools producing bare-metal ARM binaries, which conforms to ARM Embedded Application Binary Interface (arm-none-eabi). However, there is a complication. By the time I am writing this article, OpenOCD does not supporting Serial Wire Debug (SWD) over J-Link interface. But there is a workaround.
This development board has built-in J-Link debugger from Segger. You can download software pack for Linux, which includes GDB server and command line tools, from their web site. This server works fine with arm-none-eabi-gdb debugger.
Once the software pack is downloaded and unpacked, follow the installation instructions provided in README.txt. Generally, you need to copy shared libraries into system library folder (/usr/local/lib), run ldconfig, copy udev rules file, create 'plugdev' group if necessary, add your local user to this group, and reload udev rules. This experience may depend from your linux distribution configuration. The commands below are good for my Ubuntu 13.04. In this distribution the 'plugdev' group is exist by default.
#unpack the bundle tar -xzf JLink_Linux_V469b.tgz cd JLink_Linux_V469b #add current user to 'plugdev' group sudo usermod -a -G plugdev `id -un` #copy shared library to system folder sudo cp libjlinkarm.so.* /usr/lib
sudo ldconfig #copy udev rule file sudo cp 45-jlink.rules /etc/udev/rules.d #reload udev rules sudo udevadm control --reload-rules
#start J-Link GDB server
./JLinkGDBServer -device ATSAM4LC4C -if SWD -speed auto
By default, this server will be listening at port 2331
I am little bored from command line interfaces, so moving to a complex IDE can help me a little. After some research I have stopped my eyes on Eclipse Juno (CDT) IDE. At this time, Eclipse Kepler (8.2.0) is the latest to download. So, I am downloading 64bit Linux binary, and unpacking it into a folder in my home directory. No installation required, just run eclipse binary from the files.
Next, we need to learn Eclipse to use our embedded cross-compiler and related tools. This could be done using GNU ARM Eclipse Plugin. Just install it "The Eclipse Way" as stated on their web page. You have to ignore security warnings as you are installing unsigned 3rd party plugin. Then, you can create new project as on picture below.
This plugin is creating Cortex-M4 target by default, so you do not need to modify settings at this time.
At this time we are still missing cross debugging support in our installation of Eclipse. This will be achieved by installing Zylin Embedded CDT plugin.
Done. We have all software in place to start developing.