This note explains how to build and run FreeRTOS demos on Cortex-M4.
Installing FreeRTOS BSP
- Download and install i.MX 8MQuad Cortex-M4 Beta FreeRTOS BSP based on MCUXpresso SDK v2.3 available here (Windows and Linux installers are located inside the "MCUXpresso SDK for i.MX"/"i.MX 8MQuad" item).
- Install and activate the ARM GCC toolchain as described in section "5 Run a demo using ARM® GCC" of the Getting Started with MCUXpresso SDK i.MX 8M Quad document available in subdirectory docs of the top installation directory of the i.MX 8MQuad Cortex-M4 Beta FreeRTOS BSP.
- Download and unpack the tarball with the Emcraft FreeRTOS BSP layer from the Emcraft site to the top installation directory of i.MX 8MQuad Cortex-M4 Beta FreeRTOS BSP:
$ tar zxf imx8m-som-rtos-demo.tgz
Getting Access to Serial Console
On the PC host side, the FreeRTOS console is available via the J5 dual port UART/USB connector. The software installed on the IMX8M SOM configures the serial console for a 115.2 Kbs terminal.
On some Linux distributions, connecting to the dual port UART/USB device causes the Modem Manager package to try opening the TTY device and sending modem commands to it, thus occupying the port. To avoid this effect, the ModemManager package must be disabled on the host with the following command:
$ sudo mv /usr/share/dbus-1/system-services/org.freedesktop.ModemManager.service
/usr/share/dbus-1/system-services/org.freedesktop.ModemManager.service.disabled
On the Linux host, the dmesg command can be used to figure out the TTY devices corresponding to the two serial ports:
$ dmesg | tail
[495846.154337] cp210x 1-5.1.5:1.0: cp210x converter detected
[495846.216898] usb 1-5.1.5: reset full-speed USB device number 8 using ehci-pci
[495846.292179] usb 1-5.1.5: cp210x converter now attached to ttyUSB0
[495846.292643] usb 1-5.1.5: cp210x converter now attached to ttyUSB1
The FreeRTOS serial console is available on the first USB TTY device. For example:
$ picocom –l /dev/ttyUSB0 –b 115200
To get access to the serial console of the i.MX 8M from a Windows host, install the device driver for the CP2105 USB-UART chip.
Building and Running the Hello World Demo
- Switch to the hello_world demo directory and run the build script:
$ cd boards/imx8m-som/demo_apps/hello_world/armgcc
$ ./build_release
$ ls -l release/hello_world.bin
-rwxrwxr-x. 1 dk dk 6868 Mar 23 14:42 release/hello_world.bin
Upload and launch the resultant binary on the i.MX 8M SOM:
u-boot=> tftp 7e0000 hello_world.bin && bootaux 7e0000
Observe output of the demo application on the UART3 interface available on the J5 mini-USB connector of the i.MX 8M SOM:
hello world.
Building and Running the RPMSG Demo
- From the top installation directory of i.MX 8MQuad Cortex-M4 Beta FreeRTOS BSP, switch to the rpmsg_lite_str_echo_rtos demo directory and run the build script:
$ cd boards/imx8m-som/multicore_examples/rpmsg_lite_str_echo_rtos/armgcc
$ ./build_release
$ ls -l release/rpmsg_lite_str_echo_rtos_imxcm4.bin
-rwxrwxr-x. 1 dk dk 16688 Mar 23 14:41 release/rpmsg_lite_str_echo_rtos_
imxcm4.bin
Reset the board if a FreeRTOS demo is already running on the board.
Upload and launch the resultant binary on the i.MX 8M SOM:
u-boot=> tftp 7e0000 rpmsg_lite_str_echo_rtos_imxcm4.bin && bootaux 7e0000
Observe output of the demo application on the UART3 interface available on the J5 mini-USB connector of the i.MX 8M SOM:
RPMSG String Echo FreeRTOS RTOS API Demo...
Nameservice sent, ready for incoming messages...