Code Monkey home page Code Monkey logo

at91bootstrap's Introduction

AT91Bootstrap Project

AT91Bootstrap is the 2nd level bootloader for Microchip microprocessors (aka AT91). It providing a set of algorithms to manage the hardware initialization such as clock speed configuration, PIO settings, DRAM initialization, to download your main application from specified boot media: NAND FLASH, serial FLASH (both AT25-compatible of DataFlash), serial EEPROM, SD Card, etc. to main memory and to start it.

AT91Bootstrap 4 is the next milestone for AT91Bootstrap, which adds the support for devices instead of boards, and full implementation for each device's external memory support and serial connection.

Supported AT91 Devices:

  • SAM9X60
  • SAMA5D2
  • SAMA5D3
  • SAMA5D4
  • SAMA7G5

1 Host Setup

1.1 Generic Requirements

Python3

  • needed by the scripts that prepend the PMECC header for the NAND flash boot

1.2 Linux Host Requirements

Refer to the GNU ARM Toolchain section below for toolchain recommendations.

We recommend using a GNU Make with a version of 4.2 or newer.

1.3 Windows Host Setup

1.3.1 Install required tools

A toolchain such as GNU Tools for Arm Embedded Processors shall be provided. Get one from e.g. https://developer.arm.com/open-source/gnu-toolchain/gnu-rm. Further instructions below are written as if the toolchain had been installed to C:\opt\gnu_tools_arm\7-2018-q2.

Building AT91Bootstrap requires a POSIX environment. Several tools are available on the market to provide such an environment. In these instructions we rely on Minimal SYStem 2 (MSYS2). Get MSYS2 from http://www.msys2.org. Install it. The installation wizard ask for the installation folder, and suggests to keep its full path short. Further instructions below are written as if MSYS2 had been installed to C:\opt\msys.

MSYS2 notably provides a minimal Bourne Shell, named mintty. Launch mintty in the "MSYS2 MSYS" configuration: either search for the "MSYS2 MSYS" shortcut in the Program menu, or invoke the Run dialog ('Windows' and 'R' key combination) and enter the following command at the Open prompt:

C:\opt\msys\msys2_shell.cmd -msys

In this terminal, whose prompt is suffixed with "MSYS", request the package manager to update both its database and the packages already installed:

$ pacman -Syuu

Still at the "MSYS" prompt, install additional packages that we will need later on when building AT91Bootstrap:

$ pacman -S bc gawk gcc git make python tar

Finally, close the "MSYS2 MSYS" terminal window.

1.3.2 Open a shell suitable for building AT91Bootstrap

Launch mintty in the "MSYS2 MinGW 64-bit" configuration: either search for the "MSYS2 MinGW 64-bit" shortcut in the Program menu, or invoke the Run dialog ('Windows' and 'R' key combination) and enter the following command at the Open prompt:

C:\opt\msys\msys2_shell.cmd -mingw64

In this terminal, whose prompt is suffixed with "MINGW64", configure environment variables:

$ export CROSS_COMPILE=/c/opt/gnu_tools_arm/7-2018-q2/bin/arm-none-eabi-

Still at the "MINGW64" prompt, proceed with instructions given in the Compile AT91Bootstrap section below.

2 GNU ARM Toolchain

AT91Bootstrap has been compiled and tested under Linux using the following GNU ARM Toolchain:

  • gcc version 7.2.1 (Linaro GCC 7.2-2017.11)
  • gcc version 7.3.1 (Linaro GCC 7.2-2018.05)
  • gcc version 7.5.0 (Linaro GCC 7.5-2019.12)
  • gcc version 8.2.0 (Ubuntu 8.2.0-7ubuntu1)
  • gcc version 10.2.1 20201103 (GNU Toolchain for the A-profile Architecture 10.2-2020.11 (arm-10.16)) We recommend using a toolchain newer than 6.0

3 Compile AT91Bootstrap

Bootstrap configuration files are placed in the configs directory.

Each configuration is named in the following format:

<board name>[-bsr]<boot media>_<image to boot>_defconfig

Example: sam9x60ekdf_qspi_linux_image_dt_defconfig has

<board name> = sam9x60ek : The SAM9X60 EK board

[-bsr] = optional , the fact that it's missing, means that CONFIG_BACKUP is not selected for this defconfig

<boot media> = df_qspi : <df> stands for DataFlash, this means that DataFlash QSPI is used as boot media for next stage

<image to boot> = linux_image_dt : Linux image and device tree blob will be copied from boot media to external RAM

3.1 Compile DataFlash Boot (dataflash is QSPI in this example)

Let's use sam9x60ek as an example.

3.1.1 Compile booting kernel & dt image from dataflash (QSPI)

$ cd <project directory>
$ make mrproper
$ make sam9x60ekdf_qspi_linux_image_dt_defconfig
$ make

If the building process is successful, the final .bin image can be found under build/binaries/

3.1.2 Compile booting u-boot image from dataflash (QSPI)

$ cd <project directory>
$ make mrproper
$ make sam9x60ekdf_qspi_uboot_defconfig
$ make

If the building process is successful, the final .bin image can be found under build/binaries/

3.2 Compile NandFlash Boot

Let's use sam9x60ek as an example.

3.2.1 Compile booting kernel & dt image from NAND flash

$ cd <project directory>
$ make mrproper
$ make sam9x60eknf_linux_image_dt_defconfig
$ make

If the building process is successful, the final .bin image can be found under build/binaries/

3.2.2 Compile booting u-boot image from NAND flash

$ cd <project directory>
$ make mrproper
$ make sam9x60eknf_uboot_defconfig
$ make

If the building process is successful, the final .bin image can be found under build/binaries/

3.3 Compile SDCardBoot

Let's use sam9x60ek as an example,

3.3.1 Compile booting kernel & dt image from SDCard

$ cd <project directory>
$ make mrproper
$ make sam9x60eksd_linux_image_dt_defconfig
$ make

If the building process is successful, the final .bin image can be found under build/binaries/

3.3.2 Compile booting u-boot image from SDCard

$ cd <project directory>
$ make mrproper
$ make sam9x60eksd_uboot_dt_defconfig
$ make

If the building process is successful, the final .bin image can be found under build/binaries/

4 Release

If you plan to release the project, you can use the command as below

$ cd <project directory>
$ make tarball

If the command is successful, the .tar.gz tar package can be found under the project top directory.

5 Customizing your bootstrap

5.1 Support for Device

5.1.1 Selecting your device

With AT91Bootstrap you can select your MPU device from the menuconfig.

5.1.2 Selecting your device features

You can select your device features, for example which of the USART to be used as default output for the bootloader. All serial consoles and IOSETs are already implemented. You have to pick the one your board uses from menuconfig.

You can also select your external memory device according to your board, and your external memory timings to match supported memory module, or the standard JEDEC timings.

6 Contributing your own board

If the system board that you have is not listed, then you will need to port AT91Bootstrap to your hardware platform. To do this, you need to customize your bootstrap as in chapter 5 of this documentation.

Once you are done customizing, you can do

$ make savedefconfig

Then you will have a saved 'defconfig' file that can be placed into configs/ directory, after you rename it according to the rule described in chapter 3.

The configuration file can be send as a patch as described in chapter 7.

You should be able to do the above steps without requiring to write any actual C code. However your board may require specific 'board quirks', as some boards do. In this case you will have to implement your quirk into AT91Bootstrap and send this board quirk as a separate patch. Board quirks include for example: resetting of certain devices on the board, reconfiguring specific I/O pins, or blocking the TWI access on some busses.

7 Contributing

To contribute to AT91Bootstrap you should submit the patches for review to the github pull-request facility directly or the forum. And don't forget to Cc the maintainers.

Linux4SAM Website:

https://www.linux4sam.org

Linux4SAM Github repository, with interface for opening issues and pull requests:

https://github.com/linux4sam

Microchip Linux for MPUs Forum:

https://www.microchip.com/forums/f542.aspx

Maintainers:

Eugen Hristev [email protected]

Nicolas Ferre [email protected]

When creating patches insert the [at91bootstrap] tag in the subject, for example use something like:

git format-patch -s --subject-prefix='at91bootstrap][PATCH' <origin>

8 License

AT91Bootstrap is licensed under the MIT license.

License text file is available under LICENSES directory in the source code tree.

-End-

at91bootstrap's People

Contributors

alexandrebelloni avatar ambarus avatar baruchsiach avatar biagiom avatar claudiubeznea avatar clementleger avatar cristibirsan avatar dmosberger avatar dzsibi avatar ehristev avatar ftheile avatar gehariprasath avatar gportay avatar joshwu avatar ldesroches avatar lespocky avatar libinsha avatar lnksz avatar nirvann avatar noglitch avatar pbugalski avatar plagnioj avatar razvanstef avatar sandeepsm avatar sorganov avatar tonyhan11 avatar voiceshen avatar wenyouya avatar wpd avatar yairbenavraham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

at91bootstrap's Issues

emmc boot issue

I am currently developing using sama5d27-som1.

  1. I want to boot using emmc instead of SD card.
  2. Downloading the "sdcard.img" file using "sa-ba ISP" succeeded.
    ("sdcard.img" is the image used by on the testboard.)
    c:...>sam-ba -p serial -b sama5d27-som1-ek -t 5 -a sdmmc -c write:sdcard.img
  3. But, RomBOOT is displayed repeatedly, but cannot boot.

I think ROM cannot find bootstrap on the emmc. What should I do?

Suspicious (?) RAM performance on SAMA5D2

It is my understanding that u-boot and Linux don't alter the RAM controller configuration so I'm raising this "issue" here.

