Wiki

This version is outdated by a newer approved version.DiffThis version (24 May 2023 10:52) was approved by Vasileios Bimpikas.The Previously approved version (12 May 2023 16:24) is available.Diff

This is an old revision of the document!


Yocto Linux 3.0.0 Quickstart Guide for ADSP-SC594

The following instructions are for the ADSP-SC594-EZKIT development board (the EV-SC594-SOM System-on-Module (SOM) board attached to the EV-SOMCRR-EZKIT carrier board). For instructions for other processors and development boards please refer to Linux for ADSP-SC5xx Processors 3.0.0

Setting Up Your Host PC

The build system is currently supported on host PCs running Ubuntu 20.04 LTS 64-bit.


Installing Required Packages

In order to build and deploy Linux to your ADSP-SC594-EZKIT development board you will need to install the following packages on your host PC.

$ sudo apt-get update
$ sudo apt-get install -y gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm u-boot-tools openssl curl tftpd-hpa python zstd liblz4-tool

Configuring TFTP Service

A TFTP server on the host is used to transfer images to the development board. Install and configure.

$ sudo vi /etc/default/tftpd-hpa
 
#Replace the existing file with the following
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"
#End of File
 
$ sudo mkdir /tftpboot
$ sudo chmod 777 /tftpboot
$ sudo service tftpd-hpa restart


Configure Minicom

In order to communicate with the U-Boot bootloader, a UART connection must be made between the host PC and the development board. It is recommended that you use minicom to do this. Minicom must be configured to connect to U-Boot correctly.

On the host PC open a terminal and execute the following commands:

$ sudo apt-get install -y minicom
$ sudo minicom -s
 
            +-----[configuration]------+
            | Filenames and paths      |
            | File transfer protocols  |
            | Serial port setup        |
            | Modem and dialing        |
            | Screen and keyboard      |
            | Save setup as dfl        |
            | Save setup as..          |
            | Exit                     |
            | Exit from Minicom        |
            +--------------------------+
 
 
# Select Serial port setup
     Set Serial Device to /dev/ttyUSB0
     Set Bps/Par/Bits to 115200 8N1
     Set Hardware Flow Control to No
 
     Close the Serial port setup option by press Esc
 Select Save setup as dfl
 Select Exit
/dev/ttyUSB0 might not correspond to the serial port of the board on every system. You can determine which /dev entry your board uses by running ls -l /dev/ttyUSB* twice, once when the serial port of the board is plugged in, and once when it isn't.


Installing the Sources

The example is fully contained in the Analog Devices Yocto Linux github repositories.

To install the sources: 

$ mkdir ~/gxp
$ cd ~/gxp
$ mkdir bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ./bin/repo
$ chmod a+x ./bin/repo
$ ./bin/repo init \
   -u https://github.com/analogdevicesinc/lnxdsp-repo-manifest.git \
   -b release/yocto-3.0.0 \
   -m release-yocto-3.0.0.xml
$ ./bin/repo sync


Building the Image

Preparing the buildtool

Yocto requires the environment to be configured before building is possible.  A setup-environment script in the gxp folder contains all the required environment settings for your build target. Source the setup script for your board:

$ source setup-environment -m adsp-sc594-som-ezkit

Sourcing the script will configure your build environment and create a build folder along with a local build configuration file.  See the Yocto Manual for further details.

Note that the build environment needs to be sourced once only before building.  If later working in a different terminal the setup-environment script should be sourced again.  If sourcing the setup-environment script is done without specifying the machine Yocto will reuse the previous configuration settings and retain any changes made to the files in the conf folder.


Building the example

You can build two different versions of the root file system; minimal and full. To build the example images invoke bitbake from within the build directory created previously.

$ bitbake adsp-sc5xx-minimal
$ bitbake adsp-sc5xx-full

When the build completes you will see a warning that the ELF binary has relocations in .text. It is OK to ignore this warning

