Using Cortex-M4 from Linux |
The Emcraft-provided U-Boot and startup scripts load a pre-built FreeRTOS demo to the Cortex-M4 processor core of the i.MX 8M. The demo implements a virtual serial port that echoes all received data back to the originator, and allows testing communication with the Cortex-M4 in real-time. The following commands in the U-Boot startup scripts load the FreeRTOS binary to the Cortex-M4 processor and start it: fatload mmc 1:1 0x7e0000 imx8mq_m4_TCM_rpmsg_lite_str_echo_rtos.bin; bootaux 0x7e0000 On the Linux side, the following kernel driver module provides an API to the FreeRTOS demo: The driver module is loaded at Linux startup by the systemd module loader service, and creates a new serial device that can be accessed via the /dev/ttyRPMSG30 device node file. User space applications can access this serial device as a regular serial port, sending requests and receiving echo back from the Cortex-M4. The Emcraft i.MX 8M GUI demo provides an illustration of how the Linux device driver can be used to communicate to FreeRTOS code running on the Cortex-M4. Browse to the Cortex-M4 icon in the GUI demo: and then press the icon in order to switch to the sub-ordinate interface. The GUI sends a text string with an incrementing counter (ping M4 <idx>) to the Cortex-M4 and validates that the Cortex-M4 returns the exact same string back. This "ping-pong" operation is performed at a 1HZ frequency (once per second). |