Page 1 of 1

SAMA5D27-SOM1-EK1 Boot From SDMMC1

Posted: Sat Feb 17, 2018 3:36 am
by sirdan
Hello,

We are using the SAMA5D27-SOM1-EK1 development board with buildroot. We have the board booting properly from SDMMC0 but have a need to have it boot from the micro SD slot SDMMC1 (J14). It was pointed out to us by user thackerp that we have to reconfigure and rebuild the bootstrap and U-Boot images, and modify the U-Boot environment to look for the kernel, device tree and root file system on SDMMC1.

We are able to make buildroot rebuild the AT91-Bootstrap and U-Boot by deleting the .stamp_built files.

Now we need a little help on what files to edit to make the SAMA5D27-SOM1-EK1 Boot From SDMMC1. I had a look in both AT91 bootstrap and U-Boot but can't find where we might make changes. Can anyone help us with this please?

Thank you,
Dan

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Posted: Mon Feb 19, 2018 5:44 pm
by thackerp
sirdan wrote:
Sat Feb 17, 2018 3:36 am
Hello,

We are using the SAMA5D27-SOM1-EK1 development board with buildroot. We have the board booting properly from SDMMC0 but have a need to have it boot from the micro SD slot SDMMC1 (J14). It was pointed out to us by user thackerp that we have to reconfigure and rebuild the bootstrap and U-Boot images, and modify the U-Boot environment to look for the kernel, device tree and root file system on SDMMC1.

We are able to make buildroot rebuild the AT91-Bootstrap and U-Boot by deleting the .stamp_built files.

Now we need a little help on what files to edit to make the SAMA5D27-SOM1-EK1 Boot From SDMMC1. I had a look in both AT91 bootstrap and U-Boot but can't find where we might make changes. Can anyone help us with this please?

Thank you,
Dan

These are instructions for building stand-alone, modify as necessary for Buildroot:

For the at91bootstrap:
- make sama5d27_som1_ek_mmc_defconfig
- make menuconfig
- memory selection
- SD Card Configuration
- SD Host Controller Select
- On SDHC1
Build as usual

For U-Boot:
- make sama5d27_som1_ek_mmc_defconfig

Edit the include/configs/sama5d27_som1_ek.h file.
Modify: #define FAT_ENV_DEVICE_AND_PART "0"
to: #define FAT_ENV_DEVICE_AND_PART "1"

Optionally, modify the default bootargs and bootcmd to use mmc 0 instead of mmc1. This can also be done in the environment file, or manually from the U-Boot command line.

Then build, deploy and boot as normal.

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Posted: Tue Feb 20, 2018 9:37 am
by sirdan
You Rock, Thank you!

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Posted: Tue Feb 20, 2018 11:27 pm
by sirdan
Hello,

I have gotten a bit further following thackerp's instructions. AT91Bootstrap now loads U-Boot off of SDMMC1 but there is still a reference to SDMMC0 that I cannot find.

** Bad device mmc 0 **
So it cannot load at91-sama5d27_som1_ek.dtb

It dies on Starting kernel...

Code: Select all

AT91Bootstrap 3.8.9 (Tue Feb 20 09:32:00 PST 2018)

SD/MMC: Image: Read file u-boot.bin to 0x23f00000
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image
<debug_uart> 

U-Boot 2017.03-linux4sam_5.7 (Feb 20 2018 - 11:06:42 -0800)

CPU: SAMA5D27 1G bits DDR2 SDRAM
Crystal frequency:       24 MHz
CPU clock        :      492 MHz
Master clock     :      164 MHz
DRAM:  128 MiB
MMC:   sdio-host@a0000000: 0, sdio-host@b0000000: 1
reading uboot.env

In:    serial@f8020000
Out:   serial@f8020000
Err:   serial@f8020000
Net:   eth0: ethernet@f8008000
Hit any key to stop autoboot:  0 
mmc_init: -110, time 5
** Bad device mmc 0 **
mmc_init: -110, time 6
** Bad device mmc 0 **
## Flattened Device Tree blob at 21000000
   Booting using the fdt blob at 0x21000000
   Loading Device Tree to 27b55000, end 27b5fcd2 ... OK

Starting kernel ...

prefetch abort
pc : [<4400092c>]          lr : [<22003228>]
sp : 2238eae0  ip : 00000000     fp : 2238dafc
r10: 20008000  r9 : 4400465c     r8 : 44000928
r7 : 00000000  r6 : 4400465c     r5 : 2238dad4  r4 : ffffffff
r3 : 00000001  r2 : 4438db14     r1 : 00000000  r0 : 220045c8
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

The error msg

Code: Select all

** Unable to read "uboot.env" from mmc1:1 **
Using default environment
Doesn't seem to be an issue, it gives the same error msg when booting from SDMMC0 with stock sama5d27_som1_ek_mmc_defconfig

Code: Select all

** Unable to read "uboot.env" from mmc0:1 **v
Using default environment
I put all the changes back and can boot from SDMMC0 again.

Code: Select all


AT91Bootstrap 3.8.9 (Tue Feb 20 11:38:59 PST 2018)

