How to customize the SAM-BA applets

An applet is a small program which is used by SAM-BA in order to program non-volatile memories, low-level initialization, or other peripherals wired o Microchip AVR and ARM MPUs. This article describes how to compile the applet code.

I wrote this article as personal notes during my tests to add the 256MB QuadSPI flash avaiable on the RoadRunner Q256 module. The example has been tested on Linux Ubuntu version 16.04.2

The official info about SAM-BA applets are available on this Microchip's pdf:

Installing the Microchip Software package on your Linux PC

The SAMA5D2 software package consists of microcontroller drivers, software services and libraries. Each software module is provided with full source code, examples of usage, rich html documentation and ready-to-use projects for the GNU GCC and IAR EWARM compilers.

Get start cloning the Microchip Software Package from GitHub repository by typing:

git clone
cd atmel-software-package

Download the GNU ARM Embedded Toolchain for Linux:

Try to compile an Applet

Move to the Applet source directory you need to change:

cd samba_applets/qspiflash

Launch the Applet compilation:

make TARGET=sama5d2-generic RELEASE=1 CROSS_COMPILE=~/gcc-arm-none-eabi/bin/arm-none-eabi-

Example: Enable the applet qspiflash to manage new QuadSPI chips

Enable the 256MByte QuadSPI used on RoadRunner Q256 by editing the file atmel-software-package/drivers/nvm/spi-nor-ids.c at this line:

{ N25Q("n25q00ax1",  0x20bb21, 2048), },
{ N25Q("n25q00ax3",  0x20ba21, 2048), },
/* Acme Systems - RoadRunner QuadSPI Micron 256 MB*/
{ N25Q("MT25Q02G",   0x20ba22, 2048), },

Launch the Applet compilation:

make TARGET=sama5d2-generic RELEASE=1 CROSS_COMPILE=~/gcc-arm-none-eabi/bin/arm-none-eabi-

Copy the executable file to sam-ba directory where is located the old Applet binary file:

cp build/sama5d2-generic/sram/applet-qspiflash_sama5d2-generic_sram.bin  ~/roadrunner/sam-ba_3.2.1/qml/SAMBA/Device/SAMA5D2/applets

Set the trace level debug

Five level of debug messages are available (

/// !Trace level description
/// -# TRACE_DEBUG (5): Traces whose only purpose is for debugging the program, 
///    and which do not produce meaningful information otherwise.
/// -# TRACE_INFO (4): Informational trace about the program execution. Should  
///    enable the user to see the execution flow.
/// -# TRACE_WARNING (3): Indicates that a minor error has happened. In most case
///    it can be discarded safely; it may even be expected.
/// -# TRACE_ERROR (2): Indicates an error which may not stop the program execution, 
///    but which indicates there is a problem with the code.
/// -# TRACE_FATAL (1): Indicates a major error which prevents the program from going
///    any further.

To set the trace level add this file in samba_applets/qspiflash/Makefile:



Author: Sergio Tanzilli -
System designer and CEO of Acme Systems srl
Web master of: and
Software developer on: and