Create a MicroEJ Platform for a Custom Device¶
A MicroEJ Architecture is a software package that includes the MicroEJ Runtime port to a specific target Instruction Set Architecture (ISA) and C compiler. It contains a set of libraries, tools and C header files. The MicroEJ Architectures are provided by MicroEJ SDK.
A MicroEJ Platform is a MicroEJ Architecture port for a custom device. It contains the MicroEJ configuration and the BSP (C source files).
MicroEJ Corp. provides MicroEJ Evaluation Architectures at https://repository.microej.com/modules/, and MicroEJ Platform demo projects for various evaluation boards at https://repository.microej.com/index.php?resource=JPF.
We recommend reading the MICROEJ VEE section to get an overview of MicroEJ Firmware build flow.
The following document assumes the reader is familiar with the VEE Porting Guide.
Each MicroEJ Platform is specific to:
- a MicroEJ Architecture (MCU ISA and C compiler)
- an optional RTOS (e.g. FreeRTOS - note: the MicroEJ OS can run bare metal)
- a device: the OS bring up code that is device specific (e.g. the MCU specific code/IO/RAM/Clock/Middleware… configurations)
In this document we will address the following items:
- MicroEJ Platform Configuration project (in MicroEJ SDK)
- MicroEJ Simulator (in MicroEJ SDK)
- Platform BSP (in a C IDE/Compiler like GCC/KEIL/IAR)
The MicroEJ Platform relies on C drivers (aka low level LL drivers) for each of the platform feature.
These drivers are implemented in the platform BSP project. This project is edited in the C compiler IDE/dev environment (e.g. KEIL, GCC, IAR).
E.g. the MicroUI library LED feature will require a
LLUI_LED.c that implements the native on/off IO drive.
The following sections explain how to create a MicroEJ Platform for a custom device starting from an existing MicroEJ Platform project whether it is configured for the same MCU/RTOS/C Compiler or not.
In the following, we assume that the new device hardware is validated and at least a trace output is available. It is also a good idea to run basic hardware tests like:
- Internal and external flash programming and verification
- RAM 8/16/32 -bit read/write operations (internal and external if any)
- EEMBC Coremark benchmark to verify the CPU/buses/memory/compiler configuration
- See the Platform Qualification Tools used to qualify MicroEJ Platforms.
A MicroEJ Platform Project is already available for the same MCU/RTOS/C Compiler¶
This is the fastest way: the MicroEJ Platform is usually provided for a silicon vendor evaluation board. Import this platform in MicroEJ SDK.
As the MCU, RTOS and compiler are the same, only the device specific code needs to be changed (external RAM, external oscillator, communication interfaces).
In the SDK
.platformfrom the MicroEJ Platform (
xxx-configurationproject) to match the device features and its associated configuration (e.g.
More details on available modules can be found in the VEE Porting Guide.
modify the BSP C project to match the device specification
- edit the scatter file/link options
- edit the compilation options
create/review/change the platform Low Level C drivers. They must match the device components and the MCU IO pin assignment
A number of
LL*.hfiles are referenced from the project. Implement the function prototypes declared there so that the JVM can delegate the relevant operations to the provided BSP C functions.
In the SDK
- modify the existing Simulator Front Panel
A MicroEJ Platform Project is not available for the same MCU/RTOS/C Compiler¶
Look for an available MicroEJ Platform that will match in order of priority:
- same MCU part number
- same RTOS
- same C compiler
At this point, consider either to modify the closest MicroEJ Platform
- In the SDK: modify the platform configuration.
- in the C IDE: start from an empty project that match with the MCU.
Or to start from scratch a new MicroEJ Platform
In the SDK: create the MicroEJ Platform and refer to the selected MicroEJ Platform as a model for implementation. (refer to Platform Configuration)
in the C IDE: start from an empty project and implement the drivers of each of the LL drivers API.
Make sure to link with:
microejruntime.athat runs the JVM for the MCU Architecture
microejapp.othat contains the compiled Java application
The MCU specific code can be found:
- in the C project IDE properties
- in the linker file
- the IO configuration
- in the low level driver (these drivers are usually provided by the silicon vendor)
The LL driver is named
LLMJVM_RTOS.c/.h. Modify this file to match the selected RTOS.
The BSP project is provided for a specific compiler (that matches the selected platform architecture).
Start a new project with the compiler IDE that includes the LL drivers and start the MicroEJ Platform in the