This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDS64GPEVM: Cannot set u-boot variable

Part Number: TMDS64GPEVM

Hi,


I am working on a AM64x GP EVM board.
I am using prebuilt image from ti: tisdk-default-image-am64xx-evm-08.02.00.23.wic

I stop at u-boot menu and try to set a new environment variable.
After saving changes, I make a reset command, and the environment variable I previously saved is gone.

U-Boot SPL 2021.01-g44a87e3ab8 (May 05 2022 - 17:43:41 +0000)
SYSFW ABI: 3.1 (firmware rev 0x0016 '22.1.1--v2022.01 (Terrific Llam')
SPL initial stack usage: 13392 bytes
Trying to boot from MMC2
Starting ATF on ARM64 core...

NOTICE:  BL31: v2.5(release):08.03.00.002-dirty
NOTICE:  BL31: Built : 17:38:37, May  5 2022

U-Boot SPL 2021.01-g44a87e3ab8 (May 05 2022 - 17:42:22 +0000)
SYSFW ABI: 3.1 (firmware rev 0x0016 '22.1.1--v2022.01 (Terrific Llam')
Trying to boot from MMC2


U-Boot 2021.01-g44a87e3ab8 (May 05 2022 - 17:42:22 +0000)

SoC:   AM64X SR1.0
Model: Texas Instruments AM642 EVM
Board: AM64-GPEVM rev E2
DRAM:  2 GiB
NAND:  0 MiB
MMC:   mmc@fa10000: 0, mmc@fa00000: 1
In:    serial@2800000
Out:   serial@2800000
Err:   serial@2800000
Net:   eth0: ethernet@8000000port@1
Hit any key to stop autoboot:  0
=> setenv aaa 1
=> saveenv
Saving Environment to FAT... OK
=> printenv aaa
aaa=1
=> reset
resetting ...

U-Boot SPL 2021.01-g44a87e3ab8 (May 05 2022 - 17:43:41 +0000)
SYSFW ABI: 3.1 (firmware rev 0x0016 '22.1.1--v2022.01 (Terrific Llam')
SPL initial stack usage: 13392 bytes
Trying to boot from MMC2
Starting ATF on ARM64 core...

NOTICE:  BL31: v2.5(release):08.03.00.002-dirty
NOTICE:  BL31: Built : 17:38:37, May  5 2022

U-Boot SPL 2021.01-g44a87e3ab8 (May 05 2022 - 17:42:22 +0000)
SYSFW ABI: 3.1 (firmware rev 0x0016 '22.1.1--v2022.01 (Terrific Llam')
Trying to boot from MMC2


U-Boot 2021.01-g44a87e3ab8 (May 05 2022 - 17:42:22 +0000)

SoC:   AM64X SR1.0
Model: Texas Instruments AM642 EVM
Board: AM64-GPEVM rev E2
DRAM:  2 GiB
NAND:  0 MiB
MMC:   mmc@fa10000: 0, mmc@fa00000: 1
In:    serial@2800000
Out:   serial@2800000
Err:   serial@2800000
Net:   eth0: ethernet@8000000port@1
Hit any key to stop autoboot:  0
=> printenv aaa
## Error: "aaa" not defined

The same error happens if i try to make changes from Linux using fw_setenv command.

I am aware of using the file uEnv.txt to make changes.
However this solution is not good for us because the file is loaded after some uboot variables are parsed, and we need our variables to be parsed earlier.

How can we make changes to u-boot variables from u-boot menu, and from Linux as well.

