Write binary file to Cortex M4 (i.MX6SX)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Write binary file to Cortex M4 (i.MX6SX)

Jump to solution
2,853 Views
janšrámek
Contributor I

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

Labels (1)
Tags (2)
0 Kudos
1 Solution
1,286 Views
alejandrolozan1
NXP Employee
NXP Employee

It seems that you are using the community BSP. Please use the FSL/NXP BSP instead.

/Alejandro

View solution in original post

0 Kudos
4 Replies
1,286 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi which bsp verion are you using?

Please check with the help command tha thte setexpre command exists as well as the bootaux command.

Best Regards,

Alejandro

0 Kudos
1,286 Views
janšrámek
Contributor I

Hi Alejandro,

I'm using 1.8 Fido.

U-Boot 2015.04+fslc+g5d9ffd2 (Nov 10 2015 - 00:45:50)

CPU:   Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz)

CPU:   Extended Commercial temperature grade (-20C to 105C) at 29C

Reset cause: POR

Board: MX6SX SABRE SDB

I2C:   ready

DRAM:  1 GiB

PMIC:  PFUZE100 ID=0x11

MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2

*** Warning - bad CRC, using default environment

In:    serial

Out:   serial

Err:   serial

Net:   FEC [PRIME]

Hit any key to stop autoboot:  0

=> setexpr

Unknown command 'setexpr' - try 'help'

=>

Unknown command 'setexpr' - try 'help'

=> bootaux

Unknown command 'bootaux' - try 'help'

=>

Unknown command 'bootaux' - try 'help'

=>

Unknown command 'bootaux' - try 'help'

=> help

?       - alias for 'help'

base    - print or set address offset

bdinfo  - print Board Info structure

boot    - boot default, i.e., run 'bootcmd'

bootd   - boot default, i.e., run 'bootcmd'

bootm   - boot application image from memory

bootp   - boot image via network using BOOTP/TFTP protocol

bootz   - boot Linux zImage image from memory

clocks  - display clocks

cmp     - memory compare

coninfo - print console devices and information

cp      - memory copy

cpu     - Multiprocessor CPU boot manipulation and release

crc32   - checksum calculation

dcache  - enable or disable data cache

dhcp    - boot image via network using DHCP/TFTP protocol

dm      - Driver model low level access

echo    - echo args to console

editenv - edit environment variable

env     - environment handling commands

erase   - erase FLASH memory

exit    - exit script

ext2load- load binary file from a Ext2 filesystem

ext2ls  - list files in a directory (default /)

false   - do nothing, unsuccessfully

fatinfo - print information about filesystem

fatload - load binary file from a dos filesystem

fatls   - list files in a directory (default /)

fatsize - determine a file's size

fdt     - flattened device tree utility commands

flinfo  - print FLASH memory information

fuse    - Fuse sub-system

go      - start application at address 'addr'

help    - print command description/usage

i2c     - I2C sub-system

icache  - enable or disable instruction cache

iminfo  - print header information for application image

imxtract- extract a part of a multi-image

itest   - return true/false on integer compare

loadb   - load binary file over serial line (kermit mode)

loads   - load S-Record file over serial line

loadx   - load binary file over serial line (xmodem mode)

loady   - load binary file over serial line (ymodem mode)

loop    - infinite loop on address range

md      - memory display

mdio    - MDIO utility commands

mii     - MII utility commands

mm      - memory modify (auto-incrementing address)

mmc     - MMC sub system

mmcinfo - display MMC info

mw      - memory write (fill)

nfs     - boot image via network using NFS protocol

nm      - memory modify (constant address)

pci     - list and access PCI Configuration Space

ping    - send ICMP ECHO_REQUEST to network host

pmic    - PMIC

printenv- print environment variables

protect - enable or disable FLASH write protection

reset   - Perform RESET of the CPU

run     - run commands in an environment variable

saveenv - save environment variables to persistent storage

setenv  - set environment variables

sf      - SPI flash sub-system

showvar - print local hushshell variables

sleep   - delay execution for some time

source  - run script from memory

test    - minimal test like /bin/sh

tftpboot- boot image via network using TFTP protocol

time    - run commands and summarize execution time

true    - do nothing, successfully

usb     - USB sub-system

usbboot - boot from USB device

version - print monitor, compiler and linker version

=>

I don't see them in help.

BR

Jan

0 Kudos
1,287 Views
alejandrolozan1
NXP Employee
NXP Employee

It seems that you are using the community BSP. Please use the FSL/NXP BSP instead.

/Alejandro

0 Kudos
1,286 Views
m4l490n
Contributor V

alejandrolozano‌ what is the difference between the u-boot cloned from $ git clone git://git.denx.de/u-boot.git mentioned in u-boot on the i.MX6 sabre sd platform in a few commands  and the one cloned from Freescale git repo cloned with $ git clone git://git.freescale.com/imx/uboot-imx.git

I ask because if I try to use the first one then bootaux is not found but it is found in the second one. It's confusing because I think there should be just one u-boot for Freescale boards.

Thanks!!

0 Kudos