Wiki

Clone wiki

dsproto_daq / Expert


Expert Section

Please refrain yourself of the use of the commands in the section below without prior consultation with a DAQ expert, Thank you.

Updating the chronobox from the git repo

exec ssh-agent bash; ssh-add ~/.ssh/chronobox
   requires paraphrase ...
dsproto@ds-proto-daq ~]$ cd chronobox/tdm/
[dsproto@ds-proto-daq tdm]$ ls
./  ../  docs/  .git/  .gitignore  linux/  quartus/  README.md
[dsproto@ds-proto-daq tdm]$ git pull
...

Building the Quartus

[dsproto@ds-proto-daq tdm]$ cd quartus/
[dsproto@ds-proto-daq quartus]$ ls
./  ../  bin/  hdl/  Makefile  scripts/  sim/
[dsproto@ds-proto-daq quartus]$ ~/intelFPGA/18.1/embedded/embedded_command_shell.sh 
WARNING: DS-5 install not detected. SoC EDS may not function correctly without a DS-5 install.
------------------------------------------------
Intel FPGA Embedded Command Shell

Version 18.1 [Build 625]
------------------------------------------------
[dsproto@ds-proto-daq quartus]$ 
[dsproto@ds-proto-daq tdm]$ cd quartus/
 [dsproto@ds-proto-daq quartus]$ make
all                            Build everything except manual
clean                          Clean everything
docs_clean                     Clean all the documentation output files
docs                           Build all the documentation
firmware                       Build Firmware (Quartus+Qsys+SPL)
help                           List available targets
manual_clean                   Clean Manual files
manual_html                    Build the HTML Manual
manual                         Build all the Manuals
manual_pdf                     Build the PDF Manual
minimal                        Used to only build SOF/RBF, avoids updating headers
qsys_clean                     Removes the synthesized Qsys files
qsys_headers                   Generate QSys C Headers
qsys                           Makes the top-level Qsys component
quartus_asm                    Generate Assembly files and update memory contents
quartus_clean                  Remove temporary Quartus files
quartus_cof                    Run Quartus COF file for project
quartus_compile                Full compile of Quartus project
quartus_eda                    Run EDA Netlist Write
quartus_fit                    Perform Fitter
quartus_map                    Perform Analysis and Synthesis 
quartus                        Build Quartus project
quartus_sta                    Perform TimeQuest Timing Analysis
soc_devicetree                 Generate Device Tree Binary
soc                            Build SoC related files (dtb, u-boot.scr)
soc_uboot_script               Generate U-boot script
spl_clean                      Clean Preloader projects
spl_compile                    Compile SPL Project
spl_generate_bsp               Generate the BSP for SPL
spl                            Build SPL (Preloader) Project

[dsproto@ds-proto-daq quartus]$ make quartus_clean
/home/dsproto/intelFPGA/18.1/quartus/common/tcl/internal/
Info: *******************************************************************
Info: Running Quartus Prime Shell
Info: Version 18.1.0 Build 625 09/12/2018 SJ Standard Edition
Info: Copyright (C) 2018  Intel Corporation. All rights reserved.
Info: Your use of Intel Corporation's design tools, logic functions 
Info: and other software and tools, and its AMPP partner logic 
Info: functions, and any output files from any of the foregoing 
Info: (including device programming or simulation files), and any 
Info: associated documentation or information are expressly subject 
Info: to the terms and conditions of the Intel Program License 
Info: Subscription Agreement, the Intel Quartus Prime License Agreement,
Info: the Intel FPGA IP License Agreement, or other applicable license
Info: agreement, including, without limitation, that your use is for
Info: the sole purpose of programming logic devices manufactured by
Info: Intel and sold by Intel or its authorized distributors.  Please
Info: refer to the applicable agreement for further details.
Info: Processing started: Wed Apr 10 19:07:16 2019
Info: Command: quartus_sh --clean chronobox
Info: Quartus(args): chronobox
Info: /home/dsproto/intelFPGA/18.1/quartus/common/tcl/internal/qsh_clean.tcl version #1
Info: Removed 449 files/folders from project.
Info (23030): Evaluation of Tcl script /home/dsproto/intelFPGA/18.1/quartus/common/tcl/internal/qsh_clean.tcl was successful
Info: Quartus Prime Shell was successful. 0 errors, 0 warnings
Info: Peak virtual memory: 881 megabytes
Info: Processing ended: Wed Apr 10 19:07:18 2019
Info: Elapsed time: 00:00:02
Info: Total CPU time (on all processors): 00:00:02

[dsproto@ds-proto-daq quartus]$ make all
Generating Qsys
...
... after 5..10 minutes
...
Configuring for socfpga_cyclone5 board...
Copying SPL binary to quartus/bin
\nGenerating U-Boot script
Image Name:   Chronobox Script
Created:      Wed Apr 10 19:31:21 2019
Image Type:   ARM Linux Script (uncompressed)
Data Size:    143 Bytes = 0.14 kB = 0.00 MB
Load Address: 00000000
Entry Point:  00000000
Contents:
Image 0: 135 Bytes = 0.13 kB = 0.00 MB
[dsproto@ds-proto-daq quartus]$