SD/MMC: Image: Read file u-boot.bin to 0x23f00000
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image
<debug_uart> 

U-Boot 2017.03-linux4sam_5.7 (Feb 20 2018 - 11:39:25 -0800)

CPU: SAMA5D27 1G bits DDR2 SDRAM
Crystal frequency:       24 MHz
CPU clock        :      492 MHz
Master clock     :      164 MHz
DRAM:  128 MiB
MMC:   sdio-host@a0000000: 0, sdio-host@b0000000: 1
reading uboot.env

** Unable to read "uboot.env" from mmc0:1 **
Using default environment

In:    serial@f8020000
Out:   serial@f8020000
Err:   serial@f8020000
Net:   eth0: ethernet@f8008000
Hit any key to stop autoboot:  0 
[b]reading at91-sama5d27_som1_ek.dtb[/b]
31955 bytes read in 19 ms (1.6 MiB/s)
reading zImage
3726080 bytes read in 237 ms (15 MiB/s)
## Flattened Device Tree blob at 21000000
   Booting using the fdt blob at 0x21000000
   Loading Device Tree to 27b56000, end 27b60cd2 ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0

I have searched through the u-boot config files and found references to #define FAT_ENV_DEVICE_AND_PART "0" that pertain to sama5

Code: Select all

./include/configs/at91-sama5_common.h:#define FAT_ENV_DEVICE_AND_PART   "0"
./include/configs/sama5d27_som1_ek.h:#define FAT_ENV_DEVICE_AND_PART    "0"
./include/configs/sama5d2_xplained.h:#undef FAT_ENV_DEVICE_AND_PART
./include/configs/sama5d2_xplained.h:#define FAT_ENV_DEVICE_AND_PART    "1"
I changed them to FAT_ENV_DEVICE_AND_PART "1" , but I still get the ** Bad device mmc 0 ** error message.

Can anyone shed some light on this?

Thank you,
Dan

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Posted: Wed Feb 21, 2018 10:49 am
by sirdan
Success!

I should have paid more attention to what user thackerp told me.

For the at91bootstrap:
- make sama5d27_som1_ek_mmc_defconfig
- make menuconfig
- memory selection
- SD Card Configuration
- SD Host Controller Select
- On SDHC1
Build as usual

For U-Boot:
- make sama5d27_som1_ek_mmc_defconfig

Edit the include/configs/sama5d27_som1_ek.h file.
Modify: #define FAT_ENV_DEVICE_AND_PART "0"
to: #define FAT_ENV_DEVICE_AND_PART "1"
Optionally, modify the default bootargs and bootcmd to use mmc 0 instead of mmc1.

To clarify his instructions; The include/configs/sama5d27_som1_ek.h file needs the following changes.

FROM:

Code: Select all


#define FAT_ENV_DEVICE_AND_PART	"0"
#define FAT_ENV_FILE		"uboot.env"
#define CONFIG_ENV_SIZE		0x4000
/* bootstrap + u-boot + env in sd card */
#define CONFIG_BOOTCOMMAND	"fatload mmc 0:1 0x21000000 at91-sama5d27_som1_ek.dtb; " \
				"fatload mmc 0:1 0x22000000 zImage; " \
				"bootz 0x22000000 - 0x21000000"
#undef CONFIG_BOOTARGS
#define CONFIG_BOOTARGS \
	"console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rw rootwait"
#endif


TO:

Code: Select all


#define FAT_ENV_DEVICE_AND_PART	"1"
#define FAT_ENV_FILE		"uboot.env"
#define CONFIG_ENV_SIZE		0x4000
/* bootstrap + u-boot + env in sd card */
#define CONFIG_BOOTCOMMAND	"fatload mmc 1:1 0x21000000 at91-sama5d27_som1_ek.dtb; " \
				"fatload mmc 1:1 0x22000000 zImage; " \
				"bootz 0x22000000 - 0x21000000"
#undef CONFIG_BOOTARGS
#define CONFIG_BOOTARGS \
	"console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait"
#endif

Thank you for your help thackerp! Maybe this will help someone else.

This support ticket can be closed :)

Dan

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Posted: Wed Jul 11, 2018 9:44 pm
by tmoSL
This ticket is very helpful as I'm trying to boot completely from MMC 1. Just to clarify the case described in this ticket. In your case, is your AT91Bootstrap in MMC0, or MMC1?

Thanks.

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Posted: Sat Sep 29, 2018 5:04 am
by sirdan
tmoSL wrote:
Wed Jul 11, 2018 9:44 pm
This ticket is very helpful as I'm trying to boot completely from MMC 1. Just to clarify the case described in this ticket. In your case, is your AT91Bootstrap in MMC0, or MMC1?

Thanks.
tmoSL

Sorry I missed your question. We have the board booting from MMC1, with nothing plugged into MMC0.

Regards,
Dan

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Posted: Tue Nov 20, 2018 11:13 am
by Trilok
Hi everyone,

I have similar issue, I'm unable to boot complete image (U-Boot + Linux)from SD card(SDHC1) or EMMC(SDHC0).

Log:

AT91Bootstrap 3.8.11-00004-g6a09dc4 (Tue Nov 20 13:34:02 IST 2018)

SD/MMC: Image: Read file u-boot.bin to 0x23f00000
MMC: ADMA supported
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
*** FATFS: f_open, filename: [u-boot.bin]: error
SD/MMC: Failed to load image

Sometimes in Log I'm getting as Card is not inserted.

If BootROM is able to load the Boot.bin from SD card and execute, why can't AT91Bootstrap is not able to load the U-boot.bin from the SD card and execute. Please help me out in this regard, I'm struggling from last two days.

Board used : Costume made(SAMA5D27 SOM)
BootStrap : AT91Bootstrap 3.8.11-00004-g6a09dc4


Hoping for quick response

Thanks/Regards

Trilok

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Posted: Wed Nov 21, 2018 3:12 am
by blue_z
Trilok wrote: I have similar issue, I'm unable to boot complete image (U-Boot + Linux)from SD card(SDHC1) or EMMC(SDHC0).
No, you do not have a "similar issue" and are posting to the wrong topic.
Seems like you only read the title of this topic, and ignored the first post.
Your issue seems more like the crux of this topic with the same error message and ambiguous circumstances.

Trilok wrote: If BootROM is able to load the Boot.bin from SD card and execute, why can't AT91Bootstrap is not able to load the U-boot.bin from the SD card and execute.
The boot program in ROM has a (selectable) pre-ordered sequence of storage devices from which it will try to boot.
AT91Bootstrap (and U-Boot) is a standalone program that receives no input from its loader as to what is the active/chosen boot device.
Instead AT91Bootstrap is configured/built to use just one specific boot medium.
Therefore an AT91Bootstrap binary is not a portable executable.

If you configure and build AT91Bootstrap for SDHC1, then that boot.bin should only be used with the SDHC1 socket/device.
Do not try to use that boot.bin with the SDHC0 socket/device.

Your summation fails to provide salient details, especially how you have configured AT91Bootstrap and U-Boot for your various experiments of booting from SD card (SDHC1) and eMMC (SDHC0).
Copies of just one AT91Bootstrap binary will not work for both situations.

Try enabling the "Loud debug output" or "Even louder debug output" debug level in the AT91Bootstrap menuconfig to inform you of what is going on.
If that's not enough, then add your own printf() statements.

Regards

Re: SAMA5D27-SOM1-EK1 Boot From SDMMC1

Posted: Wed Nov 21, 2018 9:36 am
by Trilok
Hi,

I configured AT91Bootstrap to take U-boot.bin from SDHC1( SD card in our case). I followed below steps to create At91Bootstrap.bin

1. Tool chain
export CROSS_COMPILE=arm-linux-gnueabi-

2. make sama5d27_som1_eksd1_uboot_defconfig

3. make menuconfig
Here I not changed except enabling Load debugger.

4. make
And I copied the AT91Bootstrap.bin file from binaries folder to SD card and renamed it to BOOT.bin and also I placed u-boot.bin in SD card.

When I powered on the board by placing SD card in SDHC1. Below is the log I received
----------------------------------------------------------------------------------------------------------------
RomBOOT
ba_offset = 0xb ...

Dump DDRAMC Registers:
@address: 0x0 0x4 0x8 0xc
0xf000c000: 0x10 0x300511 0xd00139 0x22239337
0xf000c010: 0x2c81716 0x82482 0x33338 0x10000
0xf000c020: 0x16 0x50008 0x0 0x0
0xf000c030: 0x6 0xf6504 0x0 0x0
0xf000c040: 0x0 0x0 0x0 0x0
0xf000c050: 0x0 0x0 0x0 0x1
0xf000c060: 0x0 0x0 0x0 0x0
0xf000c070: 0x0 0x0 0x0 0x0
0xf000c080: 0x0 0x0 0x0 0x0
0xf000c090: 0x0 0x0 0x0 0x0
0xf000c0a0: 0x0 0x0 0x0 0x0
0xf000c0b0: 0x0 0x0 0x1 0x0
0xf000c0c0: 0x0 0x0 0x0 0x0
0xf000c0d0: 0x0 0x0 0x0 0x0
0xf000c0e0: 0x0 0x0 0x0 0x4000
0xf000c0f0: 0x484d5044 0x44524320 0x0 0x20301
0xf000c100: 0x0 0x0 0x4040404 0x3030303
0xf000c110: 0x0 0x1 0x4004102 0x0
0xf000c120: 0x0 0x0 0xc00 0xc00
0xf000c130: 0xc00 0xc00 0xd00 0xd00
0xf000c140: 0xd00 0xd00 0x10 0x10
0xf000c150: 0x10 0x10 0xf 0x0


AT91Bootstrap 3.8.11-00004-g6a09dc4 (Wed Nov 21 12:47:59 IST 2018)

All interrupts redirected to AIC
SD/MMC: Image: Read file u-boot.bin to 0x23f00000
MMC: ADMA supported
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
*** FATFS: f_open, filename: [u-boot.bin]: error
SD/MMC: Failed to load image

--------------------------------------------------------------------------------------------------------

OS : Ubuntu 17.10

Regards