# Rugged board A5D2x

## Documents:&#x20;

Rugged Board data : [here](https://tftp.yoctotutor.com/elinux/rba5d2x/RB-A5D2x.zip)

SoC : sama5d2x : Details: [here](https://www.microchip.com/wwwproducts/en/ATSAMA5D22)   Datasheet: [here](https://ww1.microchip.com/downloads/en/DeviceDoc/SAMA5D2-Series-Data-sheet-ds60001476G.pdf)

## How to make arm hardware (rugged board) ?

Rugged board  makes with&#x20;

microchip SoC sama5d2x + (PMIC & ext RAM & NOR flash) + ext periperals(eth,usb,expansion card,etc)

| Name | name               | features | docs |
| ---- | ------------------ | -------- | ---- |
| SoC  | sama5d2x           |          | ref  |
| SoM  | phycore-a5d2x      |          | ref  |
| SBC  | rugged board a5d2x |          | ref  |

{% tabs %}
{% tab title="SoC" %}
**Block diagram:** SAM A5d2x  (microchip)

![sama5d2x](/files/-MepnFLg4KHyYjFtv66o)
{% endtab %}

{% tab title="SoM" %}
**Block diagram:** phycore-a5d2x

{% endtab %}

{% tab title="SBC" %}
**Block diagram:** Ruggedboard a5d2x

![rugged board a5d2x](/files/-MepoCidY67PK47-V-9k)

**Rugged image:**

![](/files/-MeppXjSkqo3O88pf5kb)
{% endtab %}
{% endtabs %}

## Boot Process: rugged Board a5d2x

* Power on Board
* Boot ROM            &#x20;
* SPL                      (bootstap=boot.bin)&#x20;
* PBL                       (u-boot=u-boot.bin)
* kernel                      (linux=zImage)
* rootfs

|                | For Rugged board a5d2x                                                    |
| -------------- | ------------------------------------------------------------------------- |
| Power on Board |                                                                           |
| Boot ROM       | BOOTROM code (in SROM of SoC)  will excute in SRAM                        |
|                | bootrom code will find PL from sdcard\|NAND\|NOR using bootconfig pins    |
|                | bootrom code will load PL to SRAM                                         |
| bootstrap      | PL will intialize your ext RAM and loads SL to ext RAM                    |
| u-boot         | u-boot loads kernel                                                       |
| kernel         | kernel loads rootfs to ext ram                                            |
| rootfs         | rootfs runs in ext ram and start init process that can run other services |

\#for more info click here    reference

## Board Flashing images

### 1. How to flash images using SD Card

* [ ] make sd card 2 partitions (boot, rootfs)                    reference
* [ ] download pre compile images                                    link
* [ ] copy images to sdcard

{% tabs %}
{% tab title="make sdcard partition" %}

1. See reference [video](https://www.youtube.com/watch?v=_dQQEVeSrgo)
2.

{% endtab %}

{% tab title="copy to sdcard" %}
copy boot.bin u-boot.bin zImage a5d2x-*rugged\_*&#x62;oard.dtb to sdcard boot part and extraxt rootfs to rootfs part in sdcard.

$ **cp boot.bin u-boot.bin zImage a5d2x-*****rugged\_*****board.dtb   /media/$USER/boot**

$ **tar -xvf core-image-minimal-sama5d27-som1-ek-sd-spidev.tar.gz  -C   /media/$USER/rootfs**

<mark style="color:red;">Note:</mark> if you het any error use **sudo**
{% endtab %}

{% tab title="test on board" %}
connect sd card to board and press reset button.check log in minicom

For reference vedio click here.
{% endtab %}
{% endtabs %}

### 2. How to flash images using "NOR flash"

* [ ] make sd card 2 partitions (boot, root)
* [ ] download pre compile images & copy images to sdcard
* [ ] use below commands to flash images from sdcard to NOR flash

{% tabs %}
{% tab title="make sdcard partition" %}

#### 1. SDCARD Partition Reference [video](https://www.youtube.com/watch?v=_dQQEVeSrgo)

#### 2. Click here to Download images and copy images to sdcard

```
$ cd RBNR-20.0.0
$ cp boot.bin qspi_boot.bin
$ cp u-boot.bin qspi_u-boot.bin
$ cp qspi_boot.bin qspi_u-boot.bin /media/$USER/boot
$ sync
$ umount /media/$USER/boot

```

#### 3. Flashing on Board

{% endtab %}

{% tab title="on board flash to NOR" %}
connect sdcard to board -> Open **minicom** -> prese Reset button -> Press any KEY to stop boot at bootloader.

```
# boot.bin flash to NOR

sf probe
fatload mmc 1 0x22000000 qboot.bin
sf erase 0x0 0x10000
sf write 0x22000000 0x0 0x10000

# u-boot.bin flash to NOR

sf probe
fatload mmc 1 0x21FF0000 qu-boot.bin
sf erase 0x20000 0x80000
sf write 0x21FF0000 0x20000 0x80000

```

Now **Remove the sdcard** from the Rugged Board A5d2x sdcard slot and reset the board. See reference image

![](/files/-Mepk57aJmsj40FphBfm)

&#x20;See reference video link here
{% endtab %}
{% endtabs %}

## Compile BSP sources

#### Install Dependency packages in ubuntu 16.04 +

run below command in your ubuntu terminal.

{% code title="" %}

```
sudo apt-get update
sudo apt-get -y install git-core flex bison gperf zip zlib1g-dev build-essential gettext texinfo
sudo apt-get -y install  fakeroot gnupg libsdl1.2-dev squashfs-tools u-boot-tools expect libncurses5-dev
sudo apt-get -y install minicom lrzsz tftpd-hpa nfs-kernel-server nfs-common portmap patch vim gawk libncursesw5-dev
sudo apt-get -y install xinetd tftpd tftp ctags quilt
```

{% endcode %}

### 1. ARM Toolchain setup

```
$ mkdir yoctotutor
$ mkdir yoctotutor/toolchain
$ cd yoctotutor/toolchain

$ cd toolchain
$ wget https://files.linux4sam.org/pub/demo/yocto-sdk/poky-atmel-glibc-x86_64-microchip-headless-image-cortexa5t2hf-neon-vfpv4-sama5d27-wlsom1-ek-sd-toolchain-3.1.4.sh
$ chmod 777 poky-atmel-glibc-x86_64-microchip-headless-image-cortexa5t2hf-neon-vfpv4-sama5d27-wlsom1-ek-sd-toolchain-3.1.4.sh
$ ./poky-atmel-glibc-x86_64-microchip-headless-image-cortexa5t2hf-neon-vfpv4-sama5d27-wlsom1-ek-sd-toolchain-3.1.4.sh
        # press "." to install sdk in current directory
$ source environment-setup-cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi
```

### 2. at91Bootstrap Compilation

**Don't Forget to run Toolchain env before compiling** &#x20;

{% tabs %}
{% tab title="Download  & compile" %}
{% code title="" %}

```
### Download at91bootstrap source ###

$ cd ~/yoctotutor
$ git clone https://github.com/rugged-board/at91bootstrap-rba5d2x.git
$ cd at91bootstrap-rba5d2x
$ git checkout origin/at91bootstrap-rba5d2x_v3.8.12

### Compilation ###

$ cd at91bootstrap-rba5d2x
$ source ~/yoctotutor/toolchain/environment-setup-cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi
$ make mrproper
$ make rugged_board_a5d2xsd1_uboot_defconfig       # For SDCARD 
                or
$ make rugged_board_a5d2xqspi_uboot_defconfig      # For NOR Flash
$ make

$ ls binaries/                # boot.bin is output


```

{% endcode %}
{% endtab %}
{% endtabs %}

output **boot.bin**  is created in binaries/ dir

For Testing images click  [sdcard image](https://docs.yoctotutor.com/rugged-boarda-5d2x#1-how-to-flash-images-using-sd-card) | [NOR image](https://docs.yoctotutor.com/rugged-boarda-5d2x#2-how-to-flash-images-using-nor-flash)&#x20;

### 3. U-boot Compilation

**Don't Forget to run Toolchain env before compiling** &#x20;

{% tabs %}
{% tab title="Download U-Boot" %}
{% code title="" %}

```
### Download U-boot source ###

cd ~/yoctotutor
git clone https://github.com/rugged-board/uboot-rba5d2x.git
cd uboot-rba5d2x
git checkout uboot-rba5d2x

### Compile ###

$ cd ~/yoctotutor/uboot-rba5d2x
$ source ~/yoctotutor/toolchain/environment-setup-cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi
$ make mrproper
$ make rugged_board_a5d2x_mmc1_defconfig                # for SDCARD
                or
$ make rugged_board_a5d2x_qspiflash_defconfig           # for NOR Flash
$ make -j4
```

{% endcode %}
{% endtab %}
{% endtabs %}

For Testing images click  [sdcard image](https://docs.yoctotutor.com/rugged-boarda-5d2x#1-how-to-flash-images-using-sd-card) | [NOR image](https://docs.yoctotutor.com/rugged-boarda-5d2x#2-how-to-flash-images-using-nor-flash)&#x20;

### 4. Linux Kernel Compilation

**step-1:** download Linux kernel

{% tabs %}
{% tab title="Download Linux" %}
{% code title="" %}

```
### download linux ###

$ cd ~/yoctotutor
$ git clone https://github.com/rugged-board/linux-rba5d2x.git
$ cd linux-rba5d2x
$ git checkout origin/linux-rba5d2x

### Compile Linux ###

$ cd ~/yoctotutor/linux-rba5d2x
$ source ~/yoctotutor/toolchain/environment-setup-cortexa5t2hf-neon-vfpv4-poky-linux-gnueabi
$ make mrproper
$ make rb_a5d2x_defconfig
$ make -j4

```

{% endcode %}
{% endtab %}
{% endtabs %}

Copy zimage and 5d2x-rugged\_board.dtb to sdcard.\
**zImage:** arch/arm/boot/zImage\
**oftree:** arch/arm/boot/dts/a5d2x-rugged\_board.dtb

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

## Advanced Topics

Device tree and Device driver api and application

{% tabs %}
{% tab title="GPIO" %}
click [here](http://ww1.microchip.com/downloads/en/Appnotes/AN_3293-How-to-Use-SAMA5D2-GPIO-Under-Linux-00003293a.pdf)
{% endtab %}

{% tab title="I2C" %}
click [here](http://ww1.microchip.com/downloads/en/Appnotes/AN_3252-How-to-Use-SAMA5D2-I2C-underLinux-00003252a.pdf)
{% endtab %}

{% tab title="SPI" %}

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yoctotutor.com/others/rb-a5d2x.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
