at91bootloader binaries

For SAMA5D2 Xplained, SAMA5D3 Xplained and SAMA5D4 Xplained

Moderator: nferre

Posts: 8
Joined: Fri Oct 13, 2017 9:52 pm

at91bootloader binaries

Wed Nov 08, 2017 7:33 am

Using the instructions from the sama5d4 page for the At91Bootstrap, after building, I can indeed see the files under "binaries" as it says, which are:


I then looked at the demo's file, called at91bootstrap-sama5d4_xplained.bin, and when compared (using a binary file viewer) to the files I built, the first 3 appear the be nearly identical to the at91bootstrap-sama5d4_xplained.bin file. However, the files I built appear to be "Link to Program" files (under Type) and will not flash, whereas the at91bootstrap-sama5d4_xplained.bin file appears to be a "ready to flash" and, for lack of better words, a "true" .bin file.

Which file should I use, moreover, is there something more I need to do to my files to get a true binary file like the one used in the demo?

I'm sure it's a trivial problem, but I'm now running in circles at this point with documentation and trying to figure this out.

Site Admin
Posts: 167
Joined: Wed Feb 14, 2007 11:17 am

Re: at91bootloader binaries

Wed Nov 08, 2017 10:31 am

sama5d4_xplained-nandflashboot-uboot-3.8.9.bin is the binary. The other ones are links to this binary file. They are created to ease user's life by providing a kind of "alias" with simpler names (BOOT.BIN is the file directly used by the RomCODE while loading files from SD Card). By reading your post, I realize that it's not always easier ;-)
Link is a common concept in UNIX/Linux filesystems.

Posts: 8
Joined: Fri Oct 13, 2017 9:52 pm

Re: at91bootloader binaries

Sat Jan 20, 2018 9:23 pm

They are created to ease user's life by providing a kind of "alias" with simpler names
I'm curious how to get to the easier life! If I'm running sam-ba to flash the entire thing in one shot, will a qml script (see below) be able to use that link automatically? (I'd try it, but I'm at a point where I've got the debug carefully set up at the moment).

################## Samba Script ##################
import SAMBA 3.2
import SAMBA.Connection.Serial 3.2
import SAMBA.Device.SAMA5D4 3.2

SerialConnection {

device: SAMA5D4Xplained {
config {
nandflash {
header: 0xc1e04e07
function getEraseSize(size) {
/* get smallest erase block size supported by applet */
var eraseSize
for (var i = 0; i <= 32; i++) {
eraseSize = 1 << i
if ((applet.eraseSupport & eraseSize) !== 0)
eraseSize *= applet.pageSize

/* round up file size to erase block size */
return (size + eraseSize - 1) & ~(eraseSize - 1)

function eraseWrite(offset, filename, bootfile) {
/* get file size */
var file =, false)
var size = file.size()

applet.erase(offset, getEraseSize(size))
applet.write(offset, filename, bootfile)

onConnectionOpened: {
var dtbFileName = "at91-sama5d4_xplained.dtb"
var ubootEnvFileName = "u-boot-env.bin"

// initialize Low-Level applet
print("-I- === Initilize low level (system clocks) ===")

// intialize extram applet (needed for sam9)
print("-I- === Initialize extram ===")

print("-I- === Initialize nandflash access ===")

// erase then write files
print("-I- === Load AT91Bootstrap ===")
eraseWrite(0x00000000, "at91bootstrap-sama5d4_xplained.bin", true)

print("-I- === Load u-boot environment ===")
//erase redundant env to be in a clean and known state
applet.erase(0x00100000, getEraseSize(0x20000))
eraseWrite(0x00140000, ubootEnvFileName)

print("-I- === Load u-boot ===")
eraseWrite(0x00040000, "u-boot-sama5d4-xplained.bin")

print("-I- === Load device tree database ===")
eraseWrite(0x00180000, dtbFileName)

print("-I- === Load Kernel image ===")
eraseWrite(0x00200000, "zImage-sama5d4-xplained.bin")

print("-I- === Load root file-system image ===")
applet.erase(0x00800000, applet.memorySize - 0x00800000)
applet.write(0x00800000, "atmel-xplained-demo-image-sama5d4-xplained.ubi")

print("-I- === Done. ===")

Return to “SAMA5 Xplained”

Who is online

Users browsing this forum: No registered users and 1 guest