Building a Linux distribution with Yocto is a significantly demanding process, both in CPU and network usage. A full build from scratch is estimated to take around 170 minutes for an 11th Gen Intel Core i5-11500T with 16 GB of RAM and a stable, fast Internet connection. This estimate can go up significantly for a poorer Internet connection or CPU resources, so set aside plenty of time for a clean build.

Building the SDK

The SDK will provide you with the cross toolchain needed to develop application for the target board, alongside various miscellaneous tools. Notably, it will provide you with OpenOCD and GDB, which you can use to run and flash U-Boot on the board.

The SDK can be built for the adsp-sc5xx-minimal image or the adsp-sc5xx-full image. To build the SDK for the adsp-sc5xx-minimal image invoke bitbake from within the build directory created previously.

$ bitbake adsp-sc5xx-minimal -c populate_sdk

or for the adsp-sc5xx-full image

$ bitbake adsp-sc5xx-full -c populate_sdk

When the build has completed you will find a set of files in the <BUILD_DIR>/tmp/deploy/sdk directory. For example, the minimal image on SC594:

$ ls tmp/deploy/sdk
adi-distro-musl-x86_64-adsp-sc5xx-minimal-cortexa5t2hf-neon-adsp-sc594-som-ezkit-toolchain-3.0.0.host.manifest
adi-distro-musl-x86_64-adsp-sc5xx-minimal-cortexa5t2hf-neon-adsp-sc594-som-ezkit-toolchain-3.0.0.sh
adi-distro-musl-x86_64-adsp-sc5xx-minimal-cortexa5t2hf-neon-adsp-sc594-som-ezkit-toolchain-3.0.0.target.manifest
adi-distro-musl-x86_64-adsp-sc5xx-minimal-cortexa5t2hf-neon-adsp-sc594-som-ezkit-toolchain-3.0.0.testdata.json

The adi-distro-musl-x86_64-adsp-sc5xx-minimal-cortexa5t2hf-neon-adsp-sc594-som-ezkit-toolchain-3.0.0.sh is a self-extracting archive containing the SDK.

Installing the SDK

Invoke the self-extracting archive. It will default to installing to /opt/adi-distro/3.0.0 but gives you the option to select your own install folder during the installation. For the minimal image on SC594

$ ./adi-distro-musl-x86_64-adsp-sc5xx-minimal-cortexa5t2hf-neon-adsp-sc594-som-ezkit-toolchain-3.0.0.sh
Analog Devices Inc Reference Distro SDK installer version 3.0.0
===============================================================
Enter target directory for SDK (default: /opt/adi-distro/3.0.0):
You are about to install the SDK to "/opt/adi-distro/3.0.0". Proceed [Y/n]? y
Extracting SDK........................................................................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /opt/adi-distro/3.0.0/environment-setup-cortexa5t2hf-neon-adi-linux-musleabi

Your SDK is now installed.

Running U-Boot on the Board for the first time

It's always good practice to erase the contents of /tftpboot/ before running and/or flashing a new build of U-Boot or Linux. You can do so by executing rm /tftpboot/* before proceeding

Copy the U-Boot binary & loader files to the tftp directory:

$ cp tmp/deploy/images/adsp-sc594-som-ezkit/u-boot-proper-sc594-som-ezkit.elf /tftpboot/
$ cp tmp/deploy/images/adsp-sc594-som-ezkit/u-boot-spl-sc594-som-ezkit.elf /tftpboot/
$ cp tmp/deploy/images/adsp-sc594-som-ezkit/stage1-boot.ldr /tftpboot/
$ cp tmp/deploy/images/adsp-sc594-som-ezkit/stage2-boot.ldr /tftpboot/

Before installing the software on to the development board, ensure that the following cables are connected:

  • Board connected to network via ethernet cable using J13 connector.
  • Board connected to host PC using USB micro cable, connected to USB/UART port on the development board
  • Board connected to the ICE 1000 or ICE 2000 via the DEBUG port on the board
  • ICE is also connected to host PC via USB mini cable

  • On the carrier board is a set of micro switches labelled SW1. These should all be set to the OFF position before continuing.

  • The Power jumper JP1 on the EV-SC594-SOM board should be fitted so that it shorts the two pins closest to the edge. This will enable the routing of power from the SOMCRR-EZKIT.
  • The BOOT MODE selector on the EV-SC594-SOM board should be turned to “0”.