Thanks,
Ben s.

  • Hi Ben,

    Thanks for your query , I have assigned the thread to an expert,

    Regards

    Ashwani

  • Hello Ben,
    Here is an alternative for your reference.
    e2e.ti.com/.../3963627
    Best,
    -Hong

  • Hi Hong,

    We are using MMC/SD card.
    The post you suggested is about loading u-boot env from OSPI.
    It also mentions u-boot env is saved and loaded to FAT. However this doesn't work correctly.

    I run the commands:
    => setenv aaa 1
    => saveenv
    Saving Environment to FAT... OK

    When i do reboot I cannot see the variables i saved.
    Clearly there is a problem of loading the variables after i have saved them.

    I have made some tests, and i see the variables are saved to:
    /boot/uboot.env

    1. If u-boot env is saved to FAT, Why is the u-boot env not loaded from FAT after system reset?
    2. How can we support saving u-boot env variables and loading/access them during boot (for MMC/SD)?

    I also want to note that the u-boot environment  (for TI AM64x) seems really messy and complicated.
    It's very hard to understand what's going on in this u-boot environment. Why not simplify it?

    addr_fit=0x90000000
    arch=arm
    args_all=setenv optargs earlycon=ns16550a,mmio32,0x02800000 ${mtdparts}
    args_mmc=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype}
    args_usb=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype}
    baudrate=115200
    board=am64x
    board_name=am64x_gpevm
    board_rev=E2
    board_serial=0020
    board_software_revision=01
    boot=mmc
    boot_fdt=try
    boot_fit=0
    bootcmd=run findfdt; run envboot; run init_${boot}; run get_kern_${boot}; run get_fdt_${boot}; run run_kern
    bootdelay=2
    bootdir=/boot
    bootenvfile=uEnv.txt
    bootm_size=0x10000000
    bootpart=1:2
    bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
    console=ttyS2,115200n8
    cpu=armv8
    dfu_alt_info_emmc=rawemmc raw 0 0x800000 mmcpart 1;rootfs part 0 1 mmcpart 0;tiboot3.bin.raw raw 0x0 0x400 mmcpart 1;tispl.bin.raw raw 0x400 0x1000 mmcpart 1;u-boot.img.raw raw 0x1400 0x2000 mmcpart 1;u-env.raw raw 0x3400 0x100 mmcpart 1;sysfw.itb.raw raw 0x3600 0x800 mmcpart 1
    dfu_alt_info_mmc=boot part 1 1;rootfs part 1 2;tiboot3.bin fat 1 1;tispl.bin fat 1 1;u-boot.img fat 1 1;uEnv.txt fat 1 1;sysfw.itb fat 1 1
    dfu_alt_info_ospi=tiboot3.bin raw 0x0 0x080000;tispl.bin raw 0x080000 0x200000;u-boot.img raw 0x280000 0x400000;u-boot-env raw 0x680000 0x020000;sysfw.itb raw 0x6c0000 0x100000;rootfs raw 0x800000 0x3800000
    dfu_alt_info_ram=tispl.bin ram 0x80080000 0x200000;u-boot.img ram 0x81000000 0x400000
    dtboaddr=0x89000000
    envboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootscript; then run bootscript;else if run loadbootenv; then echo Loaded env from ${bootenvfile};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;fi;fi;
    eth1addr=70:f1:0f:76:ff:0d
    eth2addr=70:f1:0f:76:ff:0e
    ethaddr=f4:84:4c:f9:5a:65
    fdt_addr_r=0x88000000
    fdtaddr=0x88000000
    fdtcontroladdr=fdeceb80
    fileaddr=82000000
    filesize=3f3
    findfdt=if test $board_name = am64x_gpevm; then setenv fdtfile k3-am642-evm.dtb; fi; if test $board_name = am64x_skevm; then setenv fdtfile k3-am642-sk.dtb; fi;if test $fdtfile = undefined; then echo WARNING: Could not determine device tree to use; fi;
    finduuid=part uuid ${boot} ${bootpart} uuid
    get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
    get_fdt_usb=load usb ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
    get_fit_mmc=load mmc ${bootpart} ${addr_fit} ${bootdir}/${name_fit}
    get_fit_usb=load usb ${bootpart} ${addr_fit} ${bootdir}/${name_fit}
    get_kern_mmc=load mmc ${bootpart} ${loadaddr} ${bootdir}/${name_kern}
    get_kern_usb=load usb ${bootpart} ${loadaddr} ${bootdir}/${name_kern}
    get_overlay_mmc=fdt address ${fdtaddr};fdt resize 0x100000;for overlay in $name_overlays;do;load mmc ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && fdt apply ${dtboaddr};done;
    get_overlay_usb=fdt address ${fdtaddr};fdt resize 0x100000;for overlay in $name_overlays;do;load usb ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && fdt apply ${dtboaddr};done;
    get_overlaystring=for overlay in $name_overlays;do;setenv overlaystring ${overlaystring}'#'${overlay};done;
    importbootenv=echo Importing environment from mmc${mmcdev} ...; env import -t ${loadaddr} ${filesize}
    init_mmc=run args_all args_mmc
    init_usb=run args_all args_usb
    kernel_addr_r=0x82000000
    loadaddr=0x82000000
    loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
    loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr
    loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
    loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
    mmcboot=mmc dev ${mmcdev}; devnum=${mmcdev}; devtype=mmc; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadimage; then run args_mmc; if test ${boot_fit} -eq 1; then run run_fit; else run mmcloados;fi;fi;fi;
    mmcdev=1
    mmcloados=if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdtaddr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
    mmcrootfstype=ext4 rootwait
    mtdids=nor0=fc40000.spi.0
    mtdparts=mtdparts=fc40000.spi.0:512k(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),256k(ospi.env.backup),57088k@8m(ospi.rootfs),256k(ospi.phypattern);omap2-nand.0:512k(nand.tiboot3),2m(nand.tispl),4m(nand.u-boot),256k(nand.env),256k(nand.env.backup),-(nand.rootfs)
    name_fit=fitImage
    name_kern=Image
    partitions=name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
    pxefile_addr_r=0x80100000
    ramdisk_addr_r=0x88080000
    rd_spec=-
    rdaddr=0x88080000
    run_fit=bootm ${addr_fit}#${fdtfile}${overlaystring}
    run_kern=booti ${loadaddr} ${rd_spec} ${fdtaddr}
    scriptaddr=0x80000000
    serial#=0000000000000020
    soc=k3
    stderr=serial@2800000
    stdin=serial@2800000
    stdout=serial@2800000
    update_to_fit=setenv loadaddr ${addr_fit}; setenv bootfile ${name_fit}
    usbboot=setenv boot usb;setenv bootpart 0:2;usb start;run findfdt;run init_usb;run get_kern_usb;run get_fdt_usb;run run_kern
    vendor=ti

    Thanks,
    Ben S.

  • Hi Hong,

    I am still waiting for a reply.
    The thread you linked discusses OSPI and does not answer the questions I raised.

    Can you please comment?

    Thank you,
    Ben S.

  • Hi Ben,

    Please apply the below patch to file am64x_evm_a53_defconfig

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/am64x_5F00_evm_5F00_a53_5F00_defconfig.patch

    diff --git a/board-support/u-boot-2021.01+gitAUTOINC+44a87e3ab8-g44a87e3ab8/configs/am64x_evm_a53_defconfig b/board-support/u-boot-2021.01+gitAUTOINC+44a87e3ab8-g44a87e3ab8/configs/am64x_evm_a53_defconfig
    index 97095b0b6..90069197f 100644
    --- a/board-support/u-boot-2021.01+gitAUTOINC+44a87e3ab8-g44a87e3ab8/configs/am64x_evm_a53_defconfig
    +++ b/board-support/u-boot-2021.01+gitAUTOINC+44a87e3ab8-g44a87e3ab8/configs/am64x_evm_a53_defconfig
    @@ -73,9 +73,9 @@ CONFIG_OF_LIST="k3-am642-evm k3-am642-sk"
     CONFIG_MULTI_DTB_FIT=y
     CONFIG_SPL_MULTI_DTB_FIT=y
     CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y
    -CONFIG_ENV_IS_NOWHERE=y
     CONFIG_ENV_IS_IN_FAT=y
     CONFIG_ENV_FAT_DEVICE_AND_PART="1:1"
    +CONFIG_SPL_ENV_IS_NOWHERE=y
     CONFIG_NET_RANDOM_ETHADDR=y
     CONFIG_DM=y
     CONFIG_SPL_DM=y
    

    Then build the u-boot and replace the u-boot.img on the SD card with the updated u-boot.img. You then should be able to persistently save and load the U-Boot variables on reset. I have tested it on my side and works for me. It should work for you also.

    Regards,

    Prashant