Bare metal code for Cortex M7 using Imx8mplus Verdin development (carrier) board

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Hello!

I can help you troubleshoot your GPIO configuration on the Verdin iMX8M Plus Cortex-M7. Based on the sources, there are several important considerations for running bare-metal code on the Cortex-M7.

Prerequisites and Setup

First, ensure you have the correct environment setup. According to the documentation, you need to(1):

  1. Set up the NXP SDK and GCC Toolchain as described in the MCUXpresso SDK setup
  2. Download the correct SDK: For Verdin iMX8M Plus you should download MIMX8ML8xxxKZ (which you’ve done correctly)(1)
  3. Use the recommended toolchain: The Arm GNU Toolchain AArch32 bare-metal target (arm-none-eabi)(1)

Memory Loading and Execution

Your TFTP loading approach needs adjustment. The proper way to load and execute Cortex-M7 firmware is(1):

> setenv load_cmd "ext4load mmc 0:2"  
> setenv cm_image "/home/root/hello_world.bin"  
> setenv cm_image_size 20000  
> setenv load_cm_image "${load_cmd} ${loadaddr} ${cm_image}"  
> setenv cm_boot "${load_cm_image}; cp.b ${loadaddr} 0x7e0000 ${cm_image_size}; dcache flush; bootaux 0x7e0000"  
> saveenv  
> run cm_boot  

(1)

The key difference is that the firmware should be loaded to 0x7e0000 and executed with bootaux rather than using go with your current address.

GPIO Pin Configuration Issues

There are known issues with certain GPIO pins on the Verdin iMX8M Plus when used from the Cortex-M7. Some pins may be pre-configured by U-Boot or have conflicts with other peripherals(2).

For SODIMM_141, you need to verify:

  1. Check the pin mapping in the Verdin iMX8M Plus datasheet
  2. Ensure no conflicts with other peripheral configurations
  3. Verify the correct GPIO bank and pin numbers

Recommended Approach

  1. Start with a working example: Use the Hello World example from the SDK first to verify your loading mechanism works(1)

  2. Build using the recommended method(1):

$ export ARMGCC_DIR=<PATH_TO_GCC_TOOLCHAIN>/<GCC_TOOLCHAIN_FOLDER>  
$ cd armgcc/   
$ ./build_debug.sh  
  1. Copy the binary to your device and load it properly(1):
$ scp debug/hello_world.bin root@<board-ip>:/home/root  
  1. Use the correct U-Boot commands as shown above rather than TFTP + go

Next Steps

I recommend starting with the Hello World example from the SDK to establish that your loading and execution mechanism works correctly, then gradually add your GPIO functionality. The issue is likely in the loading/execution method rather than your GPIO configuration.

Would you like me to guide you through setting up the Hello World example first to establish a working baseline?

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.