I am not sure that it is normal to have such low memcpy (~200 MB/s) and memset (~ 400 MB/s) performance on the sama5d2-xplained hardware; here are numbers from tinymembench:

    C copy backwards                                     :    124.6 MB/s (0.6%)
    C copy backwards (32 byte blocks)                    :    134.5 MB/s (0.9%)
    C copy backwards (64 byte blocks)                    :    122.7 MB/s
    C copy                                               :    188.0 MB/s
    C copy prefetched (32 bytes step)                    :    182.5 MB/s (0.1%)
    C copy prefetched (64 bytes step)                    :    189.5 MB/s
    C 2-pass copy                                        :    179.0 MB/s
    C 2-pass copy prefetched (32 bytes step)             :    182.5 MB/s
    C 2-pass copy prefetched (64 bytes step)             :    188.9 MB/s
    C fill                                               :    428.6 MB/s (0.2%)
    C fill (shuffle within 16 byte blocks)               :    428.4 MB/s
    C fill (shuffle within 32 byte blocks)               :    428.5 MB/s (0.2%)
    C fill (shuffle within 64 byte blocks)               :    130.0 MB/s
    ---
    standard memcpy                                      :    189.6 MB/s
    standard memset                                      :    428.5 MB/s
    ---
    NEON read                                            :    348.2 MB/s
    NEON read prefetched (32 bytes step)                 :    371.5 MB/s (0.1%)
    NEON read prefetched (64 bytes step)                 :    405.4 MB/s
    NEON read 2 data streams                             :    321.4 MB/s
    NEON read 2 data streams prefetched (32 bytes step)  :    407.7 MB/s
    NEON read 2 data streams prefetched (64 bytes step)  :    407.0 MB/s
    NEON copy                                            :    181.8 MB/s (0.1%)
    NEON copy prefetched (32 bytes step)                 :    181.7 MB/s
    NEON copy prefetched (64 bytes step)                 :    189.6 MB/s
    NEON unrolled copy                                   :    188.1 MB/s (1.6%)
    NEON unrolled copy prefetched (32 bytes step)        :    186.9 MB/s (0.5%)
    NEON unrolled copy prefetched (64 bytes step)        :    189.6 MB/s
    NEON copy backwards                                  :    134.5 MB/s
    NEON copy backwards prefetched (32 bytes step)       :    134.8 MB/s (0.6%)
    NEON copy backwards prefetched (64 bytes step)       :    185.1 MB/s (0.7%)
    NEON 2-pass copy                                     :    179.5 MB/s
    NEON 2-pass copy prefetched (32 bytes step)          :    187.0 MB/s
    NEON 2-pass copy prefetched (64 bytes step)          :    196.3 MB/s
    NEON unrolled 2-pass copy                            :    181.5 MB/s
    NEON unrolled 2-pass copy prefetched (32 bytes step) :    181.9 MB/s (0.1%)
    NEON unrolled 2-pass copy prefetched (64 bytes step) :    195.9 MB/s
    NEON fill                                            :    428.5 MB/s
    NEON fill backwards                                  :    428.4 MB/s
    VFP copy                                             :    188.2 MB/s (0.2%)
    VFP 2-pass copy                                      :    180.5 MB/s (0.2%)
    ARM fill (STRD)                                      :    428.5 MB/s
    ARM fill (STM with 8 registers)                      :    428.6 MB/s (0.1%)
    ARM fill (STM with 4 registers)                      :    428.4 MB/s
    ARM copy prefetched (incr pld)                       :    187.9 MB/s (0.5%)
    ARM copy prefetched (wrap pld)                       :    188.9 MB/s
    ARM 2-pass copy prefetched (incr pld)                :    184.7 MB/s
    ARM 2-pass copy prefetched (wrap pld)                :    184.7 MB/s (0.1%)

tinymembench was added on this image:
https://files.linux4sam.org/pub/demo/linux4sam-2020.10/linux4sam-poky-sama5d2_xplained-headless-2020.10.img.bz2
and I also replaced the BOOT.BIN with the latest master of at91bootstrap, getting the same results.

The sama5d2 performance that I saw would be what to expect with DDR3 clocked at 50 MHz and without DLL; should I expect more or not? I am seeing 5x this memset/memcpy performance (1000 MB/s / 2000 MB/s) on an imx7 equipped with worse DDR3 memory...

I don't have a lot of experience with this chip but a cursory review of the DDR configuration in the board files, vs. the sama5d2 datasheet and the RAM datasheet doesn't shock me.

Tagging @swapna-gg1 and @ehristev as I saw that they added a memcpy enhancement in dd4da88 and I suppose benchmarks were ran for the occasion.

Thank you,

Debugging with Eclipse on Linux

Hi there!

I am trying to get more elaborate debugging experience to contribute to the at91bootstrap project.

I found a tutorial on Linux4SAM on how to configure Eclipse CDT and a JTAG debugger to be able to set use GDB features.

But following the tutorial I noticed, that it is quite dated and some links don't work, or the Zylin plug-in fails to be installed.
(Using latest Eclipse 2022-03)

I also found the jlink-plugin which is relying on the cPack manager.

After some try-and-error I got the setup working so far that I can connect to my SAMA5A3Xplained board by clicking on Debug and the download of the built binary is successful.
But after the reset is issued the CPU starts running and the registers cannot be read out.

Anyway.. it may be a of a more general interest as well to have an updated version of the Linux4SAM tutorial to enable easier contribution to the project.

Can any of the maintainers help out? You surely have a working set-up at hand, right?

Nand flash driver fails to load images not on block boundaries

Following patch can be applied to v2.8.6:

From bb8c2fd26fea89795ebf50badad868be42b93dad Mon Sep 17 00:00:00 2001
From: Dushara Jayasinghe <[email protected]>
Date: Wed, 14 Sep 2016 02:20:25 +0000
Subject: [PATCH] Fix bug in loading images from nandflash

The nandflash driver does not take into account of images that
start from the middle of blocks when calculating the number of
pages to read. This causes data from the beginning of the first
block to be read due to the read pointer wrapping around after
reaching the end of the block.

---
 driver/nandflash.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/driver/nandflash.c b/driver/nandflash.c