The console output from U-Boot and later on Linux will appear on the USB serial port configured in minicom earlier so open up minicom.

Terminal1: minicom
$ sudo minicom 

In a separate console launch OpenOCD and connect to the development board.

Terminal2: OpenOCD
$ sdk_usr=/opt/adi-distro/3.0.0/sysroots/x86_64-adisdk-linux/usr/
$ $sdk_usr/bin/openocd -f $sdk_usr/share/openocd/scripts/interface/<ICE>.cfg -f $sdk_usr/share/openocd/scripts/target/adspsc59x.cfg

Where <ICE> should be replaced with ice1000 or ice2000 depending on your hardware. When successful you should see a message similar to the console output below

Open On-Chip Debugger (PKGVERSION)  OpenOCD 0.10.0-g40378454d (2023-04-05-10:35)
Licensed under GNU GPL v2
Report bugs to <processor.tools.support@analog.com>
adapter speed: 1000 kHz
Info : transports supported by the debug adapter: "jtag", "swd"
Info : auto-select transport "jtag"
halt and restart using CTI
trst_only separate trst_push_pull
Info : ICE-1000 firmware version is 1.0.2
Info : clock speed 1000 kHz
Info : JTAG tap: adspsc59x.adjc tap/device found: 0x028240cb (mfg: 0x065, part: 0x2824, ver: 0x0)
Info : JTAG tap: adspsc59x.dap enabled
Info : adspsc59x.dap: hardware has 3 breakpoints, 2 watchpoints
Info : adspsc59x.dap: but you can only set 1 watchpoint

In a third console window launch GDB and type target extended-remote :3333. This will make GDB to connect to the gdbserver on the local host using port 3333. Then, load the U-Boot SPL into RAM by typing load u-boot-proper-sc594-som-ezkit.elf. Hit Ctrl+C to interrupt thereafter.

Terminal3: GDB
$ cd /tftpboot
$ /opt/adi-distro/3.0.0/sysroots/x86_64-adisdk-linux/usr/bin/arm-adi-linux-gnueabi/arm-adi-linux-gnueabi-gdb u-boot-spl-sc594-som-ezkit.elf
...
(gdb) target extended-remote :3333
Remote debugging using :3333
0x00005f96 in ?? ()
(gdb) load
Loading section .text, size 0xef3c lma 0x20080000
Loading section .rodata, size 0x204f lma 0x2008ef3c
Loading section .dtb.init.rodata, size 0x1740 lma 0x20090f90
Loading section .data, size 0x548 lma 0x200926d0
Loading section .u_boot_list, size 0xc38 lma 0x20092c18
Start address 0x20080000, load size 79947
Transfer rate: 31 KB/sec, 9993 bytes/write.
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.

You will see a message on Terminal 1 running minicom, informing you that you can now load U-Boot Proper

Terminal1: minicom
U-Boot SPL 2020.10 (Mar 16 2023 - 13:07:24 +0000)
ADI Boot Mode: 0x0 (JTAG/BOOTROM)
SPL execution has completed.  Please load U-Boot Proper via JTAG

Now, load U-Boot Proper into RAM.

Terminal3: GDB
(gdb) load u-boot-proper-sc594-som-ezkit.elf
Loading section .text, size 0x3a8 lma 0xb2200000
Loading section .efi_runtime, size 0xdf0 lma 0xb22003a8
Loading section .text_rest, size 0x510f4 lma 0xb22011a0
Loading section .rodata, size 0x10536 lma 0xb2252298
Loading section .hash, size 0x18 lma 0xb22627d0
Loading section .dtb.init.rodata, size 0x1e50 lma 0xb22627f0
Loading section .data, size 0x2fd8 lma 0xb2264640
Loading section .got.plt, size 0xc lma 0xb2267618
Loading section .u_boot_list, size 0x1908 lma 0xb2267624
Loading section .efi_runtime_rel, size 0xd0 lma 0xb2268f2c
Loading section .rel.dyn, size 0xaee8 lma 0xb2268ffc
Loading section .dynsym, size 0x30 lma 0xb2273ee4
Loading section .dynstr, size 0x1 lma 0xb2273f14
Loading section .dynamic, size 0x90 lma 0xb2273f18
Loading section .gnu.hash, size 0x18 lma 0xb2273fa8
Start address 0xb2200000, load size 475047
Transfer rate: 31 KB/sec, 11586 bytes/write.
(gdb) c
Continuing.

