Understand How to Build a Firmware and its Dependencies

A Firmware is built from several input resources and tools. Each component has dependencies and requirements that must be carefully respected in order to build a Firmware.

This document describes the components, their dependencies and the process involved in the build of a Firmware.

Good knowledge of the MicroEJ Glossary is required.

The Components

As depicted in the following image, several resources and tools are used to build a Firmware.

../_images/qa_resources-v3.PNG

Architecture

A MicroEJ Architecture contains the runtime port to a target instruction set (ISA), a C compiler (CC) and Foundation Libraries.

Architectures are distributed in two versions:

A selection of supported embedded Architectures can be found here: https://developer.microej.com/mej32-embedded-runtime-architectures/

The Architecture is either provided from:

Note

Ask MicroEJ sales or support team if the requested architecture is not listed as available.

Platform Sources

A Platform includes development tools and a runtime environment:

  • the Architecture and MicroEJ Packs,
  • the Abstraction Layers implementations,
  • the Simulator and its associated Mocks,
  • a C Board Support Package (BSP) with C drivers and an optional RTOS.

The Platform sources contains the following projects:

  • <platform>-configuration: The Platform Configuration project.
  • <platform>-bsp: The C code for the board-specific files (drivers).
  • <platform>-fp: Front Panel mockup for the simulator.

See Platform Import to learn how to import an existing Platform, and Platform Creation to learn how to create a Platform.

Depending on the project’s requirements, the Platform can be connected in various ways to the BSP; see BSP Connection for more information on how to do it.

Application

An Application is a Java project that can be configured (in the Run configurations … properties):

  1. to either run on:
  • the Simulator (computer desktop),
  • a device (actual embedded hardware).
  1. to setup:
  • memory (example: Java heap, Java stack),
  • Foundation Libraries,
  • etc.

To run on a device, the application is compiled and optimized for a specific Platform. It generates a microejapp.o (native object code) linked with the <platform>-bsp project.

To import an existing Application as a zipped project in the SDK:

  • Go to File > Import… > General > Existing Projects into Workspace > Select archive file > Browse….
  • Select the zip file of the project.
  • And select Finish import.

See Create a MicroEJ Standalone Application for more information on how to create, configure, and develop a Standalone Application.

C Toolchain (GCC, KEIL, IAR, …)

Used to compile and link the following files into the final executable (binary, hex, elf, … that will be programmed on the hardware):

  • the microejapp.o (application),
  • the microejruntime.lib or microejruntime.a (Platform runtime),
  • the BSP C files (C application files and Board Support Package).

Module Repository

A Module Repository provides the modules required to build Platforms and Applications.

See Module Repository for more information.

Dependencies Between Components

  • An Architecture targets a specific instruction set (ISA) and a specific C compiler (CC).
    • The C toolchain used for the Architecture must be the same as the one used to compile and link the BSP project.
  • A Platform consists of the aggregation of both an Architecture and a BSP with a C toolchain.
    • Changing either the Architecture or the C toolchain results in a change of the Platform.
  • An Application is independent of the Architecture.
    • It can run on any Platform as long the Platform provides the required APIs.
    • To run an Application on a new device, create a new Platform for this device with the exact same features. The Application will not require any change.

How to Build

The process of building a Firmware is two-fold:

  1. Build a Platform,
  2. Compile/link the application and BSP using the C toolchain.

Note

The Application will also run on the Simulator using the mocks provided by the Platform.

Build a Platform

The next schema presents the components and process to build a Platform.

../_images/platform-build_workflow.PNG

Build a Firmware

The next schema presents the build flow of a Mono-Sandbox Firmware (previously known as a MicroEJ Single-app Firmware). The steps are:

  1. Build the Application using the SDK (generates a microejapp.o file).
  2. Compile the BSP C sources using the C toolchain (generates .o files).
  3. Link the BSP files (.o), the Application (microejapp.o) and the Platform runtime library (microejruntime.a) using the C toolchain to produce the final executable (ELF or binary, for example application.out).
../_images/build_microej_mono_sandbox_firmware_numbered.PNG

See BSP Connection for more information on how to connect a Platform to a BSP.

Dependencies Between Processes

  • Rebuild the Platform:
    • When the Architecture (.xpf) changes.
    • When a Pack provided by MicroEJ (.xpfp) changes.
    • When a Foundation Library changes, either when
      • The public API (.java or .h) changes.
      • The front-panel or mock implementation (.java) changes.
  • Rebuild of the Platform is not required:
    • When the implementation (.c) of a Foundation Library changes.
    • When the BSP (.c) changes.
    • When the Application changes.
  • Rebuild the Application:
    • When its code changes.
    • When the Platform changes.
  • Rebuild the BSP:
    • When its code changes.
    • When the Platform changes.
  • Rebuild the Firmware:
    • When the Application (microejapp.o) changes.
    • When the BSP (*.o) changes.
    • When the Platform (microejruntime.a) changes.