also, I dont have this: “setenv mmcdev 0"
The boot button controls the SYS_BOOT2 pin on the processor which is normally high (boot button not pressed) and loads u-boot from the eMMC. Then, u-boot runs the scripts defined in it’s environment. Use printenv to see the env settings. If you are using minicom, for your console, press ctrl a w to enable line wrap (or the equivalent command for putty, etc). enter the printenv command and then scroll up to see the bootcmd which should look something like this:
bootcmd=gpio set 53; i2c mw 0x24 1 0x3e; run findfdt; mmc dev 0; if mmc rescan ; then echo micro SD card found;setenv mmcdev 0;else echo No micro SD card found, setting mmcdev to 1;setenv mmcdev 1;fi;setenv bootpart ${mmcdev}:2;mmc dev ${mmcdev}; if mmc rescan; then gpio set 54; echo SD/MMC found on device ${mmcdev};if run loadbootenv; then echo Loaded environment from ${bootenv};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd …;run uenvcmd;fi;gpio set 55; if run loaduimage; then gpio set 56; run loadfdt;run mmcboot;fi;fi;
While this looks complicated, it really isn’t. It starts of by turning on an LED, runs a command findfdt which is defined as:
findfdt=if test $board_name = A335BONE; then setenv fdtfile am335x-bone.dtb; fi; if test $board_name = A335BNLT; then setenv fdtfile am335x-boneblack.dtb; fi; if test $board_name = A33515BB; then setenv fdtfile am335x-evm.dtb; fi; if test $board_name = A335X_SK; then setenv fdtfile am335x-evmsk.dtb; fi
Which just sets a variable “fdtfile” to " am335x-boneblack.dtb”
To prove this, enter these commands in u-boot:
run findfdt
echo $findfdt
Continuing with bootcmd, it test to see if the SDCard is installed (if mmc rescan) and if it is, “mmcdev” is set to “0” (BTW, eMMC is mmcdev 1).
Reading further, the script then runs loadbootenv, which loads the uEnv.txt, which it loads from SDCard if one is installed ($mmcdev = 0) or it loads from eMMC if no SDCard is installed ($mmcdev = 1).
I’ll leave your to read the remainder of the bootcmd script.
BTW, I believe this behavior is baked into u-boot and you have to change u-boot source code to change this behavior. You can only modify u-boot behavior after uEnv.txt is loaded.
Also, when you press the load button, u-boot is read from the SDCard. When the load button isn’t pressed, u-boot is read from the eMMC. So, to answer your question, if you press the boot button, it will always boot from the SDCard.
Regards,
John