At this point U-Boot will now be running in RAM on your target board. You should see U-Boot booting in the minicom console (Terminal 1). Press a key to interrupt the boot process before the countdown terminates:

Terminal1: minicom
U-Boot 2020.10 (Mar 16 2023 - 13:07:24 +0000)
 
CPU:   ADSP ADSP-SC594-0.0 (spi slave boot)
Detected Revision: 1.1
Model: ADI sc594-som-ezkit
DRAM:  992 MiB
WDT:   Not found!
MMC:
Loading Environment from SPIFlash... Read ID via 1x SPI: 9d 5a 19
SF: Detected is25lx256 with page size 256 Bytes, erase size 128 KiB, total 32 MiB
OK
In:    serial@0x31003000
Out:   serial@0x31003000
Err:   serial@0x31003000
Net:   eth0: eth0
Error: eth1 address not set.
 
Hit any key to stop autoboot:  0
=>
Flash U-Boot to SPI Flash


In the U-Boot console, set the IP address of the Linux PC that hosts the U-Boot loader files (stage1-boot.ldr & stage2-boot.ldr) on TFTP.

Terminal1: minicom
=> setenv serverip <SERVERIP>
=> setenv tftpserverip <SERVERIP>
To find the IP address of your host Linux PC you can issue the ip addr command from the shell or console.

If your network supports DHCP, run:

=> dhcp

If your network does NOT support DHCP, run:

=> set ipaddr <ADDR>

Where <ADDR> is the IP address you want to assign.

If flashing a board that had been previously programmed, it's good to erase the whole flash before as sometimes previous U-Boot installations might leave remnants. You can do that by typing ⇒ sf probe ${sfdev}; sf erase 0 ${sfsize} on the U-Boot prompt before proceeding to the following instructions

Next, run the U-Boot update command to copy the U-Boot loader files from the host PC to the target board, and write it into flash:

=> run update_spi_uboot_only

You will see an output similar to the one below:

=> run update_spi_uboot_only
Speed: 1000, full duplex
Using eth0 device
TFTP from server 10.37.33.116; our IP address is 10.37.33.113
Filename 'stage1-boot.ldr'.
Load address: 0x96000000
Loading: ########
         4.8 MiB/s
done
Bytes transferred = 115008 (1c140 hex)
SF: Detected is25lp512 with page size 256 Bytes, erase size 64 KiB, total 64 MiB
device 0 offset 0x0, size 0x1c140
SF: 115008 bytes @ 0x0 Written: OK
Speed: 1000, full duplex
Using eth0 device
TFTP from server 10.37.33.116; our IP address is 10.37.33.113
Filename 'stage2-boot.ldr'.
Load address: 0x96000000
Loading: ###########################################
         5.3 MiB/s
done
Bytes transferred = 629616 (99b70 hex)
SF: Detected is25lp512 with page size 256 Bytes, erase size 64 KiB, total 64 MiB
device 0 offset 0x20000, size 0x99b70
SF: 629616 bytes @ 0x20000 Written: OK

In order to store the serverip and the DHCP or otherwise assigned IP address of the board and have them available on next boot, you can run the following command:

=> saveenv
Saving Environment to SPIFlash... Erasing SPI flash...Writing to SPI flash...done
OK

At this point the U-Boot binary is stored in flash. You can now disconnect the ICE-1000 or ICE-2000 from the development board and make sure to switch the BMODE to position 1. You will only need to reconnect this if your board fails to boot and you need to re-follow these instructions.

