Introduction
i.MX6SoloX and i.MX7D SoC contain embedded Cortex-M4 core. In a common use-case, this core runs a firmware loaded by u-boot bootloader. If you however want to debug your application for the Cortex-M4 core, you may need to reload the firmware in the secondary core without restarting Linux running on the Cortex-A core. For this reason, a tool was created: imx-m4fwloader.
The project is released as open source under GPL-2.0 licence here: GitHub - NXPmicro/imx-m4fwloader: Tool for loading firmware to M4 core on i.MX6SX and 7D
I hope this tool will help to bring up faster your application for i.MX6SoloX and i.MX7D SoC!
How to use this
- Either use the pre-built version
- Or use the environment provided to you by Yocto:
- For example:
source /opt/poky/1.8/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi$CC m4fwloader.c -o m4fwloader- You get m4fwloader binary...
- Then you need to build your M4 application and link it to some address. (e.g 0x00910000, try: https://github.com/EmbeddedRPC/erpc-imx-demos/tree/master/MCU/example_rpmsg)
- Load it using m4fwloader:
./m4fwloader myapp.bin 0x00910000 - Optionally use --verbose parameter to see what is written to each registers
- Warning: Use this tool for debugging only, since it accesses directly the registers from the user space and requires therefore root priviledges!
- You have been warned... :-)
- Optionally, you can trigger an interrupt using message unit (MU) to the M4 core to get RPMsg started - this is normally done by Linux Kernel during startup:
./m4fwloader kick 0 - Whole usage is here:
m4fwloader [filename.bin] [0xLOADADDR] [--verbose] # loads new firmware- or:
m4fwloader stop # holds the auxiliary core in reset - or:
m4fwloader start # releases the auxiliary core from reset - or:
m4fwloader kick [n] # triggers interrupt on RPMsg virtqueue n