AnsweredAssumed Answered

Write binary file to Cortex M4 (i.MX6SX)

Question asked by Jan Šrámek on Dec 13, 2015
Latest reply on Nov 8, 2016 by Manuel Malagon

Hi all,

I am trying to write program to M4 core on my i.MX6SX. However so far I was unable to load any program.

Does anybody know what is wrong on following?

 

Prepare U-boot variables:

setenv fdt_file imx6sx-sdb-m4.dtb

setenv m4image m4_qspi.bin

setenv mmcboot 'run m4boot; echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;'

setenv mmcargs 'setenv bootargs no_console_suspend clk_ignore_unused uart_from_osc console=${console},${baudrate} root=${mmcroot}'

 

 

setenv spin_m4 'mw.l 0x7f8000 0x20008000;mw.l 0x7f8004 0x9;mw.l 0x7f8008 0xe7fee7fe;mw.l 0x20d8000'

setenv update_m4_from_sd 'if sf probe 1:0; then if run loadm4image; then setexpr fw_sz ${filesize} + 0xffff; setexpr fw_sz ${fw_sz} / 0x10000; setexpr fw_sz ${fw_sz} * 0x10000; sf erase 0x0 ${fw_sz}; sf write ${loadaddr} 0x0 ${filesize}; fi; fi'

setenv loadm4image 'fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4image}'

setenv m4boot 'sf probe 1:0; bootaux 0x78000000'

 

This is what I get after running update_m4_from_sd:

 

 

=> run update_m4_from_sd

SF: Detected N25Q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB

reading m4_qspi.bin

54948 bytes read in 29 ms (1.8 MiB/s)

Unknown command 'setexpr' - try 'help'

Unknown command 'setexpr' - try 'help'

Unknown command 'setexpr' - try 'help'

sf - SPI flash sub-system

 

 

Usage:

sf probe [[bus:]cs] [hz] [mode] - init flash device on given SPI bus

                                  and chip select

sf read addr offset len - read `len' bytes starting at

                                  `offset' to memory at `addr'

sf write addr offset len        - write `len' bytes from memory

                                  at `addr' to flash at `offset'

sf erase offset [+]len          - erase `len' bytes from `offset'

                                  `+len' round up `len' to block size

sf update addr offset len       - erase and write `len' bytes from memory

                                  at `addr' to flash at `offset'

SF: 54948 bytes @ 0x0 Written: OK

=>

I am confused at this point, because last line of output says "written, OK", but still there is error.

Why my U-Boot does not know setexpr?

 

Next issue is with booting M4.

setenv m4boot 'sf probe 1:0; bootaux 0x78000000'

 

setenv mmcboot 'run m4boot; echo Booting from mmc ...; run mmcargs;.........

 

 

 

 

=> boot

switch to partitions #0, OK

mmc2 is current device

switch to partitions #0, OK

mmc2 is current device

reading boot.scr

** Unable to read file boot.scr **

reading zImage

5979016 bytes read in 346 ms (16.5 MiB/s)

SF: Detected N25Q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB

Unknown command 'bootaux' - try 'help'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Booting from mmc ...

reading imx6sx-sdb-m4.dtb

47253 bytes read in 20 ms (2.3 MiB/s)

Kernel image @ 0x80800000 [ 0x000000 - 0x5b3b88 ]

## Flattened Device Tree blob at 88000000

   Booting using the fdt blob at 0x88000000

   Using Device Tree in place at 88000000, end 8800e894

 

 

Starting kernel ...

 

 

Booting Linux on physical CPU 0x0

Why my U-Boot again does not know this command even if I get it from working manual?

 

Thank you in advance

Jan

Outcomes