Booting Linux

Booting the minimal image from QSPI

The U-Boot console is used to copy U-Boot (SPL and Proper), the minimal root filesystem image and the fitImage (which contains the kernel image and dtb file) into RAM and then write them to Flash. Copy the required files from <BUILD DIR>/tmp/deploy/images to your /tftpboot directory.

$ cp tmp/deploy/images/adsp-sc594-som-ezkit/stage1-boot.ldr /tftpboot/
$ cp tmp/deploy/images/adsp-sc594-som-ezkit/stage2-boot.ldr /tftpboot/
$ cp tmp/deploy/images/adsp-sc594-som-ezkit/fitImage /tftpboot/
$ cp tmp/deploy/images/adsp-sc594-som-ezkit/adsp-sc5xx-minimal-adsp-sc594-som-ezkit.jffs2 /tftpboot

If your network supports DHCP, run:

=> run update_spi

If your network does NOT support DHCP, in the U-Boot console configure the board IP address and remove the “run init_ethernet;” from the “start_update_spi” command.

=> setenv ipaddr <IPADDR>
=> edit start_update_spi
=> edit: <remove "run init_ethernet;" from here> sf probe ${sfdev}; sf erase 0 ${sfsize}; run update_spi_uboot; run update_spi_fit; run update_spi_rfs; sleep 3; saveenv
=> run update_spi 

After removing “run init_ethernet;” from update_spi, issue the “run update_spi” command as above.

You should see output similar to the following.

=> run update_spi
PHY 0x00: OUI = 0x80028, Model = 0x23, Rev = 0x01, 100baseT, FDX
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 10.37.33.113 (90 ms)
SF: Detected is25lp512 with page size 256 Bytes, erase size 64 KiB, total 64 MiB
SF: 67108864 bytes @ 0x0 Erased: OK
Speed: 1000, full duplex
Using eth0 device
TFTP from server 10.37.33.116; our IP address is 10.37.33.113
Filename 'stage1-boot.ldr'.
Load address: 0x82000000
Loading: ######
         2.9 MiB/s
done
Bytes transferred = 80032 (138a0 hex)
SF: Detected is25lp512 with page size 256 Bytes, erase size 64 KiB, total 64 MiB
device 0 offset 0x0, size 0x138a0
SF: 80032 bytes @ 0x0 Written: OK
Speed: 1000, full duplex
Using eth0 device
TFTP from server 10.37.33.116; our IP address is 10.37.33.113
Filename 'stage2-boot.ldr'.
Load address: 0x82000000
Loading: #################################
         4.7 MiB/s
done
Bytes transferred = 475344 (740d0 hex)
SF: Detected is25lp512 with page size 256 Bytes, erase size 64 KiB, total 64 MiB
device 0 offset 0x20000, size 0x740d0
SF: 475344 bytes @ 0x20000 Written: OK
Speed: 1000, full duplex
Using eth0 device
TFTP from server 10.37.33.116; our IP address is 10.37.33.113
Filename 'fitImage'.
Load address: 0x82000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
 
         5 MiB/s
done
Bytes transferred = 6678526 (65e7fe hex)
SF: Detected is25lp512 with page size 256 Bytes, erase size 64 KiB, total 64 MiB
device 0 offset 0x100000, size 0x65e7fe
SF: 6678526 bytes @ 0x100000 Written: OK
Speed: 1000, full duplex
Using eth0 device
TFTP from server 10.37.33.116; our IP address is 10.37.33.113
Filename 'adsp-sc5xx-minimal-adsp-sc594-som-ezkit.jffs2'.
Load address: 0x82000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #####################################################
         5 MiB/s
done
Bytes transferred = 21757952 (14c0000 hex)
SF: Detected is25lp512 with page size 256 Bytes, erase size 64 KiB, total 64 MiB
device 0 offset 0x900000, size 0x14c0000
SF: 21757952 bytes @ 0x900000 Written: OK
Saving Environment to SPIFlash... SF: Detected is25lx256 with page size 256 Bytes, erase size 128 KiB, total 32 MiB
Erasing SPI flash...Writing to SPI flash...done
OK
=>

