Search code examples
cortex-mgoogle-coralmendel-os

How to load bin to Cortex-M4 in Google Coral Dev


  • Currently I'm trying to load hello_world.bin to cortex m4 from u-boot in Google coral dev

What I've tried?

  • Bring up Coral dev target
  • SDK for i.MX8MQ
    • Download SDK from https://mcuxpresso.nxp.com/
    • For processor 'MIMX8MQ6xxxJZ' (auto selects Boards - EVK-MIMX8MQ)
    • Build hello_world.bin for Cortex M4 (TCM based). Uses UART2 in BOARD_InitBootPins
$ tar -xzf SDK_2.8.0_MIMX8MQ6xxxJZ.tar.gz
$ cd boards/evkmimx8mq/demo_apps/hello_world/armgcc
$ export ARMGCC_DIR=<path to>/gcc-arm-none-eabi-9-2020-q2-update/
$ export PATH=$PATH:<path to>/gcc-arm-none-eabi-9-2020-q2-update/bin
$ ./build_debug.sh 
$ ls debug/hello_world.bin 
  • Load hello_world.bin from u-boot
    • I've placed my bin in tftpboot location.
Hit any key to stop autoboot:  0 
u-boot=> tftp 0x7e0000 192.168.0.33:/tftpboot/coral/boot/hello_world.bin
Using ethernet@30be0000 device
TFTP from server 192.168.0.33; our IP address is 192.168.0.133
Filename '/tftpboot/coral/boot/hello_world.bin'.
Load address: 0x7e0000
Loading: ####
         2.3 MiB/s
done
Bytes transferred = 16700 (413c hex)
u-boot=> bootaux 0x7e0000
## Starting auxiliary core at 0x007E0000 ...
  • But I'm not able to see any output on the second terminal ttyUSB1
  • Expected output should be Hello World on the second terminal

What I've Observed

  • In Coral-Dev-Board-baseboard-schematic.pdf
    • According to Baseboard block diagram, UART2/3 is connected to MicroUSB via converter
      • But UART1(ttymxc0) is also available on micro USB
      • After kernel boot UART3(ttymxc0) is available on micro USB
    • But after kernel boot, I noticed UART3 to be available on second enumerated port
    • For example,
// On coral dev
root@wishful-zebra:~# ls -las /dev/ttymxc*
0 crw------- 1 mendel tty     207, 16 Aug 20 03:45 /dev/ttymxc0
0 crw-rw---- 1 root   dialout 207, 17 Aug 20 03:05 /dev/ttymxc1
0 crw-rw---- 1 root   dialout 207, 18 Aug 20 03:40 /dev/ttymxc2

root@wishful-zebra:~# stty -echo raw speed 115200 < /dev/ttymxc2
115200
root@wishful-zebra:~# echo "test" > /dev/ttymxc2 

// prints 'test' on /dev/ttyUSB1 host side
Welcome to minicom 2.7.1

OPTIONS: I18n 
Compiled on Aug 13 2017, 15:25:34.
Port /dev/ttyUSB1, 23:55:15

Press CTRL-A Z for help on special keys

test

Question

  • How to load firmware to Cortex M4 on Google Coral Dev?
  • Which i.MX SDK port to use for Google Coral Dev?
  • What are the UARTs available on the micro USB?
  • Which UART is used for Cortex M4 in Google Coral Dev

Solution

  • Here are the instructions to boot the imx8m M4 and run the TFLite Micro Hello World (outputs a sine wave) on it: https://coral.googlesource.com/mcuxpresso_sdk/+/refs/heads/master/boards/evkmimx8mq/demo_apps/hello_world_tflite/.

    you'll need to sync the project repo and rebuild linux-imx and uboot-imx.

    Output from the M4 core will be visible on the second UART that enumerated when you connected your serial port via USB.