I’m having an issue with creating a custom bootloader for a IMX8 QM 1.1C on the eval board.
I modified the helloworld mek demo on the M4 core 0 to print “Hello!” repeatedly. If I install the 5.4.0 reference image and load the bin file at boot using the following command it works fine:
replacing the bootloader in the root directory of my image and using the easy installer OR flashing using the uuu.exe results in the M4 core running for about a second (half a dozen “hello!”).
I’m guessing something is happening with the other cores on boot that interferes. Have i made any mistakes with u-boot or can I delay the M4 cores from booting until a few seconds after linux boots?
This sounds very similar to a problem my colleague had - the same symptom - which was due to a peripheral sharing a clock signal with the M4. When linux was booted, the peripheral was disabled, and the clock with it.
BUT this was on an MX7 device - yours may be different. AND my colleague is not at his desk for a few days and I don’t remember the details. I have a feeling it was the SPI device.
I’m not so sure I could be that as all of this happens before I boot linux. At the moment if i use the following post as a guide:
I get this at boot:
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
1182 bytes read in 13 ms (87.9 KiB/s)
## Executing script at 83100000
** Reading file would overwrite reserved memory **
## Error: "bootcmd_run" not defined
SCRIPT FAILED: continuing...
Apalis iMX8 #
Its a good indication that there is a missed assignment inside boot.scr.
Did you have a look at the boot.scr file inside the Toradex Easy Installer?
There you can see how Toardex dealt with it.
Would it be possible that you to attach your boot.scr here?
I haven’t modified the boot.scr from the reference image, it is still:
#
# Copyright 2020 Toradex
#
# TorizonCore boot script.
if test -z "${altbootcmd}"
then
env set altbootcmd 'env set rollback 1; run bootcmd'
env save
fi
if test "${rollback}" = "1" && test "${upgrade_available}" = "1"
then
# Make sure to reset upgrade_available to avoid unnecessary wear
# Note this also makes rollback permanent. aktualizr will reset rollback
# when a new (hopefully better) update comes in.
env set upgrade_available 0
env save
fi
# save default U-Boot devicetree file to use in a rollback situation
env set fdtfile2 "${fdtfile}"
if test ${devtype} != ubi
then
if test -n "${loadaddr}"
then
ext4load ${devtype} ${devnum}:1 ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize}
else
ext4load ${devtype} ${devnum}:1 ${scriptaddr} /boot/loader/uEnv.txt; env import -t ${scriptaddr} ${filesize}
fi
else
ubifsmount ${devtype}${devnum}:rootfs && load ${devtype} ${devnum}:0 ${loadaddr} /boot/loader/uEnv.txt; env import -t ${loadaddr} ${filesize}
fi
run bootcmd_run
The uEnv.txt, again isn’t modified from stock.
kernel_image=/ostree/torizon-a365050f574bcc7d045a18af3273d04163ad1c0752f3369effcba07d8523a691/vmlinuz-5.4.129-5.4.0+git.cb88cc157bfb
ramdisk_image=/ostree/torizon-a365050f574bcc7d045a18af3273d04163ad1c0752f3369effcba07d8523a691/initramfs-5.4.129-5.4.0+git.cb88cc157bfb.img
fdtdir=/ostree/torizon-a365050f574bcc7d045a18af3273d04163ad1c0752f3369effcba07d8523a691/dtb
bootargs=quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/a365050f574bcc7d045a18af3273d04163ad1c0752f3369effcba07d8523a691/0
kernel_image_type=Image.gz
overlays_file="overlays.txt"
otaroot=1
set_bootargs=if test ${devtype} != ubi; then \
# Load commands for regular block devices \
env set bootcmd_args env set bootargs ${defargs} root=LABEL=otaroot rootfstype=ext4 ${bootargs} ${tdxargs}; \
else \
# Load commands for raw NAND devices \
env set bootcmd_args env set bootargs ${defargs} ubi.mtd=ubi root=/dev/ubi0_0 rootfstype=ubifs ubi.fm_autoconvert=1 ${bootargs} ${tdxargs}; \
fi || true
set_kernel_load_addr=if test ${kernel_image_type} = "Image.gz"; then \
env set kernel_addr_load ${loadaddr}; \
env set bootcmd_unzip_k 'unzip $kernel_addr_load $kernel_addr_r'; \
else \
env set kernel_addr_load ${kernel_addr_r}; \
env set bootcmd_unzip_k ';'; \
fi || true
load_overlay=load ${devtype} ${devnum}:${otaroot} ${loadaddr} /boot${fdtdir}/${overlays_file}; env import -t ${loadaddr} ${filesize}
apply_overlays=fdt addr ${fdt_addr_r} && fdt resize 0x20000 && \
for overlay_file in ${fdt_overlays}; do \
echo "Applying Overlay: ${overlay_file}" && \
load ${devtype} ${devnum}:${otaroot} ${loadaddr} /boot${fdtdir}/overlays/${overlay_file} && fdt apply ${loadaddr}; \
done;
bootcmd_load_k=load ${devtype} ${devnum}:${otaroot} ${kernel_addr_load} "/boot"${kernel_image}
bootcmd_load_r=load ${devtype} ${devnum}:${otaroot} ${ramdisk_addr_r} "/boot"${ramdisk_image}; env set ramdisk_size ${filesize}
# check kernel_image2 to avoid booting from other then default emmc in case of
# bootlimit is reached and there is no other deployed image
check_rollback_needed=if test -n "${kernel_image2}" && test "${rollback}" = "1"; then \
echo "Rollback enabled. Booting previously deployed version."; \
env set kernel_image ${kernel_image2}; \
env set ramdisk_image ${ramdisk_image2}; \
env set bootargs ${bootargs2}; \
env set fdtdir ${fdtdir2}; \
env set fdt_file ${fdt_file2}; \
env set fdtfile ${fdtfile2}; \
fi || true
set_fdt_path=if test -n "${fdtdir}"; then \
env set fdt_path /boot${fdtdir}/${fdtfile}; \
else \
env set fdt_path /boot${fdt_file}; \
fi || true
bootcmd_dtb=load ${devtype} ${devnum}:${otaroot} ${fdt_addr_r} ${fdt_path}; \
if test ${skip_fdt_overlays} != 1; then \
if test -e ${devtype} ${devnum}:${otaroot} /boot${fdtdir}/${overlays_file}; then \
run load_overlay && run apply_overlays || true; \
fi || true; \
fi || true
set_bootargs_custom=if test -n "${fdt_overlays}"; then \
for overlay_file in ${fdt_overlays}; do \
if test "${overlay_file}" = "custom-kargs_overlay.dtbo"; then \
if fdt get value custom_kargs /chosen/ bootargs_custom; then \
env set bootargs ${bootargs} ${custom_kargs}; \
fi; \
fi; \
done; \
fi || true
board_fixups=if test "${board}" = "verdin-imx8mm"; then \
if test "${fdtfile}" = "imx8mm-verdin-nonwifi-v1.1-dahlia.dtb"; then \
env set fdtfile imx8mm-verdin-nonwifi-dahlia.dtb; \
elif test "${fdtfile}" = "imx8mm-verdin-nonwifi-v1.1-dev.dtb"; then \
env set fdtfile imx8mm-verdin-nonwifi-dev.dtb; \
elif test "${fdtfile}" = "imx8mm-verdin-wifi-v1.1-dahlia.dtb"; then \
env set fdtfile imx8mm-verdin-wifi-dahlia.dtb; \
elif test "${fdtfile}" = "imx8mm-verdin-wifi-v1.1-dev.dtb"; then \
env set fdtfile imx8mm-verdin-wifi-dev.dtb; \
fi; \
fi || true
nand_fixups=if test ${devtype} = ubi; then \
setexpr kernel_image sub "/boot" "" ${kernel_image}; \
setexpr ramdisk_image sub "/boot" "" ${ramdisk_image}; \
setexpr fdtdir sub "/boot" "" ${fdtdir}; \
if test -n "${kernel_image2}"; then \
setexpr kernel_image2 sub "/boot" "" ${kernel_image2}; \
setexpr ramdisk_image2 sub "/boot" "" ${ramdisk_image2}; \
setexpr fdtdir2 sub "/boot" "" ${fdtdir2}; \
fi || true; \
fi || true
bootcmd_boot=booti ${kernel_addr_r} ${ramdisk_addr_r}:${ramdisk_size} ${fdt_addr_r}
bootcmd_run=run board_fixups && run nand_fixups && run check_rollback_needed && run set_bootargs && run set_fdt_path && \
run bootcmd_dtb && run bootcmd_args && run set_bootargs_custom && run set_kernel_load_addr && \
run bootcmd_load_k && run bootcmd_unzip_k && run bootcmd_load_r && run bootcmd_boot
I don’t understand the sudden change in behaviour. Perhaps I can ask a different question; does anyone at torizon have a sound method to get the M4 cores on a imx8 to run automatically at boot? At the moment that’s all i’m trying to achieve. (I’m guessing i might be able to boot them from SD by modifying the boot script.)
I’m going to state that its very disconcerting that the provider of an embedded solution doesn’t seem to have comprehensive knowledge of their own system. The iMX8 is attractive to us for the heterogeneity, that’s the main selling point of the chip and Toradex seems to not be directly supporting that feature.