The U-Boot image, root filesystem and Linux kernel are now stored in QSPI. Adjust the BOOT MODE selector to position 1 and press the RESET button, the board should boot into Linux.

...
[  OK  ] Started Login Service.
[  OK  ] Reached target Multi-User System.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Started Update UTMP about System Runlevel Changes.
 
 
     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@     @@@@@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@        @@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@            @@@@@@@@@@@@@@@@@@@
     @@@@@@@@               @@@@@@@@@@@@@@@@
     @@@@@@@@                   @@@@@@@@@@@@
     @@@@@@@@                     @@@@@@@@@@
     @@@@@@@@                        @@@@@@@
     @@@@@@@@                     @@@@@@@@@@
     @@@@@@@@                   @@@@@@@@@@@@
     @@@@@@@@               @@@@@@@@@@@@@@@@
     @@@@@@@@            @@@@@@@@@@@@@@@@@@@
     @@@@@@@@        @@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@     @@@@@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
        Analog Devices Yocto Distribution
                 www.analog.com
              www.yoctoproject.org
 
adsp-sc594-som-ezkit login: root
Password: adi
root@adsp-sc594-som-ezkit:~# 

The username is root and the password is adi.

Booting Linux Using SD Card

Setting up U-boot to boot from SD Card

Setup Yocto for changes in U-boot

devtool modify u-boot-adi

Edit workspace/source/u-boot-adi/arch/arm/dts/sc594-som.dtsi

--- a/arch/arm/dts/sc594-som.dtsi
+++ b/arch/arm/dts/sc594-som.dtsi
@@ -60,8 +60,11 @@
 			pinctrl-0 = <&mmc_defaults>;
 			clocks = <&emmcclk>;
 			clock-names = "core";
-			max-frequency = <50000000>;
-			bus-width = <8>;
+			//max-frequency = <50000000>;
+			max-frequency = <44000000>;
+			no-1-8-v;
+			//bus-width = <8>;
+			bus-width = <4>;
 			u-boot,dm-pre-reloc;
 		};
 	};
@@ -203,7 +206,7 @@
 		emmc {
 			gpio-hog;
 			gpios = <8 GPIO_ACTIVE_HIGH>;
-			output-low;
+			output-high;
 			line-name = "emmc-en";
 			u-boot,dm-pre-reloc;
 		};
@@ -211,7 +214,7 @@
 		emmc-som-en {
 			gpio-hog;
 			gpios = <9 GPIO_ACTIVE_HIGH>;
-			output-high;
+			output-low;
 			line-name = "emmc-som-en";
 			u-boot,dm-pre-reloc;
 		};

Rebuild U-boot in Yocto

devtool build u-boot-adi

Formatting the SD Card

In order to use an SD Card with Linux we need to prepare it by formatting it in the correct format. This section of instructions requires you to correctly identify the SD Card and format the card. If you select the wrong drive you may cause irreversible damage to you Host PC. To format the SD Card, follow the commands below. The example code in this section assumes that the SD Card device is reported to be /dev/sdb. Ensure that you change these commands to use your device.

$ sudo fdisk /dev/sdb
/* Create primary partition 1, 256M size*/
Command (m for help): n
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-3887103, default 2048): PRESS ENTER
Last sector, +sectors or +size{K,M,G} (2048-3887103, default 3887103): PRESS ENTER
 
/* Save partition */
Command (m for help): w

Format the SD card to EXT filesystem

$ sudo mkfs.ext4 /dev/sdb1


Writing the kernel and file system to the SD Card

Next, we need to copy the Linux file system and kernel image to the SD Card. We install this on to the SD Card by mounting the file system on to the local Host PC and copying the contents on to the SD Card. To allow the choice of booting using ramboot and sdcard boot we copy the ramboot image to the SD card as well as extract the minimal image to the SD card.

