Using the Cortex-M4 MCU on the Nit6_SoloX

Published on August 17, 2015

Archived Notice

This article has been archived and may contain broken links, photos and out-of-date information. If you have any questions, please Contact Us.

The i.MX6 SoloX processor is the first of a kind, coupling a Cortex-A9 with a Cortex-M4 core inside one chip to offer the best of both MPU and MCU worlds. The MCU is perfect for all the real-time tasks whereas the MPU can provide a great UI experience with non real-time OS such as GNU/Linux.

SoloX Block Diagram

This blog post will detail how to build and run source code on the MCU using our Nit6_SoloX.


Before getting any further, here is a list of terms that will be used in this post:

  • MCC: Multi-Core Communication: protocol offered by Freescale for the MCU and MPU to exchange data
  • MCU: Microcontroller Unit such as the ARM Cortex-M series, here referring to the Cortex-M4
  • MPU: Microprocessor Unit such as the ARM Cortex-A series, here referring to the Cortex-A9
  • MQX: RTOS provided by Freescale to run their MCUs
  • RTOS: Real-Time Operating System such as MQX or FreeRTOS

For the impatient

You can download a demo image from here:

20150814-buildroot-nitrogen6x-mcu-demo.img.gz for Nit6_SoloX.

As usual, you’ll need to register on our site and agree to the EULA because it contains Freescale content. The image is a 1GB SD card image that can be restored using zcat and dd under Linux.

~$ zcat 20150814-buildroot*.img.gz | sudo dd of=/dev/sdX bs=1M

For Windows users, please use Alex Page’s USB Image Tool.

This image contains the following components:

Development environment setup

This section will detail how to set up a Linux machine to be able to build MCU source code.

First you need to download the "MQX RTOS for i.MX 6SoloX v4.1.0 releases and patches" file which requires to be registered to Freescale website:

Then you need to untar this archive and apply our patch to add support for the Nit6_SoloX board.

~$ cd && mkdir mqx && cd mqx ~/mqx$ tar xf ~/Downloads/Freescale MQX RTOS 4.1.0 for i.MX 6SoloX Linux Base.tar.gz ~/mqx$ wget ~/mqx$ patch -p1 < 0001-Add-Nit6_SoloX-board-support.patch ~/mqx$ find . -name "*.sh" -exec chmod +x {} ;

Note that this package comes with a good set of documentation which we invite you to read:

  • doc/Freescale_MQX_RTOS_4.1.0_i.MX_6SoloX_Release_Notes.pdf
  • doc/Getting_Started_with_Freescale_MQX_RTOS_on_i.MX_6SoloX.pdf

As specified in the documentation, you need to install a specific toolchain (CodeSourcery v2014q1) in order to build the BSP.

~$ cd && mkdir toolchains && cd toolchains ~/toolchains$ wget ~/toolchains$ tar xjf gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2 ~/toolchains$ rm gcc-arm-none-eabi-4_8-2014q1-20140314-linux.tar.bz2

Your machine is now ready to build applications for the MCU!

Build instructions

This section explains how to build the BSP as well as the applications for the MCU only. In order to build the BSP for the MPU, please refer to other blog posts on either Yocto or Buildroot.

~$ cd ~/mqx/ ~/mqx$ export TOP=$PWD ~/mqx$ export TOOLCHAIN_ROOTDIR=$HOME/toolchains/gcc-arm-none-eabi-4_8-2014q1/ ~/mqx$ cd $TOP/build/imx6sx_nit6sx_m4/make ~/mqx$ ./

As the BSP for our board is now built, we can build any example application provided in the MQX package. In order to have an interaction between the MPU and the MCU, you need to build a MCC application. Below are the instructions to build the pingpong application which sends data back and forth between the cores.

~/mqx$ cd $TOP/mcc/examples/pingpong/build/make/pingpong_example_imx6sx_nit6sx_m4/ ~/mqx$ ./ ~/mqx$ $TOOLCHAIN_ROOTDIR/bin/arm-none-eabi-objcopy ./gcc_arm/ram_release/pingpong_example_imx6sx_nit6sx_m4.elf -O binary m4_fw.bin

That's it, the binary is ready to be used!

Some might be interested in using an IDE to browse/modify/build the source code, note that Freescale provides instructions to use IAR Workbench (Windows only). It seems that there isn't any plan to support the SoloX MQX release inside the KSDK (Kinetis SDK) as explained in a community forum post.

Run the demo

First you need to copy the image (20150814-buildroot-nitrogen6x-mcu-demo.img.gz) provided at the beginning of this post to an SD Card. Then copy the m4_fw.bin binary to the root directory of the SD Card.

The SD Card contains the U-Boot version that enables the use of the Cortex-M4, the bootloader inside your NOR must therefore be upgraded.

U-Boot > setenv bootfile u-boot.imx U-Boot > run upgradeu

Once the upgrade is complete and the board restarted, make sure to have a clean environment:

U-Boot > env default -a ## Resetting to default environment U-Boot > saveenv

By default, the M4 must be flashed in NOR memory, a U-Boot command has been added to look for the m4_fw.bin as the root of any external storage (SD, USB, SATA):

U-Boot > run m4update

This command will download the firmware from external storage to RAM and flash it at the offset 0x1E0000 of the NOR.

While debugging on the MCU, you might wish not to write every firmware into NOR so we've added a command that loads the M4 firmware directly from external storage.

U-Boot > setenv m4boot 'run m4boot_ext'

Before going any further, make sure to hook up the second serial port to your machine as the one marked as "console" will be used for U-Boot and the other one will display data coming from the MCU. In order to start the MCU at boot up, we need to set a variable that will tell the 6x_bootscript to load the firmware into OCRAM. If you wish to start the MCU at every boot, make sure to save this variable.

U-Boot > setenv m4enabled 1 U-Boot > boot

While the kernel is booting, you should see the following prompt on the MCU serial output:

***** MCC PINGPONG EXAMPLE ***** Please wait : 1) A9 peer is ready Then press "S" to start the demo ******************************** Press "S" to start the demo :

Press the S key as requested above on the MCU serial console and then log into Buildroot on the MPU serial output (login is root, no password). You now need to enable the MPU side of the communication before starting the demo:

# echo 1 > /sys/bus/platform/drivers/imx6sx-mcc-test/mcctest.15/pingpong_en & A9 mcc prepares run, MCC version is 002.000 test/mcctest.15/pingpong_en & # Main task received a msg from [1, 0, 2] endpoint Message: Size=0x00000004, data = 0x00000002 Main task received a msg from [1, 0, 2] endpoint Message: Size=0x00000004, data = 0x00000004 ...

That's it, you've built a MCU application from scratch and can now start exploring all the examples provided inside the MQX SoloX release.