Arduino IDE Build Settings

Custom application firmware build settings for the Arduino IDE

1. Introduction

This document descibes custom build settings needed by some microcontrollers.

The Arduino IDE configuration files contain settings that affect the layout of exported application firmware files. For some boards, the bootloader location needs to be changed for the firmware to work with the RIoT Secure platform.

Boards affected:

  • Arduino Uno R4 WiFi

Other boards do not require custom settings.

2. Arduino Uno R4 Custom Settings

The Arduino Uno R4 requires a custom bootloader location to work with the RIoT Secure platform. This setting is found in the Arduino IDE configuration files.

2.1. Location of Bootloader Config File

The location of configuration files vary dependent on the operating system used.

2.1.1. macOS Config File

On macOS, the location of the config file for the Arduino Uno R4 bootloader is:

~/Libraries/Arduino15/packages/arduino/hardware/renesas_uno/1.0.4/variants/UNOWIFIR4/memory_regions.ld

2.1.2. Window Config File

On Windows, the location of the config file for the Arduino Uno R4 bootloader is:

(Not yet documented)

2.1.3. Linux Config File

On Linux (Ubuntu), the location of the config file for the Arduino Uno R4 bootloader is:

~/.arduino15/packages/arduino/hardware/renesas_uno/1.1.0/variants/UNOWIFIR4/memory_regions.ld

2.2. Bootloader Settings

Open file memory_regions.ld in a text editor, and make the following modification:

 OSPI_DEVICE_0_LENGTH = 0x0;
 OSPI_DEVICE_1_START = 0x70000000;
 OSPI_DEVICE_1_LENGTH = 0x0;
-FLASH_IMAGE_START = 0x4000;
+FLASH_IMAGE_START = 0x0000;
 VECTOR_TABLE_LENGTH = 0x100;
 BSP_CFG_STACK_MAIN_BYTES = 0x400;

That is, change the bootloader start address to:

FLASH_IMAGE_START = 0x0000;

Then save the file.

2.3. Apply Settings

To apply the settings, close and restart the Arduino IDE.

2.4. Build and Export the Compiled Firmware

After having closed and reopended the Arduino IDE, select the board and export the compiled binary as follows:

  • Select the board using the menu option Tools→Board→Arduino UNO R4 Boards→Arduino UNO R4 WiFi.

  • Compile and export a binary firmware file using the menu command Sketch→Export Compiled Binary.

The compiled sketch will be saved in the folder where the sketch has been saved. If the sketch is named Blink.ino, the exported file will be named:

Blink.ino.hex

This is the file to be uploaded to the OASIS Cloud using the Management Console.

2.5. Caveat

This above setting will prevent firmware uploaded via the Arduino IDE to a regular, non-enrolled Uno R4 board from working.

To build firmware for a regular Uno R4 board, change the bootloader start address back to the original setting in file memory_regions.ld:

FLASH_IMAGE_START = 0x4000;

3. Other Boards

Other boards do not require custom settings.