Introduction
In this topic, you will configure and program the SAM9X60-EK evaluation kit to boot from an external SD Memory Card. You will write a pre-built image to an SD Memory Card using the SAM-BA® In-System Programmer (ISP). The image will contain the second-stage bootloader at91bootstrap, third-stage bootloader u-boot-at91, u-boot environment, the Flattened Image Tree (FIT) (containing the Linux® kernel and Device Tree), and Root File System (RFS).
Steps:
Prerequisites
Familiar with the features of the SAM9X60-EK evaluation kit:
Familiar with the operation of the SAM-BA ISP:
Setup Console Serial Communications with the SAM9X60-EK:
Knowledge of the Boot Process
- SAM9X60 Datasheet (Section 12 – Boot Strategies)
Hardware
For this topic, you will be using the SAM9X60-EK. You will also need two USB Micro-B cables. One cable will connect the Host PC to the target console to view the SAM-BA Monitor log message. The second cable will connect the Host PC to the target USBA port (J7) so that the SAM-BA Host can communicate with the SAM-BA Monitor.
Bootable Memory
The SAM9X60-EK has an SD Memory Card slot (J4) where you will insert your SD Memory Card after flashing an image to it. In this training topic, you will use the SAM-BA ISP to write the image to the SD Memory Card.
SAM-BA ISP
In this section, you will load the SAM-BA Host Application (if you have not already done so) and setup Console and SAM-BA Host to Monitor communications.
1
Setup SAM9X60-EK Console Serial Communications
To view the SAM-BA Monitor log messages, setup console serial communications following the instructions in the topic: SAM9X60-EK Console Serial Communications
You have two choices in connecting to a serial port on the SAM9X60-EK:
- The first is using a USB cable to connect to the J-LINK-OB port (J22). This method has the added benefit of powering the SAM9X60-EK.
- The second is using a USB-to-TTL converter to connect to the Universal Asynchronous Receiver Transmitter (UART) Debug port (J24). To power the SAM9X60-EK, you will need to:
- Use an external 5 VDC power supply connected to J1 (coaxial power jack), or
- Use a USB cable connect to the USBA port (J7).
Operation of the J-Link Debugger will be displayed by a green LED (D9).
2
If it is not already installed, install the SAM-BA Host Application.
SAM-BA ISP should be added to the system PATH variable.
$ export PATH=$PATH:<path_to_sam-ba>
This will enable you to access the SAM-BA ISP from anywhere on your system.
3
Setup the SAM-BA Host to Monitor Serial Communications
a
To communicate with SAM-BA Monitor on the target, you must have installed the SAM-BA Host on a Linux PC (Step 2 above), and connect a USB Micro-B cable from the host PC to the USBA port (J7) on the SAM9X60-EK as shown in the figure below.
You may power the SAM9X60-EK one of two ways:
- Using an external 5 VDC power supply connected to J1 (coaxial power jack), or
- Using a USB cable connect to the USBA port (J7).
b
Ensure there is no SD Memory Card inserted in slot J4.
c
Close the DIS_BOOT (J13) jumper.
Closing this jumper prevents booting from external memories such as QSPI and NAND Flash.
d
Press the Reset button (SW3).
Observe ROMBoot on the Console (terminal emulator) indicating the SAM-BA Monitor is running.
Write Image to SD Memory Card
In this section, you will download a demonstration image from the Linux4sam website and write the image to an SD Memory Card using the SAM-BA ISP.
1
Download the SAM9X60-EK demonstration image from the Linux4SAM website.
The latest demonstration images for the SAM9X60-EK are available on the Linux4SAM website.
There you will find three sets of images created from one of three Build Systems:
- The Yocto Project
- Buildroot
- OpenWRT
Any of the images can be used for this step. If you are undecided, choose the linux4sam-buildroot-sam9x60ek-headless file and extract the image.
3
Write the demo image to SD Memory Card.
Execute the following command in the command window (command line interface):
$ sam-ba -p serial -b sam9x60-ek -a sdmmc -c write:linux4sam-buildroot-sam9x60ek-headless-2020.04.img
Opening serial port 'ttyACM0'
Connection opened.
Detected memory size is 7948206080 bytes.
Page size is 512 bytes.
Buffer is 9728 bytes (19 pages) at address 0x0030a840.
Executing command 'wrie:linux4sam-buildroot-sam9x60ek-headless-2020.04.img'
Wrote 9728 bytes at address 0x00000000 (0.00%)
Wrote 9728 bytes at address 0x00002600 (0.00%)
..
..
Wrote 9728 bytes at address 0x410fe000 (100.00%)
Wrote 8192 bytes at address 0x410fe000 (100.00%)
Connection closed.
Boot from SD Memory Card
Check that:
- Console serial communications are working properly.
- The SD Memory Card is inserted into slot J4.
- Ensure the DIS_BOOT jumper (J13) is CLOSED. This will prevent the MPU from booting from QSPI or NAND Flash memory.
The Disable Boot mechanism of Jumper J13 does not disable booting from the SD Memory Card. The user must remove the SD Memory Card to prevent booting from it.
1
With all preparations completed, press the Reset button (SW3).
Congratulations! You have booted an embedded Linux system on the SAM9X60-EK evaluation kit using an SD Memory Card as external mass memory.
Summary
In this training topic, you prepared a Host PC to run the SAM-BA ISP, connected the Host PC to the SAM9X60-EK evaluation kit (the Target), and flashed a demonstration image to an SD Memory Card using the SAM-BA ISP. Finally, you booted the Linux operating system on the SAM9X60-EK.