0

I want to load a firmware on the imx7d M4 core. I am using a colibri imx7d-eMMC (MCIMX7D5EVM10S) SoC with a yocto linux build installed which include u-boot bootloader (details below). When I load the firmware on DDR memory (at address 0x80008000) everything works, but when the same firmware is loaded on TCM memory (at address 0x007f8000), even by using the procedure suggested in the answer here the system crashes and restarts.

If I load the firmware on the DDR using the following commands everything work as expected (the firmware starts and do its job):

ext4load mmc 0:2 0x80008000 /home/root/hello_world.elf
dcache flush
bootaux 0x80008000

However when I try to load the same firmware on the TCM memory, with the following commands, the system crashes and restarts.

Colibri iMX7 # ext4load mmc 0:2 0x80008000 /home/root/hello_world.elf
164124 bytes read in 7 ms (22.4 MiB/s)
Colibri iMX7 # cp.b 0x80008000 0x007f8000 0x20000
Colibri iMX7 # dcache flush
Colibri iMX7 # bootaux 0x7f8000
data abort
pc : [<bff7b1a0>]          lr : [<00000000>]
reloc pc : [<878001a0>]    lr : [<c7885000>]
sp : bdf6fe28  ip : 00a00040     fp : 00000002
r10: bdf8ef70  r9 : bdf78ea0     r8 : 00000000
r7 : 007f8034  r6 : 007f8054     r5 : 007f8000  r4 : 007f8000
r3 : 00000000  r2 : 1fdfffc0     r1 : 00000000  r0 : 007f8000
Flags: nzcv  IRQs on  FIQs on  Mode SVC_32
Code: e3a0d013 e169f00d e1a0e00f e1b0f00e (e24dd048)
Resetting CPU ...

resetting ...

After coping the firmware to TCM with: cp.b 0x80008000 0x007f8000 0x20000 I also checked if the firmware was there using: md.b 0x007f8000 40 and I see the same dump as: md.b 0x80008000 40. So I suppose the firmware was written correctly.

If I instead try to load the firmware directly to TCM, u-boot tells me that memory region is reserved:

Colibri iMX7 # ext4load mmc 0:2 0x007f8000 /home/root/hello_world.elf
** Reading file would overwrite reserved memory **
Failed to load '/home/root/hello_world.elf'

So at this point I do not understand where the error come from, any suggestions?

These are the u-boot info:

U-Boot 2022.07-6.6.0-devel+git.e092e3250270 (Jul 11 2022 - 13:42:58 +0000)

CPU:   Freescale i.MX7D rev1.3 1000 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 40C
Reset cause: POR
DRAM:  1 GiB
Core:  52 devices, 17 uclasses, devicetree: separate
PMIC:  RN5T567 LSIVER=0x01 OTPVER=0x0d
MMC:   FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Model: Toradex 0039 Colibri iMX7D 1GB V1.1B
Serial#: 15241330
SEC0:  RNG instantiated
Net:   eth0: ethernet@30be0000
Colibri iMX7 # bdinfo
boot_params = 0x80000100
DRAM bank   = 0x00000000
-> start    = 0x80000000
-> size     = 0x40000000
flashstart  = 0x00000000
flashsize   = 0x00000000
flashoffset = 0x00000000
baudrate    = 115200 bps
relocaddr   = 0xbff7b000
reloc off   = 0x3877b000
Build       = 32-bit
current eth = ethernet@30be0000
ethaddr     = 00:14:2d:e8:90:72
IP addr     = 192.168.10.2
fdt_blob    = 0xbdf6ffa0
new_fdt     = 0xbdf6ffa0
fdt_size    = 0x00008f00
lmb_dump_all:
 memory.cnt  = 0x1
 memory[0]      [0x80000000-0xbfffffff], 0x40000000 bytes flags: 0
 reserved.cnt  = 0x1
 reserved[0]    [0xbdf6bd58-0xbfffffff], 0x020942a8 bytes flags: 0
devicetree  = separate
arch_number = 0x00000000
TLB addr    = 0xbfff0000
irq_sp      = 0xbdf6ff90
sp start    = 0xbdf6ff80
Early malloc usage: 5fc / 2000

Thanks in advance

Francesco

3
  • Yes, I'm using the same u-boot.bin. u-boot.bin will be exeuted in the same address in both cases, but should be able to access and write both memories. Is this the case or I'm I missing something? Different story for hello_world.elf, I know that contains addresses where to place the sections, but these are relative or absolute addresses? Do I need to edit the elf to be used in different memories? Commented Mar 20, 2024 at 8:15
  • "cp.b 0x80008000 0x007f8000 0x20000" - You're trying to copy a block of 128K bytes from the main memory to the TCM. That causes two contradictory problems. (1) According to the U-Boot console dialog, your file is 164124 (or 0x2811c) bytes. The actual file is much longer than what you're copying. (2) More significantly, the TCM is only 64KB AFAIK for the i.MX7. Your copy (as well as your file) seems to be too long for the TCM. Bottom line: you're not copying enough (from the source), but you're also copying too much (to the destination). Commented Mar 21, 2024 at 6:55
  • you are right, writing to TCM was wrong in the first place. Now I will add a response with my conclusions. Commented Mar 28, 2024 at 14:41

1 Answer 1

0

After some further investigations, I post my conclusions on the topic.

Writing to the DDR with command: ext4load mmc 0:2 0x80008000 /home/root/hello_world.elf is already enough to load code on the TCM, so there is no need to do: ext4load mmc 0:2 0x007f8000 /home/root/hello_world.elf

This is because we are loading a ELF file: addresses where to store code are written inside the ELF file (and these are specified in the link script at build time).

So from what I understand address specified with ext4load is only for a memory buffer from where data finally is written on TCM.

Instead if we want to write a bin file then writing directly on TCM is the correct thing to do.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.