$ mkdir ~/mnt
$ sudo mount -t ext4 /dev/sdb1 ~/mnt
$ sudo mkdir ~/mnt/boot
$ sudo cp tmp/deploy/images/adsp-sc594-som-ezkit/adsp-sc5xx-ramdisk-adsp-sc594-som-ezkit.cpio.xz.u-boot ~/mnt/boot/ramdisk.cpio.xz.u-boot
$ sudo cp tmp/deploy/images/adsp-sc594-som-ezkit/sc594-ezkit.dtb ~/mnt/boot/
$ sudo cp tmp/deploy/images/adsp-sc594-som-ezkit/fitImage ~/mnt/boot/
$ sudo tar -xf tmp/deploy/images/adsp-sc594-som-ezkit/adsp-sc5xx-minimal-adsp-sc594-som-ezkit.tar.xz -C ~/mnt
$ sudo umount ~/mnt

The file system and kernel image are now installed on to the SD Card. The SD Card can now be safely removed from the Host PC.


Booting Linux from the SD card

Set U-boot environment variables

=> setenv mmcargs=setenv bootargs root=/dev/mmcblk0 rw rootfstype=ext4 rootwait earlycon=adi_uart,0x31003000 console=ttySC0,115200
=> setenv mmcboot=mmc rescan; run mmcload; bootm ${loadaddr} ${initramaddr};
=> setenv mmcload 'ext4load mmc 0:1 ${initramaddr} /boot/${initramfile};ext4load mmc 0:1  ${loadaddr} /boot/${imagefile};'
=> saveenv

Run Linux from SD card

=> run mmcboot

The linux kernel will then boot up using the file system stored in SD card.

Booting rootfs from SD card

Follow the steps to enable SD card boot. This step include enabling emmc peripheral in Linux Kernel.

$ devtool modify linux-adi

Modify build/workspace/source/linux-adi/arch/arm64/boot/dts/adi/sc594-som.dtsi

@@ -297,14 +297,14 @@ uart0-flow-en {
                emmc {
                        gpio-hog;
                        gpios = <8 0x0>;
-                       output-low;
+                       output-high;
                        line-name = "emmc-en";
                };
 
                emmc-som-en {
                        gpio-hog;
                        gpios = <9 0x0>;
-                       output-high;
+                       output-low;
                        line-name = "emmc-som-en";
                };
        };
@@ -313,8 +313,9 @@ emmc-som-en {
 &mmc0{
        pinctrl-names = "default";
        pinctrl-0 = <&mmc0_8bgrp>;
-       bus-width = <8>;
-       max-frequency = <50000000>;
+       bus-width = <4>;
+       no-1-8-v;
+       max-frequency = <44000000>;
        non-removable;
        status = "okay";
 };

Rebuild the Linux kernel

$ devtool build linux-adi

Copy the new generated fitImage to boot folder on SD card.


Booting Linux from USB Mass Storage

Formatting USB stick

First step is to format USB stick to U-Boot supported formats.

To format the USB stick, follow the commands below. The example code in this section assumes that the USB device is reported to be /dev/sdb. Ensure that you change these commands to use your device.

$ sudo fdisk /dev/sdb
/* Create primary partition 1, 256M size*/
Command (m for help): n
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-3887103, default 2048): PRESS ENTER
Last sector, +sectors or +size{K,M,G} (2048-3887103, default 3887103): PRESS ENTER
 
/* Save partition */
Command (m for help): w

Format the USB stick to EXT4 filesystem

$ sudo mkfs.ext4 /dev/sdb1

Writing kernel and rootfs image to USB Mass Storage

$ mkdir ~/mnt
$ sudo mount -t ext4 /dev/sdb1 ~/mnt
$ sudo mkdir ~/mnt/boot
$ sudo tar -xf tmp/deploy/images/adsp-sc594-som-ezkit/adsp-sc5xx-minimal-adsp-sc594-som-ezkit.tar.xz -C ~/mnt
$ sudo cp tmp/deploy/images/adsp-sc594-som-ezkit/fitImage ~/mnt/boot/
$ sudo umount ~/mnt

Booting Linux from the USB Mass Storage device

