Skip to content

Instantly share code, notes, and snippets.

@artizirk
Created June 3, 2022 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artizirk/5d329ad072f95745a4a16daf195ea613 to your computer and use it in GitHub Desktop.
Save artizirk/5d329ad072f95745a4a16daf195ea613 to your computer and use it in GitHub Desktop.
imx8mn boot cortex-m7 core without bootaux

imx8mn has an extra cortex-m7 core. you have few options for starting it

  1. use downstream imx-atf and mainline u-boot bootaux command
  2. use upstream atf and poke at the registers manually

For option 1 you can follow the AN5317 app note and things should work out fine

fatload mmc 1:1 0x48000000 hello.bin
cp.b 0x48000000 0x7e0000 $filesize
bootaux 0x7e0000

All upstream code needs some manual register poking

# SRC_M7RCR
# mainline atf returns 000000ab
# downstream imx-atf returns 000000a8
md.l 0x3039000C 1

# IOMUXC_GPR_GPR22, CM7_CPUWAIT[0] should be high and indicate that
# M7 cpu is sleeping on CPUWAIT?
# value should be 400e0001
md.l 0x30340058 1

# Clear M7 core reset via System Reset Controller (SRC) register
# SRC_M7RCR bit SW_M7C_NON_SCLR_RST[0]
# This allows reset to finish til CPUWAIT
# after this value should be 000000a8
mw.l 0x3039000C 000000aa
fatload mmc 1:1 0x48000000 hello.bin
# Copy the file to M7 internal TCIM  (128KB)
cp.b 0x48000000 0x7e0000 $filesize

# clear IOMUXC_GPR_GPR22 CM7_CPUWAIT[0] bit (is this a clock?)
# For some reason this step is not documented in the AN5317 appnote
mw.l 0x30340058 400e0000
# M7 should boot now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment