Wiki

The most recent version of this page is a draft.DiffThis version is outdated by a newer approved version.DiffThis version (02 Oct 2017 11:29) was approved by Dragos Bogdan.The Previously approved version (29 Sep 2017 14:30) is available.Diff

This is an old revision of the document!


Altera SOC Quick Start Guide

ADRV9371 + Arria 10 SoC Development Kit

Download

HDL Project: a10soc

Linux Kernel: altera_4.6

Linux Config: socfpga_adi_defconfig

Linux Devicetree: socfpga_arria10_socdk_adrv9371.dts

Prebuilt Image: a10soc_adrv9371x_dev.zip

Prebuilt 2016_R2 Image: a10soc_adrv9371x_2016_r2.zip

Building the Preloader and Bootloader Image

  • Open SoC Embedded Design Suite (EDS) 16.0 Command Shell
  • Change directory to where the project is located and create a new BSP settings file:

bsp-create-settings --type uboot --bsp-dir software/uboot_bsp --preloader-settings-dir hps_isw_handoff --settings software/uboot_bsp/settings.bsp --set uboot.rbf_filename adrv9371x_a10soc.rbf

  • Add the following lines in the CONFIG_EXTRA_ENV_SETTINGS definition from the software\uboot_bsp\uboot-socfpga\include\configs\socfpga_arria10.h file:
  \
	"bootargs=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait\0" \
	"fdtimagesize=0x9f00\0" \
	"loadaddr=0x10000\0" \
	"ethaddr=1c:76:ca:01:23:45\0"
  • Build the project:

cd software/uboot_bsp/
make

Creating the Preloader and Bootloader partition

dragos@debian:~$ time sudo dd if=2015_R2-2016_07_26.img of=/dev/mmcblk0 bs=4194304
1895+0 records in
1895+0 records out
7948206080 bytes (7.9 GB) copied, 503.909 s, 15.8 MB/s

real	8m23.919s
user	0m0.020s
sys	0m6.376s
dragos@debian:~$ sync
dragos@debian:~$ sudo fdisk /dev/mmcblk0 

Welcome to fdisk (util-linux 2.25.2).

Command (m for help): p
Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00096174

Device         Boot    Start      End  Sectors  Size Id Type
/dev/mmcblk0p1          8192  1056767  1048576  512M  c W95 FAT32 (LBA)
/dev/mmcblk0p2       1056768 14497791 13441024  6.4G 83 Linux
/dev/mmcblk0p3      14497792 14499839     2048    1M a2 unknown


Command (m for help): d
Partition number (1-3, default 3): 3

Partition 3 has been deleted.

Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 3
First sector (2048-31116287, default 2048): 4096
Last sector, +sectors or +size{K,M,G,T,P} (4096-8191, default 8191): +1M

Created a new partition 3 of type 'Linux' and of size 1 MiB.

Command (m for help): t
Partition number (1-3, default 3): 3
Hex code (type L to list all codes): a2

Changed type of partition 'Linux' to 'unknown'.

Command (m for help): p
Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00096174

Device         Boot   Start      End  Sectors  Size Id Type
/dev/mmcblk0p1         8192  1056767  1048576  512M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      1056768 14497791 13441024  6.4G 83 Linux
/dev/mmcblk0p3         4096     6143     2048    1M a2 unknown

Partition table entries are not in disk order.

Command (m for help): w
The partition table has been altered.

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

dragos@debian:~$ sync
dragos@debian:~$ time sudo dd if=uboot_w_dtb-mkpimage.bin of=/dev/mmcblk0p3
2048+0 records in
2048+0 records out
1048576 bytes (1.0 MB) copied, 0.199898 s, 5.2 MB/s

real	0m0.206s
user	0m0.000s
sys	0m0.004s
dragos@debian:~$ sync

IIO Oscilloscope

ARRADIO + Terasic SoCkit

Download

Creating the Preloader and Bootloader partition

dragos@dragos-debian:~$ sudo fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 7948 MB, 7948206080 bytes
245 heads, 62 sectors/track, 1021 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00096174

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            8192      532479      262144    b  W95 FAT32
/dev/sdb2          532480    15521791     7494656   83  Linux

Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): p
Partition number (1-4, default 3): 3
First sector (2048-15523839, default 2048): 15521792
Last sector, +sectors or +size{K,M,G} (15521792-15523839, default 15523839): 15523839

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): a2
Changed system type of partition 3 to a2 (Unknown)

Command (m for help): p

Disk /dev/sdb: 7948 MB, 7948206080 bytes
245 heads, 62 sectors/track, 1021 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00096174

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            8192      532479      262144    b  W95 FAT32
/dev/sdb2          532480    15521791     7494656   83  Linux
/dev/sdb3        15521792    15523839        1024   a2  Unknown

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