index e178e77..b968476 100644
--- a/driver/nandflash.c
+++ b/driver/nandflash.c
@@ -954,6 +954,7 @@ static int nand_loadimage(struct nand_info *nand,
    unsigned int end_page;
    unsigned int numpages = 0;
    unsigned int offsetpage = 0;
+   unsigned int block_remaining = nand->blocksize - offset;
    int ret;

    division(offset, nand->blocksize, &block, &start_page);
@@ -961,10 +962,10 @@ static int nand_loadimage(struct nand_info *nand,

    while (length > 0) {
        /* read a buffer corresponding to a block */
-       if (length < nand->blocksize)
+       if (length < block_remaining )
            readsize = length;
        else
-           readsize = nand->blocksize;
+           readsize = block_remaining;

        /* adjust the number of pages to read */
        division(readsize, nand->pagesize, &numpages, &offsetpage);
@@ -997,6 +998,7 @@ static int nand_loadimage(struct nand_info *nand,

        block++;
        start_page = 0;
+       block_remaining = nand->blocksize;
    }

    return 0;
--
1.9.1

SFR_CAN should be configured by at91bootstrap

Commit linux4sam/linux-at91@deb4ced621 sets the CAN Message RAM address to 0x210000 for all sama5d2 derived boards.

AT91Bootstrap has not been updated accordingly, and the CAN controller still uses the 0x200000 base.

AT91Bootstrap should update SFR_CAN such that the address setup in the device tree matches the base fed to the M_CAN controller.

-nostartfiles is not an LDFLAG

Newer version of GCC (10.2.0 tested) have added extra error checking to the LD linker. If you now pass a flag that it doesn't recognize it will suggest an alternative. Additionally -nostartfiles is a GCC flag, not a LD flag. Together this causes the at91bootstrap make file to generate a linking error:

arm-poky-linux-gnueabi-ld: Error: unable to disambiguate: -nostartfiles (did you mean --nostartfiles ?)

Explanation available here:
https://sourceware.org/pipermail/binutils/2021-June/116826.html

I think -nostartfiles was just silently ignored previously.

CONFIG_IMAGE_NAME is not (menu)configurable

It seems image name (the actual name of the image to load) is not configurable.
I do not know if this is intentional or not, but forces to rename the actual Image to a standard name without format (e.g.: uImage vs. zImage) or content information (e.g.: tinyImage vs. FullBlownLinux).

This is due to CONFIG_IMAGE_NAME (at Config.in#83) having an empty string value and thus not showing in "make menuconfig"; the following change would resolve the problem:

config CONFIG_IMAGE_NAME
    string
    default "Image" if CONFIG_LINUX_IMAGE

Should be changed to something like:

config CONFIG_IMAGE_NAME
    string "Image name"
    default "Image" if CONFIG_LINUX_IMAGE

SAMA5D27 bootstrap access to eMMC

I see that several other people have had this issue (having the bootstrap access the eMMC). @ehristev has been very helpful in solving peoples' problems. I am hopeful someone on the discussion can help me as well.

We have a card based heavily on the Xplained eval board for the SAMA5D27. It has an SD card on SD bus 1 and the eMMC on SD bus 0.

I was using version 3.8.11 AT91 bootstrap until we got a new revision of the card. Then on some of the cards the bootstrap could not find our application on the eMMC filesystem. I looked to see if there was a solution. I first found that there was a new version of the bootstrap, so I downloaded it. I have tried 3.10.2 (commit: 5232adb). That was a big improvement. It worked on most cards and the one card that wasn't working with 3.8.11, it worked on. Unfortunately that card has also stopped working.

I see that the ROMboot code can access the eMMC and find and load the bootstrap. If I boot our application off the SD card it can access the file system on the eMMC. So those two programs can access the device, it is just the bootstrap code that can not. This makes it seem like the bootstrap is not setting up the SD bus, or other parts of the system, the same way as the other two programs. This also shows me that the filesystem on the eMMC is valid.

I have applied the updates from issue #98 (change of clk_div, slower clock, and drive strength). This does not make it work.

My eMMC has been divided into 4 partitions. I don't think that matters because it does not even get to that level of access. It is failing during bus width determination. It is reading the CID register.

We are using a Kingston eMMC.

Here is the console output

RomBOOT
ba_offset = 0xc ...

Dump DDRAMC Registers:
@address: 0x0 0x4 0x8 0xc
0xf000c000: 0x10 0x300511 0xd0035d 0x44439436
0xf000c010: 0x3001d1b 0x74000 0x33338 0x10000
0xf000c020: 0x4 0x50008 0x0 0xc852
0xf000c030: 0x40 0x956404 0x0 0x0
0xf000c040: 0x0 0x0 0x0 0x0
0xf000c050: 0x0 0x0 0x0 0x2
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 0x3c03c02 0x0
0xf000c120: 0x0 0x0 0xb00 0xb00
0xf000c130: 0xb00 0xb00 0xc00 0xc00
0xf000c140: 0xc00 0xc00 0xf 0xf
0xf000c150: 0xf 0xf 0xe 0x0

AT91BS-TTC 3.10.2-00055-g5232adb1-dirty@eMMC (2021-07-13 13:00:06)

All interrupts redirected to AIC
twi read: timeout to wait RXRDY bit on bus 0
SD/MMC: Image: Read file image_a.bin to 0x20000000
MMC: ADMA supported
mmc_verify_operating_condition
mmc_verify_operating_condition success OCR = 0xc0ff8080
Card type is MMC
sd card identified with CID = 0x70010054 0x42323931 0x369024fa 0x800e96ff
sdcard_identification success
MMC: Specification Version 4.0 or higher
MMC: v5.1 detected
MMC: highspeed supported
MMC: Dual Data Rate supported
MMC: detecting buswidth...
SDHC: Transfer data timeout
SDHC: Transfer data timeout
MMC: falling back to 1 bit bus width
*** FATFS: f_open, filename: [image_a.bin]: error
SD/MMC: Failed to load image
RomBOOT

I would be grateful for any help on changes required to get the bootstrap to access the emmc.
Regards, Joel

Macro changes break sama5d3xek lpddr2_reg_config()

The macro changes commited on June 23, "at91_ddrsdrc: improve the macro definition of the MPDDRC timming parameter register", commit: 56516ba, broke the lpddr2_reg_config() function in board/sama5d3xek/sama5d3xek.c.

The macros used to generate the values for the registers t0pr, t1pr, and t2pr in lpddr2_reg_config() need to be changed to pass a parameter. For example: change "AT91C_DDRC2_TRCD_2" to be "AT91C_DDRC2_TRCD_(2)" and so on.

sam9x60 : qspi boot error

On v3.9.0 branch, sam9x60 doesn't boot from qspi.

Boot stop on EEPROM read.

Boot ok when # CONFIG LOAD EEPROM is not set

Boot ok on NAND with CONFIG LOAD EEPROM activated

Compile error (clk-common.c:265:10: error: ‘AT91C_ID_SMD’ undeclared)

ld FLAGS
========
-nostartfiles -Map=binaries/sama5d27_som1_ek-sdcardboot-uboot-3.10.1-rc1.map --cref -static -T elf32-littlearm-tz.lds --gc-sections -Ttext 0x200000

  AS        crt0_gnu.S
  CC        main.c
  CC        board/sama5d27_som1_ek/sama5d27_som1_ek.c
  CC        lib/string.c
  CC        lib/eabi_utils.c
  CC        lib/div.c
  CC        lib/consttime_memequal.c
  CC        driver/at91_slowclk.c
  CC        driver/common.c
  CC        driver/at91_pio.c
  CC        driver/pmc/clk-common.c
driver/pmc/clk-common.c: In function ‘sys_mask_to_per_id’:
driver/pmc/clk-common.c:265:10: error: ‘AT91C_ID_SMD’ undeclared (first use in this function); did you mean ‘AT91C_ID_HSMC’?
   return AT91C_ID_SMD;
          ^~~~~~~~~~~~
          AT91C_ID_HSMC
driver/pmc/clk-common.c:265:10: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:343: driver/pmc/clk-common.o] Error 1

SAM9X60 DDR2 SIP Boot Issue

Hello,
We are using SAM9X60D5M 64MB SIP. Our device stuck after the "Done to load image" message. We tried to boot by using SD Card and NAND Flash and they both stuck at the same point.

  • We compiled buildroot with sam9x60ek_headless_defconfig.
  • Changed AT91Bootstrap config to "sam9x60_ddr2_sip_ebsd_uboot_defconfig" with "CONFIG_RAM_64MB=y".
  • U-Boot config is "sam9x60ek_mmc_defconfig"
    SD Boot
    This is the output for the SD Card boot. We usually except
    <debug_uart> & U-Boot header after that point but nothing happens.

This is the output when we tried to boot from NAND Flash. We put debug messages starts with "->" to see if AT91Bootstrap stuck at some point but it runs through "JUMP_ADDR".

RomBOOT

 ba_offset = 0xb ...

Dump DDRAMC Registers:
@address: 0x0 0x4 0x8 0xc
0xffffe800: 0x10 0x300618 0xc00139 0x2223c339
0xffffe810: 0x2c81715 0x92382 0x33338 0x10000
0xffffe820: 0x16 0x50008 0x0 0x0
0xffffe830: 0x6 0x787907 0x0 0x0
0xffffe840: 0x0 0x0 0x0 0x0
0xffffe850: 0x0 0x0 0x0 0x2
0xffffe860: 0x11 0xffff0000 0xffff0000 0xffff0000
0xffffe870: 0xffff0000 0xffff0000 0xffff0000 0xffff0000
0xffffe880: 0xffff0000 0x0 0x0 0x2a00002
0xffffe890: 0x0 0x0 0x0 0x0
0xffffe8a0: 0x0 0x0 0x0 0x0
0xffffe8b0: 0x0 0x0 0x1 0x0
0xffffe8c0: 0x0 0x0 0x0 0x1
0xffffe8d0: 0x0 0x0 0x0 0x0
0xffffe8e0: 0x0 0x0 0x200e008 0x200
0xffffe8f0: 0x484d5044 0x44524320 0x0 0x325
0xffffe900: 0x0 0x0 0x4030404 0x0
0xffffe910: 0x1f1f 0x0 0x4b04b02 0x0
0xffffe920: 0x0 0x0 0xf00 0xe00
0xffffe930: 0x1000 0xf00 0x0 0x0
0xffffe940: 0x0 0x0 0x14 0x14
0xffffe950: 0x0 0x0 0x0 0x0


AT91Bootstrap 3.10.2-00016-g8dbcb0b-dirty (2021-02-18 21:32:25)

NAND: ONFI flash detected
NAND: Manufacturer ID: 0x2c Chip ID: 0xdc
NAND: Page Bytes: 4096, Spare Bytes: 224
NAND: ECC Correctability Bits: 8, ECC Sector Bytes: 512
NAND: Disable On-Die ECC
PMECC: version is: 0x102
PMECC: page_size: 4096, oob_size: 224, pmecc_cap: 8, sector_size: 512
NAND: Initialize PMECC params, cap: 8, sector: 512
NAND: Image: Copy 0xc0000 bytes from 0x40000 to 0x23f00000
NAND: Done to load image
->after load image done
->JUMP_ADDR

We also ordered D1G 128MB version of SAM9X60 to test. Do we missing a point?

bootstrap on eMMC - 2GB (skyhigh v5.1 - SkyHighMemory_S40FC002_DS)

i am trying to boot to bootstrap and u-boot on eMMC (CONFIG_SDHC1):

i am using a custom board - based on Sama5D2

RomBOOT
ba_offset = 0xa ...

Dump DDRAMC Registers:
@address: 0x0 0x4 0x8 0xc
0xf000c000: 0x10 0x300a21 0xc00034 0x2223a337
0xf000c010: 0x2220f0d 0x72362 0x33338 0x10000
0xf000c020: 0x16 0x50008 0x0 0x0
0xf000c030: 0x6 0x166404 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 0x3c03c02 0x0
0xf000c120: 0x0 0x0 0xb00 0xb00
0xf000c130: 0xb00 0xb00 0xc00 0xc00
0xf000c140: 0xc00 0xc00 0xf 0xf
0xf000c150: 0xf 0xf 0xe 0x0

AT91Bootstrap 4.0.1-00006-g9a0208a4-dirty (2022-01-19 18:06:52)

All interrupts redirected to AIC
SD/MMC: Image: Read file u-boot.bin to 0x26f00000
MMC: ADMA supported
mmc_verify_operating_condition
mmc_verify_operating_condition success OCR = 0xc0ff8080
Card type is MMC
sd card identified with CID = 0x1010053 0x34303030 0x3210c960 0xfc9a38ff
sdcard_identification success
MMC: Specification Version 4.0 or higher
MMC: v5.1 detected
MMC: highspeed supported
MMC: Dual Data Rate supported
MMC: detecting buswidth...
MMC: 4-bit bus width detected
*** FATFS: f_open, filename: [u-boot.bin]: error
SD/MMC: Failed to load image

Support for GPT

Currently, there seems to be no support for anything other than MBR systems.

Unselecting an LED causes compile errors

For our SAMA5D27 project that is based on SAMA5D27SOM1EK I wanted to unselct the use of the blue LED as we only have 2 LEDs connected but that causes compile errors in driver/led.c

CC driver/led.c
driver/led.c: In function ‘at91_leds_init’:
driver/led.c:53:22: error: ‘LED_B_PIO’ undeclared (first use in this function); did you mean ‘LED_G_PIO’?
53 | pio_set_gpio_output(LED_B_PIO, CONFIG_LED_B_VALUE);
| ^~~~~~~~~
| LED_G_PIO
driver/led.c:53:22: note: each undeclared identifier is reported only once for each function it appears in
driver/led.c:53:33: error: ‘CONFIG_LED_B_VALUE’ undeclared (first use in this function); did you mean ‘CONFIG_LED_G_VALUE’?
53 | pio_set_gpio_output(LED_B_PIO, CONFIG_LED_B_VALUE);
| ^~~~~~~~~~~~~~~~~~
| CONFIG_LED_G_VALUE

I found out that #ifndef for the macros does not work as selecting "No LED on board" defines LED_x_NONE with 'y' which means the macros are always true.

I fixed in on my end by doing a different check. Patch file attached.
at91bootstrap3-v4.0.0-fix-skipping-unselected-leds.patch.txt

while sd card connected

while insert sd card below error occur on "Tera Term"

AT91Bootstrap 4.0.0 (2021-09-04 18:15:32)

SDHC: fix in place for SAMA5D2 SiP VDDSDMMC over-consumption errata
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

SAMA5D2 at91Bootstrap 4.0.1: SDHC no card inserted

I'm having a problem getting a proper defconfig for the 4.0.1 at91bootstrap. I have a board based on the acme roadrunner berta that works fine with the 3.9.1(and earlier) at91bootstrap, but am trying to move to linux4sam-2021.10, and have an issue with it recognizing SDHC1 on boot:

On boot, my output is:

AT91Bootstrap 4.0.1 (2022-06-09 21:11:36)

SD/MMC: Image: Read file zImage to 0x22000000
MMC: ADMA supported
SDHC: Error: No Card Inserted
*** FATFS: f_open, filename: [zImage]: error
SD/MMC: Failed to load image

For AT91Bootstrap 3.9.1, the defconfig is simple, and contrib/board/acme/sama5d2_roadrunner_defconfig contains:

CONFIG_SAMA5D2_ROADRUNNER=y
CONFIG_RAM_256MB=y
CONFIG_DDR3=y
CONFIG_SDCARD=y
CONFIG_SDHC1=y
CONFIG_LOAD_LINUX=y
CONFIG_OVERRIDE_CMDLINE=y
CONFIG_LINUX_KERNEL_ARG_STRING="mem=256M console=ttyS0,115200 root=/dev/mmcblk0p
2 rootfstype=ext4 rw rootwait consoleblank=0"
CONFIG_IMAGE_NAME="zImage"
CONFIG_DEBUG=y

For AT91Bootstrap 4.0.1( maybe it's not for 4.0.1?), acme has a copy of the defconfig file I'm using on their website here:

https://www.acmesystems.it/www/roadrunner_compile_kernel_5_4/acme-roadrunner_defconfig

I tried to create a stripped down defconfig file, taking into account info from issue 126 from edgar-bonet, but get the same results.

Any thoughts of what to try or change appreciated. I've tried a bunch of things, primarily trying slightly different settings in the defconfig to see if I can affect the problem somehow, but it's largely resulted in jiggling the handle

Problem finding all lpddr2 memory

I'm having a SAMA5D26C with a LPDDR2 EDB1332BDBH-1. The CPU boots successfully ROMBOOT and is able to load at91bootstrap from QSPI memory. I get debug output from at91bootstrap, but I fail to load linux.

Investigating this further show me that the RAM initalization works fine but the CPU hangs when trying to load the device tree from flash into RAM.

So I add this loop:

volatile char * ptr = (char *)0x20000000;
while(1) {
dbg_info("ptr: %x value: %c\n", ptr, *ptr);
ptr += 1;
}
That gives me output as expected:

ptr: 0x20000000 value: U
ptr: 0x20000001 value: U
...
Up until:

...
ptr: 0x203ffffe value: U
ptr: 0x203fffff value:
ptr: 0x203fffff value:
ptr: 0x203fffff value:
ptr: 0x203fffff value:
ptr: 0x203fffff value:
ptr: 0x203fffff value:
It seems as I can't access memory above 4MB even though my RAM size is 128 MB. I've verified that I can write and read the written value from RAM for a value below 4MB.

Why isn't all physical memory accessible and and how come ptr isn't increased after 0x203ffffff?

Incorrect image size set?

L46 of crt0_gnu.S writes the size of the binary for loading into ROM. Currently it's writing the last data address; seems like it should be writing _edata - _stext instead. Seems like the stage 1 bootloader on the at91sam9g45 part is balking at the size and rejecting my image because of that. I can submit the actual patch for it if needed.

Stuck in compile

Hello, I am using the sama5d3_xplained. When I tied to run these command:
$ make mrproper
$ make at91sam9x5ekdf_linux_defconfig
$ make
I was stucked in "make at91sam9x5ekdf_linux_defconfig", I have changed this command to "make sama5d3_xplainedsd_uboot_defconfig", but it didn't help. Finally, I found "sama5d3_xplainedsd_uboot_defconfig" in "~/at91bootstrap/board/sama5d3_xplained", I tried copy all files in this folder to ~/at91bootstrap directory, then I tried to run "make sama5d3_xplainedsd_uboot_defconfig", but this is also not work. Help me please, many thx.

Newer GCC's (>= 6.x) create faulty images

A GCC with version >= 6. x seems to create faulty images (at least for an AT91SAMA5D36). The problem is that external global variables are incorrectly linked.

Example:

We add in common. c the line

int pahx7Iok;

Afterwards we write in main. c

extern int pahx7Iok;

and

dbg_info("=> %p\n", &pahx7Iok);

This produces an output saying that the pointer is zero. And the line

pahx7Iok = 0;

would cause a crash.

v4 build error: undefined reference to `get_cm_sn'

I am trying to build a defconfig for running AT91Bootstrap 4 on the Acqua SoM from Acme Systems. Starting with this very basic configuration:

CONFIG_SAMA5D3X=y
CONFIG_CPU_CLK_528MHZ=y
CONFIG_DEBUG=y
CONFIG_SDCARD=y
CONFIG_LOAD_LINUX=y
CONFIG_IMAGE_NAME="zImage"

I get this build error:

build/device/sama5d3/sama5d3.o: in function `at91_board_set_dtb_name':
device/sama5d3/sama5d3.c:344: undefined reference to `get_cm_sn'
device/sama5d3/sama5d3.c:370: undefined reference to `get_dm_sn'
device/sama5d3/sama5d3.c:372: undefined reference to `get_dm_sn'

The missing functions seem to be called whenever both CONFIG_SDCARD and CONFIG_OF_LIBFDT are set. I think this matches my case, as I want to load both a Linux kernel and a dtb from a microSD card.

I found the functions defined in driver/board_hw_info.c but, judging from driver/driver.mk, it would seem this file is only compiled when CONFIG_LOAD_HW_INFO is set. My understanding is that this option is not suitable for my board.

LP-DDR2: defines for ZQ field of MPDDRC_CR register are wrong

The #defines for the ZQ field are wrong in the include/arch/at91_ddrsdrc.h. They were coded as if they were binary, but they are in hex. This code was introduced on 2013-11-28, Commit: "driver: ddramc: add driver to support the low_power DDR2-SDRAM device", SHA1: e8de4ae

The following patch fixes this bug:

--- a/include/arch/at91_ddrsdrc.h
+++ b/include/arch/at91_ddrsdrc.h
@@ -102,10 +102,10 @@
#define AT91C_DDRC2_DIS_DLL_DISABLED (0x0UL << 9)
#define AT91C_DDRC2_DIS_DLL_ENABLED (0x1UL << 9)
#define AT91C_DDRC2_ZQ (0x03 << 10)
-#define AT91C_DDRC2_ZQ_INIT (0x00 << 10)
-#define AT91C_DDRC2_ZQ_LONG (0x01 << 10)
-#define AT91C_DDRC2_ZQ_SHORT (0x10 << 10)
-#define AT91C_DDRC2_ZQ_RESET (0x11 << 10)
+#define AT91C_DDRC2_ZQ_INIT (0x0UL << 10)
+#define AT91C_DDRC2_ZQ_LONG (0x1UL << 10)
+#define AT91C_DDRC2_ZQ_SHORT (0x2UL << 10)
+#define AT91C_DDRC2_ZQ_RESET (0x3UL << 10)
#define AT91C_DDRC2_OCD (0x7UL << 12)
#define AT91C_DDRC2_OCD_EXIT (0x0UL << 12)
#define AT91C_DDRC2_OCD_DEFAULT (0x7UL << 12)

Timeouts on custom SAMA5D27 board

Hi,

I have a custom board based on SAMA5D27 D1G-CU with an 8-bit eMMC connected
to SDMMC0. There is no USB interface, so I use the serial UART port
to program at91bootstrap and U-Boot via SAM-BA.

This board has a 27MHz external clock generator connected to XIN and
XOUT is left unconnected, so I selected CONFIG_MCK_BYPASS=y and adapted
at91bootsrap code as below:

diff --git a/board/sama5d27_som1_ek/sama5d27_som1_ek.h b/board/sama5d27_som1_ek/sama5d27_som1_ek.h
index 912fcfd328fe..324dbb33c574 100644
--- a/board/sama5d27_som1_ek/sama5d27_som1_ek.h
+++ b/board/sama5d27_som1_ek/sama5d27_som1_ek.h
@@ -31,10 +31,10 @@
/*

  • PMC Settings
    */
    -#define BOARD_MAINOSC 24000000
    +#define BOARD_MAINOSC 27000000

-/* PCK: 492MHz, MCK: 164MHz /
-#define BOARD_PLLA_MULA 40
+/
PCK: 486MHz, MCK: 162MHz */
+#define BOARD_PLLA_MULA 35

#define BOARD_PCK ((unsigned long)((BOARD_MAINOSC * (BOARD_PLLA_MULA + 1)) / 2))
#define BOARD_MCK ((unsigned long)((BOARD_MAINOSC * (BOARD_PLLA_MULA + 1)) / 2 / 3))
@@ -53,7 +53,7 @@
| AT91C_PMC_MDIV_3
| AT91C_PMC_CSS_PLLA_CLK)

-#define MASTER_CLOCK 164000000
+#define MASTER_CLOCK BOARD_MCK

#define PLLA_SETTINGS (BOARD_CKGR_PLLA |
BOARD_PLLACOUNT |
diff --git a/board/sama5d27_som1_ek/sama5d27_som1_eksd1_uboot_defconfig b/board/sama5d27_som1_ek/sama5d27_som1_eksd1_uboot_defconfig
index d1e5ed0e7957..3104eaf01d0a 100644
--- a/board/sama5d27_som1_ek/sama5d27_som1_eksd1_uboot_defconfig
+++ b/board/sama5d27_som1_ek/sama5d27_som1_eksd1_uboot_defconfig
@@ -5,3 +5,5 @@ CONFIG_SDHC1=y
CONFIG_JUMP_ADDR="0x23f00000"
CONFIG_DEBUG=y

CONFIG_ENTER_NWD is not set

+CONFIG_MCK_BYPASS=y
+CONFIG_SDHC0=y

2.25.1

After re-builing at91bootsrap, I flash at91bootstrap and U-Boot to the eMMC
like this:

sam-ba -p serial -d sama5d2 -a sdmmc:0:1:1:8:5 -c writeboot:boot.bin
sam-ba -p serial -d sama5d2 -a sdmmc:0:1:1:8:5 -c write:u-boot.bin:0x8000

And after that, I see the following upon boot:

AT91Bootstrap 3.10.2-00017-g7738830d9732 (2021-03-24 12:14:34)

SDHC: fix in place for SAMA5D2 SoM VDDSDMMC over-consumption errata
The MAINCK frequency: 27000000
Timeout waiting for GCK ready!
SD/MMC: Image: Read file u-boot.bin to 0x23f00000
MMC: ADMA supported
SDHC: Timeout waiting for internal clock ready

Any ideas as to how to fix the GCK and SDHC timeouts as shown above?

Thanks,

eMMC init issue

Hi all,

I hope this is the right forum for this, if not please point me in the right direction.

We have a custom board, using a SAMA5D27 D1G CU, and a Micron MTFC2GMDEA-0M WT 2GB eMMC.

Schematic has been verified and board layout:
image

image

I can't get it to be recognised by u-boot, but at91 bootstrap does show some interesting data, however it returns an error (-10) when running mmc_cmd_switch_fun() on line 791 of mci_media.c

CONFIG_DEBUG_VERY_LOUD is set.

 ba_offset = 0xb ...

Dump DDRAMC Registers:
@address: 0x0 0x4 0x8 0xc
0xf000c000: 0x10 0x3004ff 0xd00139 0x22239337
0xf000c010: 0x2c81716 0x82482 0x33338 0x10000
0xf000c020: 0x16 0x50008 0x0 0x0
0xf000c030: 0x6 0x76504 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 0x3f03f02 0x0
0xf000c120: 0x0 0x0 0xc00 0xc00
0xf000c130: 0xc00 0xc00 0xd00 0xd00
0xf000c140: 0xd00 0xd00 0x10 0x10
0xf000c150: 0x10 0x10 0xf 0x0
Applying VDDSDMMC errata to ID: 0x33


AT91Bootstrap 3.9.1-00011-g5a3157e (Mon Mar  9 10:50:35 GMT 2020)

All interrupts redirected to AIC
SDHC: fix in place for SAMA5D2 SoM VDDSDMMC over-consumption errata
SD/MMC: Image: Read file u-boot.bin to 0x23f00000
MMC: ADMA supported
mmc_verify_operating_condition
mmc_verify_operating_condition success OCR = 0x80ff8080
Card type is MMC
sd card identified with CID = 0xfe014e4d 0x4d433032 0x4742f707 0xf43c95ff
sdcard_identification success
MMC: Specification Version 4.0 or higher
MMC: v4.41 detected
MMC: highspeed supported
MMC: Dual Data Rate supported
MMC: detecting buswidth...
SDHC: Timeout waiting for command complete
SDHC: Timeout waiting for command complete
SDHC: Timeout waiting for command complete
SDHC: Timeout waiting for command complete
MMC: falling back to 1 bit bus width
SDHC: Timeout waiting for command complete
SDHC: Timeout waiting for command complete
MMC: DDR mode could not be enabled: -10
SDHC: Timeout waiting for command complete
*** FATFS: f_open, filename: [u-boot.bin]: error
SD/MMC: Failed to load image

The CID looks correct, and it detects the right version, but that's all I can get out of it. I've been banging my head off this for a week or so now so any help would be greatly appreciated.

Thanks

Why no THUMB mode for SAMA5D3X?

I came across this configuration, and don't understand, why THUMB is disabled for e.g. SAMA5D3X, even if its datasheet mentions support for the thumb instructions set.

at91bootstrap/Kconfig

Lines 206 to 210 in 2eb1a1e

config THUMB
depends on !(SAMA5D3X || SAMA5D4)
bool "Build in thumb mode"
help
Build code in thumb mode

Could you explain? Thank you!

Output in .config for DDR is confusing

In driver/Config.in.dram the config options have a comment that looks like it belongs to corresponding config. But that's not how they're supposed to be used so in the final .config file the comment looks like it belongs to the config option below. Either remove the comment or change it to a help attribute. Or move the comment above each option but the choice menu gets cluttered with the comments, though that's kind of how it looks today but the comment would of course be above rather than below.

Example:

#
# DDR2 W9751G6KB 512 Mbit
#
CONFIG_DDR_W971GG6SB=y

#
# DDR2 W971GG6SB 1 Gbit
#
# CONFIG_DDR_AD220032D is not set

#
# LPDDR2 AD220032D 2 Gbit
#
# CONFIG_DDR_MT47H128M16 is not set

Are configurations with "mem=" in kernel command line known to work with recent kernels (>=4.9)?

Are you aware if following configurations exist and successfully work in production?
Like this one

default "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/kernel),60M(rootfs),-(spare) root=/dev/mtdblock1 rw rootfstype=jffs2" if CONFIG_AT91SAM9261EK && !CONFIG_SDCARD

and others with "mem=" in command line. Btw, why "mem=NN" is used when RAM size can be set in the device tree?

  • at91bootstrap boots Linux directly, without u-boot

  • Linux version is 4.9 or higher

  • Kernel command line is passed by at91bootstrap, i.e. CONFIG_LINUX_KERNEL_ARG_STRING is enabled

  • SoC is SAMA5D2

I observe kernel crashes when "mem=64M" is appended to command line, please see this post

http://lists.infradead.org/pipermail/linux-arm-kernel/2018-November/613095.html

Secure boot Linux kernel verification

Commit ef803bb (secure: add first implementation of secure boot) message
specifically mentions that "This version doesn't support Linux or Android
image yet". And indeed CONFIG_SECURE still depends on !CONFIG_LOAD_LINUX as of
current master.

What is blocking secure boot support for Linux kernel images? Are there any plans for adding support for that?

Thanks,
baruch

Add packages after boot

Hello,

I know this may not be the best place to ask that but , I give it a try.
I am using a SAMA5D2 board.

I was wondering how I can add additionnal packages and functionnalities to my board. Since the demo Image provides a very basic version of Linux. The only package manager I have is opkg and there is no Atmel opkg repository specified in opkg.conf

Has someone ever tried something like this?

Thanks in adavance for your help.

Anne

sam9x60_early branch report undefined reference to `get_cm_rev'

I configured bootstrap using :
$make at91sam9x60eksd_uboot_defconfig
then use menuconfig to chose boot memory to nand flash, compiled the codes, it shew error as below:

/home/emy/microchip/at91bootstrap/board/at91sam9x60ek/at91sam9x60ek.o: In function nandflash_hw_init': /home/emy/microchip/at91bootstrap/board/at91sam9x60ek/at91sam9x60ek.c:309: undefined reference to get_cm_rev'
/home/emy/microchip/at91bootstrap/board/at91sam9x60ek/at91sam9x60ek.c:342: undefined reference to `get_cm_rev'

AT91SAM9G45 boot hang / bricked

Hi,

We are using an AT91SAM9G45 processor in one of our products. We have a lot of problems with this product being bricked, which we can fix pretty easily in house by disconnecting the backup battery. This seems to be a known issue on said processor.

Now we have started to research this problem and we have found a way to reproduce something that looks like the same behaviour by switching the unit off while still in the AT91Bootstrap phase (say 1 out of 3 reboots) and to a lesser extent while booted further than AT91Bootstrap (say 1 out of 100 times). Also we noticed that the problem does not occur with the older version of the bootloader, 1.16 (the version showing this problem is 3.8.7). Some of the differences we found between these versions are:

  • The old version leaves the internal RC running even though it switches to the crystal oscillator as slow clock

  • The old version does not enable external reset, which the new version does.

Seems unrelated, but the old version does not enable the PIT timer

  • So far we tried reproducing the issue under the following conditions:

Leaving the internal RC running: improves the rate of bricked units from 1 out of 3 into about 1 out of 5, not such a huge improvement

Leaving the external reset disabled: improves the rate of bricked units from 1 out of 3 into about 1 out of 25, a significant improvement but still not near as good as the old AT91bootstrap version

A combination of both aforementioned changes: rate of bricked units remains at 1 out of 3, very strange.

Enabling the internal RC and leaving the external oscillator disabled: rate of bricked units improves to 1 out of 1150, a immense improvement, but we are reluctant to actually use this as we want to use the RTC if possible. Also, the problem still isn't solved completely.

We introduced the new bootstrap version to our products to enable ECC, but so far it seems to have caused more issues than it has solved. Is there a known issue with version 3.8.7 that we need to know about? If so, which version or patch might fix this? Could anybody point me into the right direction?

Thanks!

SAMA5D2 Xplained SD card boot fails

Current master sama5d2_xplainedsd_uboot_defconfig fails to load u-boot.bin as follows:

AT91Bootstrap 3.8.6-00008-gb04fe6ffd399 (Thu Oct  6 15:29:25 IDT 2016)

EEPROM: Loading AT24xx information ...
EEPROM: BoardName | [Revid] | VendorName
  #0  SAMA5D2-XULT [AA1]      ATMEL-RF0

EEPROM: Board sn: 0xd300000 revision: 0x200000

SD/MMC: Image: Read file u-boot.bin to 0x26f00000
*** FATFS: f_open, filename: [u-boot.bin]: error
SD/MMC: Failed to load image

Switching back to v3.8.6 fixed this issue for me. Successful boot log follows:

AT91Bootstrap 3.8.6 (Thu Oct  6 17:13:00 IDT 2016)

EEPROM: Loading AT24xx information ...
EEPROM: BoardName | [Revid] | VendorName
  #0  SAMA5D2-XULT [AA1]      ATMEL-RF0

EEPROM: Board sn: 0xd300000 revision: 0x200000

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

Contrib folder removed in v4.x

I am building code for a custom board using the sama5d2. My builds have broken after the at91bootstrap v4.x release.
In v3.x, I added my custom board config to a contrib/subfolder, much like Acme Systems did. That folder has been removed in v4.x.

Is this an oversight, or is there now a new way to properly add custom board configs?

Configuration of OSMC RAM Scrambling

As I noted some times ago in the forum, the SAMA5d3 datasheet describes the opportunity to use the RAM scrambler. OCMS Register in chapter 29.5.5 in the datasheet

I didn't found support for this in at91bootstrap. (did I miss it maybe?)
Would it be interesting/mergable to propose some config items and a minimal driver for this feature, similar to the other secure boot related configs?

problem loading uboot from emmc

Hello,
we have a board based on SAMA5D27-SOM1-EK, (SAMA5D27-SOM1 + our baseboard) and we have SD card slot connected to MMC1 and eMMC on MMC0 interface. We have aplan to use eMMC on our final system and remove SD slot.

Problem is that we can't boot from eMMC:

  • at91bootstrap is compiled for mmc0 interface
  • u-boot is compiled for mmc0 interface

eMMC is partitioned via linux running on SD card using fdisk and mkfs:

/dev/mmcblk0: PTUUID="af1781b8" PTTYPE="dos"
/dev/mmcblk0p1: SEC_TYPE="msdos" UUID="7927-AEB6" TYPE="vfat" PARTUUID="af1781b8-01"
/dev/mmcblk0p2: UUID="c37028ac-7bda-4392-a260-93f2148fd5fa" TYPE="ext4" PARTUUID="af1781b8-02"


mmcblk0      179:0    0  7.3G  0 disk 
├─mmcblk0p1  179:1    0  256M  0 part /mnt/emmc1
└─mmcblk0p2  179:2    0    7G  0 part /mnt/emmc2

When we try to boot from eMMC, we are getting next message:

AT91Bootstrap 3.8.12-00001-g9a4293f (чет, 25. јул 2019.  13:32:32 CEST)

All interrupts redirected to AIC
SD/MMC: Image: Read file u-boot.bin to 0x23f00000
MMC: ADMA supported
*** FATFS: f_open, filename: [u-boot.bin]: error
SD/MMC: Failed to load image

Conncetions between eMMC and MCU (PA0 ~ PA5 and PA10 for MMC_RST):

image

supports hardware watchdog?

Hello:

The first line code in hw_init, it close watch dog. But sometimes, can NOT disable watchdog because they are hardware circuit. for example: SP706TEN.

Will the bootstrap supports hardware (or software) watchdog?

SAMA5D2 Xplained SD highspeed sd cards issue using at91bootstrap v4.0.1

the current code has some anomaly that I am investigating and wanted to report. The sd card used is a Kingston canvas select plus 32 GB. After the SW reboot (at the first start-up everything works properly) of the card the SSBL is unable to load the UBoot as it happens in issues such as 44, and 98.

I attach the log obtained as well as the patch applied on this version to obtain the traces as follows.

AT91Bootstrap 4.0.1-dirty (2021-12-09 14:45:31)

EEPROM: Loading AT24xx information ...
EEPROM: BoardName | [Revid] | VendorName
  #0  SAMA5D2-XULT [AC1]      ATMEL-RFO
EEPROM: BoardDate | Year | Week
EEPROM:             2014    1

EEPROM: Board sn: 0xd300000 revision: 0x600000

SD/MMC: Image: Read file u-boot.bin to 0x26f00000
MMC: ADMA supported
SD: Card Capacity: High or Extended
sdcard identification success
SD: Specification Version 3.0X
Specification version reported
High speed device
Error checking switched function
Error switching to high speed capabilities
Error initializing mmc/sd
*** FATFS: f_open, filename: [u-boot.bin]: error code 3
SD/MMC: Failed to load image
diff --git a/driver/mci_media.c b/driver/mci_media.c
index ff2cce2..191d344 100644
--- a/driver/mci_media.c
+++ b/driver/mci_media.c
@@ -438,7 +438,10 @@ static int sd_switch_func_high_speed(struct sd_card *sdcard)
 
 	ret = switch_check_hs_busy_status_supported(sdcard, &support);
 	if (ret)
+        {
+                dbg_info("Error checking busy status supported\n");
 		return ret;
+        }
 
 	if (!support) {
 		dbg_info("SD: Not support hs function switch\n");
@@ -452,15 +455,23 @@ static int sd_switch_func_high_speed(struct sd_card *sdcard)
 				SD_SWITCH_FUNC_HS_SDR25,
 				switch_func_status);
 	if (ret)
+        {
+                dbg_info("Error setting operation mode\n");
 		return ret;
+        }
+
 
 	/* Check Switched function */
 	status = swap_uint32(switch_func_status[4]);
 	if ((status >> 24) & 0x01) {
 		sdcard->highspeed_card = 1;
 		return 0;
-	} else
+	}
+        else
+        {
+                dbg_info("Error checking switched function\n");
 		return -1;
+        }
 }
 
 static int sd_card_set_bus_width(struct sd_card *sdcard)
@@ -890,8 +901,12 @@ static int sdcard_identification(struct sd_card *sdcard)
 		 */
 		dbg_info("Unusable Card\n");
 		return -1;
-	} else
+	}
+        else
+        {
+                dbg_info("Unknow card error\n");
 		return ret;
+        }
 
 	sdcard->highcapacity_card = (sdcard->reg->ocr & OCR_HCR_CCS) ? 1 : 0;
 
@@ -936,7 +951,7 @@ static int sdcard_identification(struct sd_card *sdcard)
 
 	sdcard->read_bl_len = DEFAULT_SD_BLOCK_LEN;
 
-	dbg_very_loud("sdcard_identification success\n");
+	dbg_info("sdcard identification success\n");
 	return 0;
 }
 
@@ -985,11 +1000,17 @@ static int sd_initialization(struct sd_card *sdcard)
 		dbg_info("1.0 and 1.01\n");
 	}
 
+        dbg_info("Specification version reported\n");
+
 	if (host->caps_high_speed) {
-		if (sdcard->sd_spec_version != SD_VERSION_1_0) {
+		dbg_info("High speed device\n");
+                if (sdcard->sd_spec_version != SD_VERSION_1_0) {
 			ret = sd_switch_func_high_speed(sdcard);
 			if (ret)
+                        {
+                                dbg_info("Error switching to high speed capabilities\n");
 				return ret;
+                        }
 		}
 	}
 
@@ -1000,10 +1021,14 @@ static int sd_initialization(struct sd_card *sdcard)
 			host->ops->set_clock(sdcard, 25000000);
 	}
 
+
 	/* Change the bus mode */
 	ret = sd_card_set_bus_width(sdcard);
 	if (ret)
+        {
+                dbg_info("Error setting bus width\n");
 		return ret;
+        }
 
 	return 0;
 }
@@ -1132,14 +1157,21 @@ int sdcard_initialize(void)
 	/* Card Indentification Mode */
 	ret = sdcard_identification(sdcard);
 	if (ret)
+        {
+                dbg_info("Error identifying card\n");
 		return ret;
+        }
 
 	if (sdcard->card_type == CARD_TYPE_SD)
-		ret = sd_initialization(sdcard);
+                ret = sd_initialization(sdcard);
 	else
 		ret = mmc_initialization(sdcard);
-	if (ret)
+
+        if (ret)
+        {
+                dbg_info("Error initializing mmc/sd\n");
 		return ret;
+        }
 
 	return 0;
 }
diff --git a/driver/sdcard.c b/driver/sdcard.c
index b63149f..01fa931 100644
--- a/driver/sdcard.c
+++ b/driver/sdcard.c
@@ -25,7 +25,7 @@ static int sdcard_loadimage(char *filename, BYTE *dest)
 
 	fret = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
 	if (fret != FR_OK) {
-		dbg_info("*** FATFS: f_open, filename: [%s]: error\n", filename);
+		dbg_info("*** FATFS: f_open, filename: [%s]: error code %d\n", filename, fret);
 		ret = -1;
 		goto open_fail;
 	}
@@ -62,8 +62,7 @@ static int sdcard_read_cmd(char *cmdline_file, char *cmdline_args)
 
 	fret = f_open(&file, cmdline_file, FA_OPEN_EXISTING | FA_READ);
 	if (fret != FR_OK) {
-		dbg_info("*** FATFS: f_open, filename: [%s]: error\n", 
-                                                                  cmdline_file);
+		dbg_info("*** FATFS: f_open, filename: [%s]: error code %d\n", cmdline_file, fret);
                 ret = -1;
 		goto open_fail;
 	}

Thank you in advance for your help @ehristev

if ((status >> 24) & 0x01) {

make oldconfig infinite loop with SPI_IOSET

If you try to use make oldconfig on a device that uses dataflash, but does not set SPI_IOSET_MAX (e.g. sama5d3xekdf_uboot_defconfig) you end up stuck in an infinite loop when reaching SPI_IOSET. No value can be accepted, not even the default of 0. This problem will cause the Yocto meta-atmel/at91bootstrap recipe to fail spectacularly by appending to an infinitely long log file until your disk fills up... (I caught it at 8GB before doing so, thankfully)

The culprit is in driver/Config.in.dataflash:

if SPI_IOSET_MAX != 1
config SPI_IOSET
int "SPI IOSET Used for Dataflash"
range 1 SPI_IOSET_MAX
default 1
endif

That does the wrong thing if SPI_IOSET_MAX is undefined, and creates an unsolvable range (1, 0). It needs to be corrected to check for the existence of SPI_IOSET_MAX first:

if SPI_IOSET_MAX
...
endif

This correction worked for me, but I don't know if there is better syntax.

blinking led program is not working with Bootstrap code.

Hello sir..
I'm using a AT91SAM9X35-evm BOARD and i'm loading simple led blinking program on 0x00 position through sam-ba software it is working fine...but when i use your bootstrap then program won't work.i'm loading bootstrap program at 0x00 position and led program at 4200 location through sam-ba software ..is their any need to change location of bootstrap program and led application program????......
**** : I clone bootstrap repository...after that i follow your step to generate binary....i generate binary for serial flash.

How feasible is adding an u-boot like environment to at91bootstrap

Hi,

we have a board which is similar to at91sam9m10g45ek. We currently have at91bootstrap as second stage bootloader and u-boot as third stage bootloader. We want to update u-boot whenever it is necessary and want it failsafe, so we duplicate u-boot.

Or do you think the u-boot bootloader is not necessary at all for at91sam9m10g45ek ( it is a old project). We use u-boot for the linux update using the swupdate tool.

We are thinking about implementing a u-boot like environment where we can set and get variables. How feasible do you think this is and maybe point us in the right direction.

Thanks for sharing

Why the pin NANDRDY is not initialized in nandflash_hw_init()?

https://github.com/linux4sam/at91bootstrap/blob/master/board/sama5d2_ptc_ek/sama5d2_ptc_ek.c#L375

I was unable to grep NANDRDY in at91booststrap sources anywhere, but it seems this pin is required for NAND flash controller operations. Is it missing deliberately or by mistake?

Quoting SAMA5D2 and NAND chip datasheets:
NANDRDY NAND Flash Ready/Busy Input –
READY/BUSY OUTPUT The R/B# output indicates the status of the device operation. When low, it indicates that a program, erase or random read operation is in progress and returns to high state upon completion. It is an open drain output and does not float to high-z condition when the chip is deselected or when outputs are disabled.

unable to make config

hello,
I go through your data,as you said need to configure that from root directory but i unable to configure that from root can you plz help me to sort out this issue..
thank you !!!!

v4 fails to load Linux kernel

I am still trying to use AT91Bootstrap 4 to boot the Acqua SoM from Acme Systems. This time it builds smoothly, but fails to load the Linux kernel.

Here is my defconfig:

CONFIG_SAMA5D3X=y
CONFIG_CPU_CLK_528MHZ=y
CONFIG_DEBUG=y
CONFIG_DEBUG_VERY_LOUD=y
CONFIG_SDCARD=y
CONFIG_LOAD_LINUX=y
CONFIG_IMAGE_NAME="zImage"

In order to get a complete system, I used Buildroot 2021.05-rc2 (with some extra packages):

  • built with acmesystems_acqua_a5_512mb_defconfig, which is based on AT91Bootstrap 3
  • flashed output/images/sdcard.img into a microSD card
  • tested this configuration → it works
  • mounted the boot partition of the card on my computer, and there:
    • replaced boot.bin (AT91Bootstrap 3) with the newly built bootloader (build/binaries/sama5d3-sdcardboot-linux-zimage-dt-4.0.0-rc2.bin)
    • renamed the device tree: at91-sama5d3_acqua.dtb → sama5d3.dtb, as this is the name the new bootloader expects
  • tested again → fail

Here is the “very loud” log of the console output:

RomBOOT
 ba_offset = 0xa ...

Dump DDRAMC Registers:
@address: 0x0 0x4 0x8 0xc
0xffffea00: 0x0 0x30081e 0xc00034 0x22228226
0xffffea10: 0x21b0c0a 0x62262 0x33338 0x10000
0xffffea20: 0x16 0x8 0x0 0x0
0xffffea30: 0x6 0x70404 0x0 0x0
0xffffea40: 0x0 0x8030a 0x8030a 0x8030a
0xffffea50: 0x8030a 0x0 0x0 0x1
0xffffea60: 0x0 0x0 0x1 0x0
0xffffea70: 0x0 0x0 0x0 0x3d00
0xffffea80: 0xf00 0xf00 0xf00 0xf00
0xffffea90: 0x300 0x0 0x0 0x0
0xffffeaa0: 0x0 0x0 0x0 0x0
0xffffeab0: 0x0 0x0 0x0 0x0
0xffffeac0: 0x0 0x0 0x0 0x0
0xffffead0: 0x0 0x0 0x0 0x0
0xffffeae0: 0x0 0x0 0x0 0x200
0xffffeaf0: 0x484d5044 0x44524320 0x0 0x10140
0xffffeb00: 0x0 0x0 0x0 0x0
0xffffeb10: 0x0 0x0 0x0 0x0
0xffffeb20: 0x0 0x0 0x0 0x0
0xffffeb30: 0x0 0x0 0x0 0x0
0xffffeb40: 0x0 0x0 0x0 0x0
0xffffeb50: 0x0 0x0 0x0 0x0


AT91Bootstrap 4.0.0-rc2-00012-gffd4b694 (2021-05-27 15:46:29)

SD/MMC: Image: Read file zImage to 0x22000000
mmc_verify_operating_condition
Cmd: 1 Response Time-out
SD: Card Capacity: High or Extended
sd card identified with CID = 0x1391780 0x281dc750 0x36344703 0x574457ff
sdcard_identification success
SD: Specification Version 3.0X
SD/MMC: dt blob: Read file sama5d3.dtb to 0x21000000
KERNEL: try as zImage: magic=0x0
KERNEL: try as uImage: magic=0xff7f
KERNEL: Got unsupported magic!
	as uImage magic: 0xff7f
	as zImage magic: 0x0
SD/MMC: Failed to load image

It seems to be complaining about an incorrect magic number. However, the magic seems fine to me. According to load_kernel.c, the expected value is 0x016f2818 at offset 0x0024, and this is indeed what I have (in little endian order):

$ hd -v /media/edgar/1E71-A9DE/zImage | head -4
00000000  00 00 a0 e1 00 00 a0 e1  00 00 a0 e1 00 00 a0 e1  |................|
00000010  00 00 a0 e1 00 00 a0 e1  00 00 a0 e1 00 00 a0 e1  |................|
00000020  05 00 00 ea 18 28 6f 01  00 00 00 00 d0 4e 47 00  |.....(o......NG.|
00000030  01 02 03 04 45 45 45 45  80 3b 00 00 00 90 0f e1  |....EEEE.;......|

Any hint on how to tackle this issue would be appreciated.

problem loading uboot from emmc

Hello,
we have a board based on SAMA5D4 xplained and we have SD card slot connected to MMC1 and eMMC on MMC0 interface. eMMC - SDINBDG4-8G.

Problem is that we can't boot from eMMC:

at91bootstrap is compiled for mmc0 interface
u-boot is compiled for mmc0 interface

eMMC is partitioned via linux running on SD card using fdisk and mkfs:
mmcblk0p1
mmcblk0p2
When we try to boot from eMMC, we are getting next message:
RomBOOT

MATRIX64:
MATRIX_SRTSR0: 0x0, MATRIX_SASSR0: 0x0, MATRIX_SSR0: 0x0
MATRIX_SRTSR1: 0x0, MATRIX_SASSR1: 0xf, MATRIX_SSR1: 0x10101
MATRIX_SRTSR2: 0x0, MATRIX_SASSR2: 0x8, MATRIX_SSR2: 0x10101
MATRIX_SRTSR3: 0x0, MATRIX_SASSR3: 0xf, MATRIX_SSR3: 0x0
MATRIX_SRTSR4: 0xf, MATRIX_SASSR4: 0xffff, MATRIX_SSR4: 0xf0f0f
MATRIX_SRTSR5: 0xf, MATRIX_SASSR5: 0xffff, MATRIX_SSR5: 0xf0f0f
MATRIX_SRTSR6: 0xf, MATRIX_SASSR6: 0xffff, MATRIX_SSR6: 0xf0f0f
MATRIX_SRTSR7: 0xf, MATRIX_SASSR7: 0xffff, MATRIX_SSR7: 0xf0f0f
MATRIX_SRTSR8: 0xf, MATRIX_SASSR8: 0xffff, MATRIX_SSR8: 0xf0f0f
MATRIX_SRTSR9: 0xf, MATRIX_SASSR9: 0xffff, MATRIX_SSR9: 0xf0f0f
MATRIX_SRTSR10: 0xf, MATRIX_SASSR10: 0xffff, MATRIX_SSR10: 0xf0f0f
MATRIX_SRTSR11: 0x0, MATRIX_SASSR11: 0x4, MATRIX_SSR11: 0x0
MATRIX_SRTSR12: 0x0, MATRIX_SASSR12: 0xf, MATRIX_SSR12: 0x10101

MATRIX32:
MATRIX_SRTSR0: 0x0, MATRIX_SASSR0: 0xf, MATRIX_SSR0: 0x10101
MATRIX_SRTSR1: 0x0, MATRIX_SASSR1: 0xf, MATRIX_SSR1: 0x10101
MATRIX_SRTSR2: 0x0, MATRIX_SASSR2: 0xf, MATRIX_SSR2: 0x10101
MATRIX_SRTSR3: 0xf000000, MATRIX_SASSR3: 0xff000000, MATRIX_SSR3: 0xc0c0c0
MATRIX_SRTSR4: 0x0, MATRIX_SASSR4: 0x1, MATRIX_SSR4: 0x10101
MATRIX_SRTSR5: 0x0, MATRIX_SASSR5: 0x888, MATRIX_SSR5: 0x70707
MATRIX_SRTSR6: 0x0, MATRIX_SASSR6: 0x8, MATRIX_SSR6: 0x10101

MATRIX32
MATRIX_SPSELR(0): 0xe7cd2504
MATRIX_SPSELR(1): 0x21dfd37d
MATRIX_SPSELR(2): 0xfffffffa

_MATRIX64
MATRIX_SPSELR(0): 0xfffadafb
MATRIX_SPSELR(1): 0xffffffff
MATRIX_SPSELR(2): 0xffffffe7
ba_offset = 0xc ...

Dump DDRAMC Registers:
@address: 0x0 0x4 0x8 0xc
0xf0010000: 0x0 0x30030e 0xd0003d 0x2233b338
0xf0010010: 0xb20a928 0x92328 0x33338 0x10000
0xf0010020: 0x6 0x50008 0x0 0x0
0xf0010030: 0x6 0x60514 0x0 0x0
0xf0010040: 0x0 0x0 0x0 0x0
0xf0010050: 0x0 0x0 0x0 0x2
0xf0010060: 0x8030a 0x8030a 0x8030a 0x8030a
0xf0010070: 0x0 0x0 0x0 0x0
0xf0010080: 0x0 0x1 0x0 0x0
0xf0010090: 0x2 0x0 0x0 0x0
0xf00100a0: 0x0 0x0 0x0 0x0
0xf00100b0: 0x0 0x0 0x0 0x0
0xf00100c0: 0x0 0x0 0x0 0x0
0xf00100d0: 0x0 0x0 0x0 0x0
0xf00100e0: 0x0 0x0 0x0 0x4000
0xf00100f0: 0x484d5044 0x44524320 0x0 0x210
0xf0010100: 0x0 0x0 0xc0d0c0c 0xa0a0a0a
0xf0010110: 0x3040203 0x7 0x8008201 0x0
0xf0010120: 0x0 0x0 0x1400 0x1400
0xf0010130: 0x1300 0x1400 0x1600 0x1600
0xf0010140: 0x1600 0x1600 0x1d 0x1e
0xf0010150: 0x1c 0x1d 0x19 0x0
Auto-Config the TWI Bus by the board

AT91Bootstrap 3.8.13-dirty (п║я─пЄ я▐пҐп╡ 15 12:01:34 EET 2020)

All interrupts redirected to AIC
EEPROM: Loading AT24xx information ...
EEPROM: BoardName | [Revid] | VendorName
twi read: timeout to wait RXRDY bit on bus 0
EEPROM: Failed to read

EEPROM: Using default information

EEPROM: Board sn: 0x1012420 revision: 0x680820

twi read: timeout to wait RXRDY bit on bus 0
SiI9022: Failed to read on TWI bus: 0
SiI9022: Failed to 0x1b
twi read: timeout to wait RXRDY bit on bus 0
SiI9022: Failed to read on TWI bus: 0
SiI9022: Failed to 0x1b
twi read: timeout to wait RXRDY bit on bus 0
SiI9022: Failed to read on TWI bus: 0
SiI9022: Failed to 0x1b
twi read: timeout to wait RXRDY bit on bus 0
SiI9022: Failed to read on TWI bus: 0
SiI9022: Failed to 0x1b
twi read: timeout to wait RXRDY bit on bus 0
SiI9022: Failed to read on TWI bus: 0
SiI9022: Failed to 0x1b
twi read: timeout to wait RXRDY bit on bus 0
SiI9022: Failed to read on TWI bus: 0
SiI9022: Failed to 0x1b
twi read: timeout to wait RXRDY bit on bus 0
SiI9022: Failed to read on TWI bus: 0
SiI9022: Failed to 0x1b
twi read: timeout to wait RXRDY bit on bus 0
SiI9022: Failed to read on TWI bus: 0
SiI9022: Failed to 0x1b
twi read: timeout to wait RXRDY bit on bus 0
SiI9022: Failed to read on TWI bus: 0
SiI9022: Failed to 0x1b
twi read: timeout to wait RXRDY bit on bus 0
SiI9022: Failed to read on TWI bus: 0
SiI9022: Failed to 0x1b
SiI9022: Not found
PHY: ETH0 PHY: Enter power down mode
twi read: timeout to wait RXRDY bit on bus 3
twi read: timeout to wait RXRDY bit on bus 3
twi read: timeout to wait RXRDY bit on bus 3
Zh_121: main.c Call function ret = (*load_image)(&image)
Zh_127: sdcard.c Call function at91_mci0_hw_init()
Zh_703: sama5d4_xplained.c const struct pio_desc mci_pins[]
xplained mci0 v4
SD/MMC: Image: Read file u-boot.bin to 0x26f00000
Zh_43: sdcard.c We are in function sdcard_loadimage()
Zh_2256: ff.c We are in function f_open()
Zh_2269: ff.c Call function chk_mounted()
Zh_2023: ff.c *p == u-boot.bin
Zh_2056: ff.c fs->drv == 0
Zh_24: diskio.c Call function disk_initialize
Zh_1111: mci_media.c We are in function sdcard_initialize()
Zh_1123: diskio.c Call function sdcard_register_at91_mci(sdcard)
Zh_398: at91.mci.c 1
Zh_403: at91.mci.c 2
Zh_1134: mci_media.c ret = sdcard_identification(sdcard)
Zh_553: mci_media.c ocr = command->resp[0] | OCR_ACCESS_MODE_SECTOR; = 1073741824
Zh_879: mci_media.c mmc_verify_operating_condition(sdcard) == -12
Unusable Card
Zh_1136: mci_media.c ret == -1
Zh_2272: ff.c res == 3
Zh_51: sdcard.c fret == 3
*** FATFS: f_open, filename: [u-boot.bin]: error
Zh_132: main.c Call function load_image_done(ret);
SD/MMC: Failed to load image

I added many outputs to know how my program work.
And I did all from #98.
eMMC

SiP: SoC dependent RAM init

The SAMA5D2 SiP variants ATSAMA5D27C-D5M and ATSAMA5D27C-D1G have the same pin/ball layout and are mostly the same, but differ only in RAM attached, so it is possible to use one or the other on a PCB (we did that already by accident).

Those chips can be distinguished by reading chip id from CIDR register, the values are SAMA5D27C_D1G_EXID and SAMA5D27C_D5M_EXID for this example. The bootstrap could do matrix and memory init (or is there more?) based on the actual variant found. However currently the menu only allows to select one specific memory size, there's no flexibility.

Would it be possible to extend the bootstrap in a way it could detect drop-in compatible SoC variants and act depending on what was detected?

driver/sdram.c: Potential breakage due to naive code

The file has instances like

/* Pause cycles */
for (i = 0; i < 1000; i++) ;

which a reasonable compiler would just optimize away. Proper waiting with e.g. PIT-based timer would resolve this.

I found this while looking into at91bootstrap boot-time breakage on older ARM9-based SoC customer experienced with updated toolchain. It was decided to move to barebox as first stage bootloader as it's already used for second stage. Just dropping an issue here as a heads up.

Cheers,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.