In this article, I decided to take a slight deviation from the general line of the narrative and steer into the Linux road. During the short time that I have been working with the Zynq 7000, I have seen many questions in topic chats about how to start Linux in debug. In general, without thinking twice, I sat down to study the documentation, examples and started it with my own hands under the fee that I have at my disposal. After that, I decided to summarize my knowledge on this issue and describe the procedure for building, preparing a bootable Linux image, which includes U-boot, Device Tree Source, RootFS, and the Linux kernel itself. In addition to this, I decided to complicate the task a little and figured out how you can blink an LED connected to the PL part of a device from Linux user space.
I wrote about all this in this article. Anyone interested - welcome to cat.
! , , , - , , Zynq. SoC Zynq, Linux - , , etc. , . , β¦
, - Linux / ββ PL, D4. , , , SDIO- microSD-, , Ethernet, .
. , , :
BSP Xilinx SDK ( SDK, .. Vitis );
, PL , baremetal-, PS;
First Stage Bootloader;
cross-compile tool , , ;
U-Boot, ;
Linux kernel ;
RootFS;
microSD-;
, Linux ,
, PL Linux sysfs.
BSP Vivado
, Vivado ( - Zynq). , Block Design Zynq Processing System.
. Ok, .
. Zynq Processing System.
PS-PL Configuration. , AXI Non Secure Enablement - GP Master AXI Interface - M AXI GP0 interface . AXI- . .
Peripheral I/O Pins. Bank 1 LVCMOS 1.8V .. RGMII ( Ethernet) 3.3, 1.8 2.5.
, :
Ethernet 0, MDIO 16:27 Enet0 , MDIO 52:53.
SD 0, Card Detect. 40:45 Card Detect 47.
UART. UART 1 12:13.
GPIO MIO GPIO EMIO.
MIO Configuration. .
Ethernet:
SDIO:
UART:
GPIO:
EMIO GPIO (Width) 1.
Clock Configuration:
, , :
. . FCLK_CLK0, 100. Clock .
DDR Configuration . :
Ok.
Zynq PS, Block Design - Processor System Reset. Clock :
AXI Interconnect, PS PL . Reset Clock :
AXI Interconnect AXI GPIO, GPIO-, D4.
GPIO. AXI GPIO GPIO-. All Outputs GPIO Width 1 .. :
. GPIO led_h17_d4 :
Ok Design Sources - zynq_wrapper.bd Create HDL Wrapper. Ok.
. Open Synthesized Design:
, I/O Ports. H17, D4.
Constraints-. :
, . . .
Hardware bitstream-:
baremetal-, : PL- Zynq PS.
SDK File - Launch SDK . File - New - Application Project.
Next. Empty Application.
blink - src New - Source File, main.c. :
/*
* main.c
*
* Created on: Jun 29, 2021
* Author: megalloid
*/
#include "xparameters.h"
#include "xil_printf.h"
#include "xgpio.h"
#include "xil_types.h"
#include "sleep.h"
// Get device IDs from xparameters.h
#define LED_ID XPAR_GPIO_0_DEVICE_ID
#define LED_CHANNEL 1
#define LED_MASK 0b1
int main() {
XGpio_Config *cfg_ptr;
XGpio led_device;
int xStatus;
xil_printf("\r\nEntered function main\r\n");
// Initialize LED Device
cfg_ptr = XGpio_LookupConfig(LED_ID);
xStatus = XGpio_CfgInitialize(&led_device, cfg_ptr, cfg_ptr -> BaseAddress);
if(XST_SUCCESS != xStatus)
print("ERROR! AXI GPIO INIT FAILED \n\r");
else
print("SUCCESS! AXI GPIO INIT OK \n\r");
// Set Led Tristate
XGpio_SetDataDirection(&led_device, LED_CHANNEL, 0);
while (1) {
usleep(100000);
XGpio_DiscreteWrite(&led_device, LED_CHANNEL, LED_MASK);
usleep(100000);
XGpio_DiscreteWrite(&led_device, LED_CHANNEL, 0);
}
}
Ctrl + S. bitstream . Xilinx - Program FPGA Program. bitstream- blink Run As - Launch on Hardware (System debugger). . =)
UART- , , .
First Stage Bootloader
, BSP , . .
, FSBL. Next Zynq FSBL. Finish.
elf- .
Device tree source
U-Boot Linux. Device Tree Source. Device Tree - , .
DTS .
, Xilinx Zynq DTS BSP, Vivado SDK. Devicetree Generator (DTG).
DTS , Xilinx SDK.
git clone https://github.com/Xilinx/device-tree-xlnx
cd device-tree-xlnx
git checkout xilinx-v2019.1
BSP Repository SDK. Xilinx - Repositories - New. , DTG Ok. DTS-:
device_tree Finish. . .
, , Linux - bootargs.
, . . Ok :
DTG , dts-. , :
gcc -I my_dts -E -nostdinc -undef -D__DTS__ -x assembler-with-cpp -o system.dts system-top.dts
Device Tree Sources Device Tree Blob. Device Tree Compiler:
sudo apt install bison flex python-dev swig
git clone https://git.kernel.org/pub/scm/utils/dtc/dtc.git
cd dtc
make
export PATH=$PATH:/<path-to-dtc>/dtc
Device Tree Blob DTS :
dtc -I dts -O dtb -o system.dtb system.dts cp system.dtb zynq-qmtech.dtb
Cross compile tool U-boot
- , U-Boot Linux .
- Linux. -, , . -.
-. Ubuntu :
sudo apt install git gcc-arm-linux-gnueabihf -y
git- U-boot, Xilinx:
git clone https://github.com/Xilinx/u-boot-xlnx.git
cd u-boot-xlnx
, :
export CROSS_COMPILE=arm-linux-gnueabihf-
export ARCH=arm
make distclean
make xilinx_zynq_virt_defconfig
export DEVICE_TREE="zynq-qmtech"
. config-, . :
mv ~/Zynq/Projects/8.Linux/8.Linux.sdk/device_tree_bsp_0/zynq-qmtech.dtb arch/arm/dts/
:
make
, , U-Boot:
.... MKIMAGE spl/boot.bin MKIMAGE u-boot.img COPY u-boot.dtb MKIMAGE u-boot-dtb.img LDS u-boot-elf.lds LD u-boot.elf CFGCHK u-boot.cfg
Linux. :
First stage bootloader. /home/megalloid/Zynq/Projects/8.Linux/8.Linux.sdk/FSBL/Debug/FSBL.elf
Bitstream- . /home/megalloid/Zynq/Projects/8.Linux/8.Linux.sdk/zynq_wrapper_hw_platform_0/zynq_wrapper.bit
U-Boot. U-Boot: /home/megalloid/Zynq/Projects/u-boot-xlnx/u-boot.elf
SDK Xilinx - Create Boot Image. bif-. . . .
. :
Create Image , FSBL, Bitstream- U-Boot.
BOOT.bin SD- UART:
, U-Boot , . Linux U-Boot.
Linux kernel
Linux Xilinx.
git clone https://github.com/Xilinx/linux-xlnx
cd linux-xlnx
make ARCH=arm xilinx_zynq_defconfig
:
make ARCH=arm menuconfig
:
make ARCH=arm UIMAGE_LOADADDR=0x8000 uImage -j8
arch/arm/boot/uImage.
! wiki- Xilinx.
RootFS image
Linux. :
pre-built Xilinx Wiki;
;
, . :
mkdir rootfs
cd rootfs
mv ~/Downloads/arm_ramdisk.image.gz .
, :
gunzip arm_ramdisk.image.gz
chmod u+rwx arm_ramdisk.imag
sudo mount -o loop arm_ramdisk.image tmp_mnt/
cd tmp_mnt/
ls -lsa
megalloid@megalloid-lenovo:~/Zynq/Projects/rootfs/tmp_mnt$ ls -lsa
total 847
1 drwxr-xr-x 18 root root 1024 Nov 28 2012 .
4 drwxrwxr-x 3 megalloid megalloid 4096 Jun 29 17:45 ..
2 drwxr-xr-x 2 root root 2048 Nov 28 2012 bin
1 drwxr-xr-x 2 root root 1024 Nov 28 2012 dev
1 drwxr-xr-x 5 root root 1024 Nov 28 2012 etc
1 drwxrwxrwx 3 root root 1024 Nov 28 2012 home
1 drwxr-xr-x 3 root root 1024 Nov 28 2012 lib
1 drwxr-xr-x 12 root root 1024 Nov 28 2012 licenses
0 lrwxrwxrwx 1 root root 11 Nov 28 2012 linuxrc -> bin/busybox
824 drwx------ 2 root root 838656 Nov 28 2012 lost+found
1 drwxr-xr-x 2 root root 1024 Nov 28 2012 mnt
1 drwxr-xr-x 2 root root 1024 Nov 28 2012 opt
1 drwxr-xr-x 2 root root 1024 Nov 28 2012 proc
1 -rw-r--r-- 1 root root 256 Nov 28 2012 README
1 drwxr-xr-x 2 root root 1024 Nov 28 2012 root
1 drwxr-xr-x 2 root root 1024 Nov 28 2012 sbin
1 drwxr-xr-x 2 root root 1024 Nov 28 2012 sys
1 drwxrwxrwt 2 root root 1024 Nov 28 2012 tmp
1 -rwxr-xr-x 1 root root 481 Nov 28 2012 update_qspi.sh
1 drwxr-xr-x 6 root root 1024 Nov 28 2012 usr
1 drwxr-xr-x 5 root root 1024 Nov 28 2012 var
, , , , . , - . Buildroot Yocto.
:
cd ..
sudo umount tmp_mnt/
gzip arm_ramdisk.image
, U-Boot ramdisk.image, U-Boot. -A "arm" Zynq7000 "arm64" ZynqUS+.
megalloid@megalloid-lenovo:~/Zynq/Projects/rootfs$ mkimage -A arm -T ramdisk -C gzip -d arm_ramdisk.image.gz uramdisk.image.gz Image Name: Created: Tue Jun 29 18:00:27 2021 Image Type: ARM Linux RAMDisk Image (gzip compressed) Data Size: 5310011 Bytes = 5185.56 KiB = 5.06 MiB Load Address: 00000000 Entry Point: 00000000
, Linux - microSD .
megalloid@megalloid-lenovo:/media/megalloid/2B80-859A$ ll
total 14556
drwxr-xr-x 2 megalloid megalloid 4096 Jan 1 1970 ./
drwxr-x---+ 3 root root 4096 Jun 29 18:02 ../
-rw-r--r-- 1 megalloid megalloid 5088608 Jun 29 15:34 BOOT.bin
-rw-r--r-- 1 megalloid megalloid 9640 Jun 29 15:10 devicetree.dtb
-rw-r--r-- 1 megalloid megalloid 4478152 Jun 29 16:59 uImage
-rw-r--r-- 1 megalloid megalloid 5310075 Jun 29 18:00 uramdisk.image.gz
microSD U-Boot, .
U-Boot :
setenv mmc_boot 'fatload mmc 0 0x3000000 uImage; fatload mmc 0 0x2A00000 devicetree.dtb; fatload mmc 0 0x2000000 uramdisk.image.gz; bootm 0x3000000 0x2000000 0x2A00000;'
saveenv
reset
, . Linux .
Linux
U-Boot 2021.01-00031-g4e3336dcb5 (Jun 29 2021 - 15:11:30 +0300)
CPU: Zynq 7z020
Silicon: v3.1
DRAM: ECC disabled 512 MiB
Flash: 0 Bytes
NAND: 0 MiB
MMC: mmc@e0100000: 0
Loading Environment from FAT... OK
In: serial@e0001000
Out: serial@e0001000
Err: serial@e0001000
Net:
ZYNQ GEM: e000b000, mdio bus e000b000, phyaddr -1, interface rgmii-id
Warning: ethernet@e000b000 (eth0) using random MAC address - 2a:9d:8e:81:de:d2
eth0: ethernet@e000b000
Hit any key to stop autoboot: 0
4478152 bytes read in 747 ms (5.7 MiB/s)
9640 bytes read in 19 ms (495.1 KiB/s)
5310075 bytes read in 886 ms (5.7 MiB/s)
## Booting kernel from Legacy Image at 03000000 ...
Image Name: Linux-5.10.0-xilinx-00012-g163a7
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4478088 Bytes = 4.3 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 02000000 ...
Image Name:
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 5310011 Bytes = 5.1 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at 02a00000
Booting using the fdt blob at 0x2a00000
Loading Kernel Image
Loading Ramdisk to 1e5d9000, end 1eae963b ... OK
Loading Device Tree to 1e5d3000, end 1e5d85a7 ... OK
Starting kernel ...
Booting Linux on physical CPU 0x0
Linux version 5.10.0-xilinx-00012-g163a7d26208a (megalloid@megalloid-lenovo) (arm-linux-gnueabihf-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1 SMP PREEMPT Tue Jun 29 16:50:29 MSK 2021
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: xlnx,zynq-7000
earlycon: cdns0 at MMIO 0xe0001000 (options '115200n8')
printk: bootconsole [cdns0] enabled
Memory policy: Data cache writealloc
cma: Reserved 16 MiB at 0x1f000000
Zone ranges:
Normal [mem 0x0000000000000000-0x000000001fffffff]
HighMem empty
Movable zone start for each node
Early memory node ranges
node 0: [mem 0x0000000000000000-0x000000001fffffff]
Initmem setup node 0 [mem 0x0000000000000000-0x000000001fffffff]
percpu: Embedded 15 pages/cpu s32204 r8192 d21044 u61440
Built 1 zonelists, mobility grouping on. Total pages: 130048
Kernel command line: earlycon
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
mem auto-init: stack:off, heap alloc:off, heap free:off
Memory: 486848K/524288K available (6144K kernel code, 248K rwdata, 1856K rodata, 1024K init, 161K bss, 21056K reserved, 16384K cma-reserved, 0K highmem)
rcu: Preemptible hierarchical RCU implementation.
rcu: RCU event tracing is enabled.
rcu: RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
Trampoline variant of Tasks RCU enabled.
rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
efuse mapped to (ptrval)
slcr mapped to (ptrval)
GIC physical location is 0xf8f01000
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 ID prefetch enabled, offset 1 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
random: get_random_bytes called from start_kernel+0x2c4/0x498 with crng_init=0
zynq_clock_init: clkc starts at (ptrval)
Zynq clock init
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns
Switching to timer-based delay loop, resolution 3ns
Console: colour dummy device 80x30
printk: console [tty0] enabled
printk: bootconsole [cdns0] disabled
Booting Linux on physical CPU 0x0
Linux version 5.10.0-xilinx-00012-g163a7d26208a (megalloid@megalloid-lenovo) (arm-linux-gnueabihf-gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1 SMP PREEMPT Tue Jun 29 16:50:29 MSK 2021
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: xlnx,zynq-7000
earlycon: cdns0 at MMIO 0xe0001000 (options '115200n8')
printk: bootconsole [cdns0] enabled
Memory policy: Data cache writealloc
cma: Reserved 16 MiB at 0x1f000000
Zone ranges:
Normal [mem 0x0000000000000000-0x000000001fffffff]
HighMem empty
Movable zone start for each node
Early memory node ranges
node 0: [mem 0x0000000000000000-0x000000001fffffff]
Initmem setup node 0 [mem 0x0000000000000000-0x000000001fffffff]
percpu: Embedded 15 pages/cpu s32204 r8192 d21044 u61440
Built 1 zonelists, mobility grouping on. Total pages: 130048
Kernel command line: earlycon
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
mem auto-init: stack:off, heap alloc:off, heap free:off
Memory: 486848K/524288K available (6144K kernel code, 248K rwdata, 1856K rodata, 1024K init, 161K bss, 21056K reserved, 16384K cma-reserved, 0K highmem)
rcu: Preemptible hierarchical RCU implementation.
rcu: RCU event tracing is enabled.
rcu: RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
Trampoline variant of Tasks RCU enabled.
rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
efuse mapped to (ptrval)
slcr mapped to (ptrval)
GIC physical location is 0xf8f01000
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 ID prefetch enabled, offset 1 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
random: get_random_bytes called from start_kernel+0x2c4/0x498 with crng_init=0
zynq_clock_init: clkc starts at (ptrval)
Zynq clock init
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns
Switching to timer-based delay loop, resolution 3ns
Console: colour dummy device 80x30
printk: console [tty0] enabled
printk: bootconsole [cdns0] disabled
Calibrating delay loop (skipped), value calculated using timer frequency.. 666.66 BogoMIPS (lpj=3333333)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
CPU: Testing write buffer coherency: ok
CPU0: Spectre v2: using BPIALL workaround
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x100000 - 0x100060
rcu: Hierarchical SRCU implementation.
smp: Bringing up secondary CPUs ...
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
CPU1: Spectre v2: using BPIALL workaround
smp: Brought up 1 node, 2 CPUs
SMP: Total of 2 processors activated (1333.33 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 512 (order: 3, 32768 bytes, linear)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
thermal_sys: Registered thermal governor 'step_wise'
cpuidle: using governor menu
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0x(ptrval)
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 32, base_baud = 6249999) is a xuartps
printk: console [ttyPS0] enabled
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
mc: Linux media interface: v0.10
videodev: Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
FPGA manager framework
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource arm_global_timer
NET: Registered protocol family 2
tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
TCP bind hash table entries: 4096 (order: 3, 32768 bytes, linear)
TCP: Hash tables configured (established 4096 bind 4096)
UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
PCI: CLS 0 bytes, default 64
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (no cpio magic); looks like an initrd
Freeing initrd memory: 5188K
hw perfevents: no interrupt-affinity property for /pmu@f8891000, guessing.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
workingset: timestamp_bits=30 max_order=17 bucket_order=0
jffs2: version 2.2. (NAND) (SUMMARY) β 2001-2006 Red Hat, Inc.
io scheduler mq-deadline registered
io scheduler kyber registered
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
dma-pl330 f8003000.dmac: DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
brd: module loaded
loop: module loaded
libphy: Fixed MDIO Bus: probed
CAN device driver interface
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 33 (2a:9d:8e:81:de:d2)
e1000e: Intel(R) PRO/1000 Network Driver
e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
usbcore: registered new interface driver usb-storage
i2c /dev entries driver
cdns-wdt f8005000.watchdog: Xilinx Watchdog Timer with timeout 10s
EDAC MC: ECC not enabled
Xilinx Zynq CpuIdle Driver started
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
ledtrig-cpu: registered to indicate activity on CPUs
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns
timer #0 at (ptrval), irq=46
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
fpga_manager fpga0: Xilinx Zynq FPGA Manager registered
mmc0: SDHCI controller on e0100000.mmc [e0100000.mmc] using ADMA
NET: Registered protocol family 10
Segment Routing with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered protocol family 17
can: controller area network core
NET: Registered protocol family 29
can: raw protocol
can: broadcast manager protocol
can: netlink gateway - max_hops=1
Registering SWP/SWPB emulation handler
of-fpga-region fpga-full: FPGA Region probed
of_cfs_init
of_cfs_init: OK
ALSA device list:
No soundcards found.
RAMDISK: gzip image found at block 0
mmc0: new high speed SD card at address b368
mmcblk0: mmc0:b368 00000 1.83 GiB
mmcblk0: p1
using deprecated initrd support, will be removed in 2021.
EXT4-fs (ram0): mounting ext2 file system using the ext4 subsystem
EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
VFS: Mounted root (ext2 filesystem) on device 1:0.
Starting rcS...
++ Mounting filesystem
mount: mounting /dev/mmcblk0p1 on /mnt failed: No such file or directory
mount: mounting /dev/mmcblk0 on /mnt failed: No such file or directory
++ Setting up mdev
/etc/init.d/rcS: line 12: can't create /proc/sys/kernel/hotplug: nonexistent directory
++ Starting telnet daemon
++ Starting http daemon
++ Starting ftp daemon
++ Starting ssh daemon
random: sshd: uninitialized urandom read (32 bytes read)
rcS Complete
zynq>
sysfs userspace Linux!
zynq> ls /sys/class/gpio/
export gpio1023 gpio905 gpiochip1023 gpiochip905 unexport
zynq> echo 1023 > /sys/class/gpio/export
zynq> echo out > /sys/class/gpio/gpio1023/direction
zynq> echo 0 > /sys/class/gpio/gpio1023/value
zynq> echo 1 > /sys/class/gpio/gpio1023/value
0 1 GPIO- - . !
. , 512 :
zynq> free total used free shared buffers Mem: 508420 30036 478384 0 432 -/+ buffers: 29604 478816 Swap: 0
microSD- :
zynq> mkdir /mnt/mmc zynq> mount /dev/mmcblk0p1 /mnt/mmc zynq> ls /mnt/mmc/ BOOT.bin uImage uramdisk.image.gz devicetree.dtb uboot.env zynq>
, Ethernet. SSH. ifconfig .
zynq> ifconfig
. , .
zynq> ifconfig -a
eth0 Link encap:Ethernet HWaddr 2A:9D:8E:81:DE:D2
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:33 Base address:0xb000
lo Link encap:Local Loopback
LOOPBACK MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
, .
zynq> ifconfig eth0 192.168.2.123 netmask 255.255.255.0 up
macb e000b000.ethernet eth0: PHY [e000b000.ethernet-ffffffff:00] driver [RTL8211E Gigabit Ethernet] (irq=POLL)
macb e000b000.ethernet eth0: configuring for phy/rgmii-id link mode
ifmacb e000b000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
, Ethernet Link . ifconfig:
zynq> ifconfig eth0 Link encap:Ethernet HWaddr 2A:9D:8E:81:DE:D2 inet addr:192.168.2.123 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::289d:8eff:fe81:ded2/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:540 (540.0 B) Interrupt:33 Base address:0xb000
UP - :
zynq> ping 192.168.2.1
PING 192.168.2.1 (192.168.2.1): 56 data bytes
64 bytes from 192.168.2.1: seq=0 ttl=64 time=0.649 ms
64 bytes from 192.168.2.1: seq=1 ttl=64 time=0.568 ms
64 bytes from 192.168.2.1: seq=2 ttl=64 time=0.290 ms
64 bytes from 192.168.2.1: seq=3 ttl=64 time=0.293 ms
^C
--- 192.168.2.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.290/0.450/0.649 ms
. SSH:
sshd. .
zynq> random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
. , , .
:
- PS- ;
- AXI Interconnect, GPIO- D4, ;
- baremetal-;
- (FSBL);
- Device Tree Source ;
- U-Boot Linux;
- Linux Kernel 5.10;
- Linux Kernel U-Boot microSD-;
- we checked the performance of all the periphery we need;
- checked that we can control the LED via sysfs;
See you in the next articles! =)