Cohesys Android Q 10 for Boundary Devices Nitrogen8M Mini

by Laura Nao and Nicola La Gloria

Introduction

We are pleased to announce the new Cohesys Android OS release based on Android 10 for the Boundary Devices Nitrogen8M Mini development board.

Our Cohesys Android OS build series integrate full support for multicore asymmetric communication, to easily get started with developing applications that fully leverage the power of heterogeneous architectures. We provide all customizations needed from bootloader to higher OS level to get rolling on asymmetric multi-processing on heterogeneous platforms such as NXP i.MX8M Mini. We incude this set of tools and features in our Cohesys OS, to emphasize the collaboration/cohesion between MPU and MCU from a software standpoint.

At Kynetics, we have developed multiple cases of study to show the potential of asymmetric multiprocessing on different platforms, for more information refer to our previous technical notes:

There are significant advantages in using multi-processing on heterogeneous platforms on Android. Android OS today offers not only a great framework for building complex UI with multimedia capabilities but a solid model for device security and OS updates: * Android Verified Boot * DM-Verity * Trusted Execution Environment * Recovery OS * Single Image and Dual Image (A/B) over the air/wire updates

Adding to this list there is also the advantage of having Real Time OS (RTOS) capabilities for critical applications, which gives Android the power to connect complex UI to critical tasks outcomes running on a fully segregated environment.

We are presenting here Kynetics’ Cohesys for the Boundary Devices Nitrogen8M Mini single board computer

The Nitrogen8M Mini SBC is the latest in the Boundary Devices line of i.MX based Nitrogen platforms, featuring the NXP i.MX 8M Mini family of applications processors. It includes an accessory kit option with a 5V power supply, 8GB microSD card, battery, and serial console cable. The Nitrogen8M Mini is designed for mass production use with a guaranteed 10 year life span, FCC Pre-scan results, and a stable supply chain. Industrial temperature and conformal coating options are available.

Asymmetric Multi Processing on i.MX8MM

NXP i.MX8M Mini Quad processor features:

  • 4x Cortex-A53 core platforms (up to1.8GHz/core)

  • 1x Cortex-M4 core (up to 400MHz)

  • 16 KB L1 Instruction Cache

  • 16 KB L1 Data Cache

  • 256 KB tightly coupled memory (TCM)

The i.MX8MM features a greater in size TCM, compared to the previous i.MX7D/Solo platforms (TCM size is the same as in i.MX7ULP).

Software support for the Cortex-M4 core on the i.MX8MM is mantained by NXP, which provides the BSP for Amazon FreeRTOS. The Amazon FreeRTOS BSP with support for NXP i.MX8MM based platforms is shipped with the MCUXpresso SDK package, available on NXP MCUXpresso website.

Kynetics provides the FreeRTOS SDK v2.7.0 (based on latest NXP SDK release) with additional support for the Nitrogen 8M Mini board. You can find the sources on our Kynetics Github page.

What's in the FreeRTOS SDK

The FreeRTOS SDK for i.MX8MM shipped by NXP includes the RTOS kernel as well as middleware for multicore communication, peripheral drivers and RTOS wrapper drivers.

The software components within the SDK are structured as follows:

  • boards folder - contains the supported board definitions, driver examples and demo applications
  • CMSIS folder - contains CMSIS Standard Arm Cortex-M Headers, math and DSP Libraries
  • components folder - contains wrapper drivers and the SRTM protocol
  • devices folder - contains device drivers, startup and linker
  • docs folder - contains the documentation
  • middleware folder - contains middleware for multicore support (i.e. RPMSG lite)
  • rtos folder - contains the RTOS kernel code
  • tools folder - contains cmake toolchain files

RPMSG-Lite, NXP RPMsg implementation for small MCUs, is used as Inter-Processor Communication (IPC) library.