To boot from ADSP-SC594-EZKIT run in u-boot

=> setenv usbload 'ext4load usb 0 ${initramaddr} /boot/${initramfile}; ext4load usb 0 ${loadaddr} /boot/${imagefile};'
=> setenv usbboot 'usb start; run usbload; run ramargs; bootm ${loadaddr} ${initramaddr};'
=> run usbboot

Booting rootfs from USB Mass Storage

Follow the step how to setup USB stick in chapter above Yocto Linux 3.0.0 Quickstart Guide for ADSP-SC594. Set environment variables in U-boot

=> setenv usbargs 'setenv bootargs root=/dev/sda1 rw rootfstype=ext4 rootwait earlycon=adi_uart,0x31003000 console=ttySC0,115200'
=> setenv usbload 'ext4load usb 0 ${loadaddr} /boot/${imagefile};'
=> setenv usbboot 'usb start; run usbload; run usbargs; bootm ${loadaddr};'

And type to boot

=> run usbboot

Now the rootfs is set to your USB stick and amount of space equals of size of partition on USB stick.


Booting Linux Using TFTP

In order to boot Linux, the TFTP server should be setup as above and a copy of the fitImage should be copied into the /tftpboot directory.

$ cp tmp/deploy/images/adsp-sc594-som-ezkit/fitImage /tftpboot/


NFS Boot

For NFS boot we use the Network File System which is stored in local Ubuntu Host. This is suggested when you do application development. To setup the NFS server:

$ sudo apt-get install nfs-kernel-server
$ sudo vi /etc/exports
 
#Add following commands
/romfs *(rw,sync,no_root_squash,no_subtree_check)
 
$ sudo mkdir /romfs/
$ sudo chmod 777 /romfs/
$ sudo service nfs-kernel-server start

We can verify that the NFS service is running by executing

$ sudo service nfs-kernel-server status

The output will indicate that the server is active, i.e.

● nfs-server.service - NFS server and services
     Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
    Drop-In: /run/systemd/generator/nfs-server.service.d
             └─order-with-mounts.conf
     Active: active (exited) since Tue 2022-09-06 14:38:31 BST; 3 months 14 days ago
   Main PID: 953 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 18797)
     Memory: 0B
     CGroup: /system.slice/nfs-server.service
 
Sep 06 14:38:29 $YOUR_HOSTNAME systemd[1]: Starting NFS server and services...
Sep 06 14:38:31 $YOUR_HOSTNAME systemd[1]: Finished NFS server and services.

If it's reported as inactive, wait a few moments and check the status again.

The root filesystem should then be copied to /romfs.

$ sudo tar -xf tmp/deploy/images/adsp-sc594-som-ezkit/adsp-sc5xx-full-adsp-sc594-som-ezkit.tar.xz -C /romfs


Booting into Linux from TFTP

Next, on the target, from u-boot, run the following command:

=> run nfsboot
......
......
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Started Update UTMP about System Runlevel Changes.
 
 
     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@     @@@@@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@        @@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@            @@@@@@@@@@@@@@@@@@@
     @@@@@@@@               @@@@@@@@@@@@@@@@
     @@@@@@@@                   @@@@@@@@@@@@
     @@@@@@@@                     @@@@@@@@@@
     @@@@@@@@                        @@@@@@@
     @@@@@@@@                     @@@@@@@@@@
     @@@@@@@@                   @@@@@@@@@@@@
     @@@@@@@@               @@@@@@@@@@@@@@@@
     @@@@@@@@            @@@@@@@@@@@@@@@@@@@
     @@@@@@@@        @@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@     @@@@@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
        Analog Devices Yocto Distribution
                 www.analog.com
              www.yoctoproject.org
 
adsp-sc594-som-ezkit login: root
Password: adi
root@adsp-sc594-som-ezkit:~# 

Further Examples

resources/tools-software/linuxdsp/docs/quickstartguide/quickstart_sc594_3_0_0.1684918374.txt.gz · Last modified: 24 May 2023 10:52 by Vasileios Bimpikas