Building the buildroot

cd ../linux
[dsproto@ds-proto-daq linux]$ ls
 ./   buildroot/  gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux/   linux-socfpga/  u-boot-socfpga/
../  config/     install_sdcard.sh*                                 Makefile
[dsproto@ds-proto-daq linux]$ make
all                            Install and build all components (cross-compiler, kernel, u-boot, buildroot) 
buildroot                      Build Buildroot Linux Distribution
buildroot_clean                Clean Buildroot Linux Distribution
buildroot_config               Configure Buildroot Linux Distribution
buildroot_install              Install Buildroot Linux Distribution
build                          Build components
cc_install                     Install Linaro ARM compiler
help                           List available targets
install                        Install components 
kernel                         Build Linux Kernel
kernel_config                  Configure Linux Kernel
kernel_install                 Install Linux Kernel for Altera SoC FPGAs
sdcard                         Makes an SDcard image using a loopback device
uboot                          Build U-boot image
uboot_clean                    Clean U-boot files
uboot_install                  Install U-boot for Altera SoC FPGAs
[dsproto@ds-proto-daq linux]$ make buildroot_clean
[dsproto@ds-proto-daq linux]$ make all
Linaro Cross-compiler already exists
U-Boot for SoC FPGA already exists
Linux Kernel for SoC FPGA already exists
Buildroot already exists
Building U-Boot...
make[1]: Entering directory `/home/dsproto/chronobox/tdm/linux/u-boot-socfpga'
make[2]: Entering directory `/home/dsproto/chronobox/tdm/linux/u-boot-socfpga/doc/DocBook'
...
... After 12..15 minutes ...
...
rootdir=/home/dsproto/chronobox/tdm/linux/buildroot/output/build/buildroot-fs/tar/target
table='/home/dsproto/chronobox/tdm/linux/buildroot/output/build/buildroot-fs/device_table.txt'
make[1]: Leaving directory `/home/dsproto/chronobox/tdm/linux/buildroot'
[dsproto@ds-proto-daq linux]$

Making the SDcard partitions

This section is failing under CENTOS, working on an alternative procedure

From root:

[dsproto@ds-proto-daq linux]# make sdcard
Verifying files exist for image creation
Creating SDcard image file
131072+0 records in
131072+0 records out
134217728 bytes (134 MB, 128 MiB) copied, 0.412972 s, 325 MB/s
Mounting Filesystem into loopback device /dev/loop25
Creating Partitions
Checking that no-one is using this disk right now ... OK

Disk /dev/loop25: 128 MiB, 134217728 bytes, 262144 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

>>> Created a new DOS disklabel with disk identifier 0x859a74cb.
/dev/loop25p1: Created a new partition 1 of type 'FAT16' and of size 32 MiB.
/dev/loop25p2: Created a new partition 2 of type 'Linux' and of size 93 MiB.
/dev/loop25p3: Created a new partition 3 of type 'Unknown' and of size 2 MiB.
/dev/loop25p4: Done.

New situation:
Disklabel type: dos
Disk identifier: 0x859a74cb

Device        Boot  Start    End Sectors Size Id Type
/dev/loop25p1        2048  67583   65536  32M  6 FAT16
/dev/loop25p2       67584 258047  190464  93M 83 Linux
/dev/loop25p3      258048 262143    4096   2M a2 unknown

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Creating FAT FS on /dev/loop25p1 called BOOT
mkfs.fat 4.1 (2017-01-24)
Creating EXT3 FS /dev/loop25p2 called chronobox
mke2fs 1.44.4 (18-Aug-2018)
Discarding device blocks: done
Creating filesystem with 95232 1k blocks and 23808 inodes
Filesystem UUID: 197beb2a-4247-4921-8112-2a77474abafa
Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729

Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

Writing Preloader to /dev/loop25p3
    4+0 records in
4+0 records out
262144 bytes (262 kB, 256 KiB) copied, 0.0240664 s, 10.9 MB/s
Writing U-Boot to /dev/loop25p3
3+1 records in
3+1 records out
240688 bytes (241 kB, 235 KiB) copied, 0.0281135 s, 8.6 MB/s
Mounting FAT filesystem on /dev/loop25p1 at .../BOOT
Creating BOOT mount point
Copying chronobox.rbf to BOOT partition
Copying u-boot.scr to BOOT partition
Copying socfpga.dtb to BOOT partition
Copying zImage to BOOT partition
Unmounting BOOT partition
Mounting EXT3 filesystem on /dev/loop25p2 at .../chronobox
Creating chronobox mount point
Untaring buildroot fs
Unmounting chronobox partition
Detaching loopback device /dev/loop25
Cleaning up temp directories...
All done!

SDcard image is located at ~/chronobox/tdm/linux/image/chronobox.img

Flashing the SDcard

From root:

  • Connect the SDcard to the PC
  • Confirm the device name "sd<x>" is present
  • Run the install_sdcard.sh from the linux directory

[dsproto@ds-proto-daq linux]#
# ./install_sdcard.sh /dev/sd<x>

example with /dev/sdb...
./install_sdcard.sh /dev/sdb
Mounts associated with this partition

Please type 'yes' to confirm you wish to write to /dev/sdb: yes

Copying image to sdcard... 
134217728 bytes (134 MB, 128 MiB) copied, 44 s, 3.1 MB/s
32+0 records in
32+0 records out
134217728 bytes (134 MB, 128 MiB) copied, 43.8296 s, 3.1 MB/s

The SDcard can be mounted for verification

/dev/sdb1        32M  5.0M   27M  16% /media/.../BOOT
/dev/sdb2        87M   42M   41M  51% /media/.../chronobox

Checking the SDCard boot sequence from the serial console

From root: * Place the sdcard in the DE10-Nano slot. * Connect the DE10-Nano serial port to the PC (connector next to the ETH) * Power the DE10-Nano * ttyUSB0 should be present under /dev * start the termnial console * picocom /dev/ttyUSB0 -b 115200

# picocom /dev/ttyUSB0 -b 112500
picocom v3.1
port is        : /dev/ttyUSB0
flowcontrol    : none
baudrate is    : 112500
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready

Welcome to Chronobox
buildroot login:  root<cr>
# cd /
# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                88123     42252     41110  51% /
/dev/mmcblk0p1           32686      5418     27268  17% /mnt/boot
# ls
bin         lib         lost+found  opt         run         tmp
dev         lib32       media       proc        sbin        usr
etc         linuxrc     mnt         root        sys         var

Flashing the SDcard

From root:

make sdcard
  • Connect the SDcard to the PC
  • Confirm the device name "sd<x>" is present
  • Run the install_sdcard.sh from the linux directory

cd ~/chronobox/tdm/linux
../../install_sdcard.sh /dev/sd<x>
../../install_sdcard.sh /dev/sdb
Mounts associated with this partition

Please type 'yes' to confirm you wish to write to /dev/sdb: yes

Copying image to sdcard... 
134217728 bytes (134 MB, 128 MiB) copied, 44 s, 3.1 MB/s
32+0 records in
32+0 records out
134217728 bytes (134 MB, 128 MiB) copied, 43.8296 s, 3.1 MB/s

Checking the SDCard boot sequence from the serial console

From root: * Place the sdcard in the DE10-Nano slot. * Connect the DE10-Nano serial port to the PC (connector next to the ETH) * Power the DE10-Nano * ttyUSB0 should be present under /dev * start the termnial console * picocom /dev/ttyUSB0 -b 115200

midas@pierre4v:~$ sudo picocom /dev/ttyUSB0 -b 112500
picocom v3.1
port is        : /dev/ttyUSB0
flowcontrol    : none
baudrate is    : 112500
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,
logfile is     : none
initstring     : none
exit_after is  : not set
exit is        : no

Type [C-a] [C-h] to see available commands
Terminal ready

Welcome to Chronobox
buildroot login:  root<cr>
# cd /
# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                88123     42252     41110  51% /
/dev/mmcblk0p1           32686      5418     27268  17% /mnt/boot
# ls
bin         lib         lost+found  opt         run         tmp
dev         lib32       media       proc        sbin        usr
etc         linuxrc     mnt         root        sys         var

At this point the boot sequence may already been done. In case you want to see the boot msg, run the reboot command. Pay attention at the network if it starts correctly.

# reboot
U-Boot SPL 2013.01.01 (Mar 06 2019 - 19:53:19)
BOARD : Altera SOCFPGA Cyclone V Board
CLOCK: EOSC1 clock 25000 KHz
CLOCK: EOSC2 clock 25000 KHz
CLOCK: F2S_SDR_REF clock 0 KHz
CLOCK: F2S_PER_REF clock 0 KHz
CLOCK: MPU clock 800 MHz
CLOCK: DDR clock 400 MHz
CLOCK: UART clock 100000 KHz
CLOCK: MMC clock 50000 KHz
CLOCK: QSPI clock 3125 KHz
RESET: WARM
INFO : Watchdog enabled
SDRAM: Initializing MMR registers
SDRAM: Calibrating PHY
SEQ.C: Preparing to start memory calibration
SEQ.C: CALIBRATION PASSED
SDRAM: 1024 MiB
ALTERA DWMMC: 0

U-Boot 2013.01.01-g0c9a3bd-dirty (Feb 28 2019 - 16:03:30)

CPU   : Altera SOCFPGA Platform
BOARD : Altera SOCFPGA Cyclone V Board
...

Ctl-a, CTL-x : to exit picocom

Updated