dragos@dragos-debian:~$ sudo dd of=/dev/sdb3 bs=512 if=boot-partition.img
949+1 records in
949+1 records out
486376 bytes (486 kB) copied, 1.2313 s, 395 kB/s
dragos@dragos-debian:~$ sync

Building the Linux Kernel image and the Devicetree

dragos@dragos-debian:~$ git clone https://github.com/analogdevicesinc/linux.git
dragos@dragos-debian:~$ cd linux
dragos@dragos-debian:~/linux$ git checkout altera_4.9
dragos@dragos-debian:~/linux$ export ARCH=arm
dragos@dragos-debian:~/linux$ export CROSS_COMPILE=/path/to/your/arm/cross-compiler
dragos@dragos-debian:~/linux$ make socfpga_adi_defconfig
dragos@dragos-debian:~/linux$ make uImage LOADADDR=0x0000a000
dragos@dragos-debian:~/linux$ make socfpga_cyclone5_sockit_arradio.dtb

Terasic SoCkit Jumper Configuration

CLOCKSEL0 CLOCKSEL1 BOOTSEL0 BOOTSEL1 BOOTSEL2
POS 2-3 2-3 2-3 2-3 1-2
JP2
2.5V or 1.8V
MSEL0 MSEL1 MSEL2 MSEL3 MSEL4 CODEC_SEL
POS 0 0 1 0 0 0

IIO Oscilloscope

Building the Hardware Design

  • Open Quartus II 15.0
  • Specify the IP Search Path for Qsys
    • ToolsQsys
    • A window will pop up asking to open a Qsys System File. Just Cancel it.
    • ToolsOptions
    • Specify the IP Search Path, Finish and FileExit Qsys.

  • From the Quartus II Tcl Console change directory to where the project is located (for example: cd D:/workspace/altera/hdl/projects/fmcomms2/c5soc) and run the system_project.tcl (for example: source ./system_project.tcl)
  • After the design was built, the resulted SRAM Object File (.sof) file should be converted to a Raw Binary File (.rbf)
    • File → Convert Programming Files…
    • Select the Raw Binary File (.rbf) programming file type, the Passive Parallel x16 mode and add the SRAM Object File (.sof) file (for example: fmcomms2_c5soc.sof).

Building the Preloader and Bootloader Image

  • Open SoC Embedded Design Suite (EDS) 15.0 Command Shell
  • Change directory to where the project is located:

$ cd /cygdrive/d/workspace/altera/hdl/projects/fmcomms2/c5soc

  • Create a new BSP settings file:

$ bsp-create-settings --type spl --bsp-dir software/bsp/ --preloader-settings-dir hps_isw_handoff/system_bd_sys_hps/ --settings software/bsp/settings.bsp --set spl.boot.WATCHDOG_ENABLE false

  • Set the following settings from the software\bsp\generated\sdram\sdram_config.h as below:
#define CONFIG_HPS_SDR_CTRLCFG_MPPRIORITY_USERPRIORITY		(0x2DB47E06)
#define CONFIG_HPS_SDR_CTRLCFG_DRAMODT_WRITE			(0)
  • Build the BSP project:

$ make -C software/bsp/

  • Add the following lines in the CONFIG_EXTRA_ENV_SETTINGS definition from the software\bsp\uboot-socfpga\include\configs\socfpga_common.h file:
 \
	"fdtimagesize=0x9000\0" \
	"loadaddr=0x9fc0\0" \
	"fpgaload=fatload mmc 0:${mmcloadpart} 0x2000000 soc_system.rbf; fpga load 0 ${fpgadata} ${filesize}\0" \
	"filesize=6AEBD0\0" \
	"bootcmd=run mmcload; run fpgaload; run bridge_enable_handoff; mw 0xFFC25018 0x00; run mmcboot\0" \
	"bootimage=uImage\0" \
	"mmcboot=setenv bootargs console=ttyS0,115200 root=${mmcroot} rw rootwait;bootm ${loadaddr} - ${fdtaddr}\0" \
	"ethaddr=1c:76:ca:01:23:45\0"
  • Build the BSP and the U-BOOT projects:

$ make -C software/bsp/ uboot

  • Create the Preloader and Bootloader image:

$ cat software/bsp/preloader-mkpimage.bin software/bsp/uboot-socfpga/u-boot.img > software/boot-partition.img

Building the no-OS project using DS-5

  • Open Eclipse for DS-5
  • Import the existing ad9361.tar.gz project (FileImportGeneralExisting Projects into Workspace):

  • Copy all the source files and the u-boot-spl:

  • Build the project
  • Use the ad9361 debug configuration for programming and debugging the project:

  • Watch on the App Console the printed messages:

resources/tools-software/linux-software/altera_soc_images.1506936537.txt.gz · Last modified: 02 Oct 2017 11:28 by Dragos Bogdan