The SRTM (Simplified Real Time Messaging) application protocol developed by NXP first introduced in the i.MX7ULP SDK is also present in this SDK release. The protocol uses RPMsg-Lite as a low-level data link layer and aims at facilitating the development of multicore apps by defining a set of base services that abstract the RPMSG complexity.

In the i.MX8MM SDK, the audio services (used by the sai_low_power_audio sample application in boards/<board-name> ) are included:

  • srtm_audio_service

  • srtm_i2c_codec_adapter

  • srtm_sai_sdma_adapter

  • srtm_wm8524_adapter

Note: the SDK for i.MX7ULP includes more SRTM services to interface with other peripherals, such as on-board sensors, GPIO, Keypad. The source code can be used as an example to develop custom SRTM services.

Developing FreeRTOS apps

Useful examples are included in the SDK to be used as reference for writing a FreeRTOS app. In particular, the boards/<board-name>/multicore_examples/ contains the ping-pong and tty applications which leverage the RPMSG lite framework to communicate with the other cores.

The base structure for a multicore FreeRTOS application consists of:

  • armgcc folder: toolchain folder including the scripts to build the app
  • board.c/board.h files: board-specific definitions (e.g. default UART, LEDs, GPIOs)
  • clock_config.c/clock_config.h files: app-specific clock configuration
  • pin_mux.c/pin_mux.h files: app-specific pin mux
  • readme.txt: app description
  • <app-name>.c: the app code
  • FreeRTOSConfig.h: app-specific FreeRTOS configuration
  • rpmsg_config.h: app-specific RPMsg-Lite configuration

More details can be found in the docs directory of the SDK archive.

SDK API documentation is available on the NXP MCUXpresso website: https://mcuxpresso.nxp.com/api_doc/dev/1418/

Cohesys Android 10.0.0 OS for Boundary Devices Nitrogen8M Mini

This release of Cohesys Android OS enables the user to quickly evaluate both inter-core communication features and Amazon FreeRTOS+Android OS combination, on the Nitrogen 8M Mini SBC.

Release Notes

Here are some important notes about this Cohesys Android OS build:

  • Android 10, U-Boot 2019.04, Linux Kernel 4.19
  • Based on NXP release: 10.0.0_1.0.0 (GA 1.0)
  • Compatible with the Nitrogen8M Mini (Rev 1 and 2) single board computer w/ 2GB of RAM, at least 8GB of eMMC
  • Not compatible with Rev 1 and Rank0 RAM module
  • Compatible with the BD080MCC1 MIPI display (8 inches)
  • Android Verified Boot 2.0 is fully supported but disabled disabled for easy development
  • Android A/B partitions enabled with dual bootloader
  • Userdebug build

    • SE-Linux suported ans set to: permissive
    • DM-Verity supported and set to: disabled
  • Auto startup of Cortex-M4 core at boot

  • Easy deployment of FreeRTOS applications

  • Built-in RPMSG-Lite pingpong demo

Hardware Requirements

  • Nitrogen8M Mini single board computer (2GB of RAM and at least 8GB eMMC)
  • BD080MCC1 MIPI Display (8 inches)
  • Host computer running GNU/Linux, MacOS or Windows
  • Micro USB cable to use Fastboot and ADB
  • Boundary Devices serial console cable

Software Requirements

  • Kynetics Cohesys OS 10.0.0 for Nitrogen 8M Mini archive, downloadable here
  • Android platform tools installed on the host computer

Flash Instructions

For installation we support the uuu tool, now considered the NXP standard tool for board programming

  • Unpack the Kynetics archive. The directory with the Android images will be referred as Kynetics Android images directory in this article.
  • Set the jumper SW1 on the Nitrogen8MM SBC to ON
  • Connect the Micro USB cable from the micro USB connector of the board to the host computer. A USB 2.0 cable is recommended, as U-Boot could have some issues with USB 3.0 cable.
  • Power up the board with a 5V power adapter
  • From the Kynetics Android images directory, run:
chmod +x uuu
sudo ./uuu binaries/gpt.lst
sudo ./uuu binaries/nitrogen8mm.lst
  • Wait for the [Done] FB: done message, then set the SW1 switch to OFF and reboot the board removing the power. Android 10 will start.

IMPORTANT NOTE: This release supports both the first and the second revisions of the Nitrogen8MM: if your board reports REV30 on the PCB, replace the latest command with:

sudo ./uuu binaries/nitrogen8mm_rev2.lst

Two serial consoles will be available (accessible via serial console cable): the A53 Android debug console (via connector labeled CONSOLE) and the M4 debug console. Both consoles can be accessed using any terminal emulator program (e.g. Minicom):

minicom -D /dev/ttyUSB0
minicom -D /dev/ttyUSB1

RPMSG-Lite pingpong application

The Multicore RPMsg-Lite ping-pong RTOS project is a simple demonstration program that uses the MCUXpresso SDK software and the RPMsg-Lite library and shows how to implement the inter-core communicaton between cores of the multicore system.

The primary core (Cortex-A53) releases the secondary core (Cortex-M4) from reset and inter-core communication is established.

Once the RPMsg is initialized and endpoints are created the message exchange starts, incrementing a virtual counter that is part of the message payload. The message ping-pong finishes when the counter reaches the value of 100. Then the RPMsg-Lite is deinitialized and the procedure of the data exchange is repeated again.

In this Cohesys Android OS release, RPMsg-Lite ping-pong demo binary is automatically loaded on the Cortex-M4 core at boot. Initial setup of the RPMSG channel can be observed on the M4 console:

RPMSG Ping-Pong FreeRTOS RTOS API Demo...
RPMSG Share Base Addr is 0xb8000000
Link is up!
Nameservice announce sent.

To launch the Android counter-part of the application and initiate the data exchange, wait for Android to finish booting and type the following command on Android debug console:

insmod /vendor/lib/modules/imx_rpmsg_pingpong.ko

Data exchange between the two cores will start, as shown in the respective debug consoles.

On the M4 console:

Waiting for ping...
Sending pong...
[...]
Waiting for ping...
Sending pong...
Ping pong done, deinitializing...
Looping forever...

On the A53 console:

[   40.766453] imx_rpmsg_pingpong virtio0.rpmsg-openamp-demo-channel.-1.30: new channel: 0x400 -> 0x1e!
[   40.809618] get 1 (src: 0x1e)
[...]
[   41.038028] get 99 (src: 0x1e)
[   41.042620] get 101 (src: 0x1e)
[   41.045783] imx_rpmsg_pingpong virtio0.rpmsg-openamp-demo-channel.-1.30: goodbye!

Load your FreeRTOS application

With the MCUXpresso SDK you can develop your own real time application, and Coyesys OS is ready to run it. In particular the Nitrogen8M Mini SBC allows JTAG for MCU code debugging. Boundary Devices provides this expansion Daughter Board which includes Exposed JTAG pins, SPI to CAN Bus transceiver, UART, I2C, and other pins exposed. See Nitrogen8M Mini schematic or user manual to see full list of exposed pins.

A Custom FreeRTOS application can be easily deployed on the system, by following these steps:

  • Reboot the board in fastboot mode, using adb:
adb reboot bootloader
  • Unlock the device:
fastboot flashing unlock
  • Flash the FreeRTOS application binary to the mcu_os partition using fastboot. From the host pc:
fastboot flash mcu_os <custom-freertos-app>.bin
  • Reboot the board:
fastboot reboot

The bootloader will automatically load the new application on the TCM memory and boot the M4 core.

You can always go back to the ping-pong demo app by flashing the provided bin file using fastboot. From the Kynetics Android images folder:

fastboot flash mcu_os binaries/rpmsg_lite_pingpong_rtos_linux_remote.bin

For commercial support on Coyesys OS contact us

Enjoy the Art of Coding™