@:~$ xilinx
Xilinx tools available tools at /opt/Xilinx :-
1) 2021.2 - Vivado - SDK - Vitis - PetaLinux
0) Exit
Please select tools required or exit : 1
Tools are as follows :-
vivado @ /opt/Xilinx/Vivado/2021.2/bin/vivado
vitis @ /opt/Xilinx/Vitis/2021.2/bin/vitis
petalinux-build @ /opt/Xilinx/PetaLinux/2021.2/tool/tools/common/petalinux/bin/petalinux-build
@:~$ cd
@:$ git clone -b v4.0 https://bitbucket.org/spacewire_firmware/zedboard_leds_switches
@:$ cd zedboard_leds_switches
@:/zedboard_leds_switches$ create_vivado_project.sh
@:~$ cd
@:$ git clone -b v10.0 https://bitbucket.org/spacewire_firmware/zedboard_linux
@:~$ cd /zedboard_leds_switches
@:/zedboard_leds_switches$ sed -i 's/4.0/5.0/g' fw/project.txt
@:/zedboard_leds_switches$ wget https://spacewire.co.uk/tutorial/shared/repos/0022/zedboard_leds_switches/fw/project.txt -O fw/project.txt
@:/zedboard_leds_switches$ subl .gitignore
@:/zedboard_leds_switches$ wget https://spacewire.co.uk/tutorial/shared/repos/0022/zedboard_leds_switches/.gitignore -O .gitignore
@:/zedboard_leds_switches$ subl fw/src/design/axi_gpio_zed.v
@:/zedboard_leds_switches$ wget https://spacewire.co.uk/tutorial/shared/repos/0022/zedboard_leds_switches/fw/src/design/axi_gpio_zed.v -O fw/src/design/axi_gpio_zed.v
@:/zedboard_leds_switches$ subl fw/src/design/debounce.v
@:/zedboard_leds_switches$ wget https://spacewire.co.uk/tutorial/shared/repos/0022/zedboard_leds_switches/fw/src/design/debounce.v -O fw/src/design/debounce.v
@:/zedboard_leds_switches$ subl fw/src/design/axi_register_bank.v
@:/zedboard_leds_switches$ wget https://spacewire.co.uk/tutorial/shared/repos/0022/zedboard_leds_switches/fw/src/design/axi_register_bank.v -O fw/src/design/axi_register_bank.v
@:/zedboard_leds_switches$ vivado -nojournal -nolog -notrace fw/vivado/project.xpr &
icon in the Diagram pane inside the BLOCK DESIGN section.
Click OK to commit the changes.
icon. Once validated save the block design and return the floating Diagram pane back to Vivado by clicking on the Dock
icon.
@:/zedboard_leds_switches$ subl fw/src/diagram/system/hdl/system_wrapper.sv
@:/zedboard_leds_switches$ wget https://spacewire.co.uk/tutorial/shared/repos/0022/zedboard_leds_switches/fw/src/diagram/system/hdl/system_wrapper.sv -O fw/src/diagram/system/hdl/system_wrapper.sv
@:/zedboard_leds_switches$ git difftool fw/src/diagram/system/hdl/system_wrapper.sv
Adjust zedboard.xdc and save the file.
@:/zedboard_leds_switches$ subl fw/src/constraint/zedboard.xdc
@:/zedboard_leds_switches$ wget https://spacewire.co.uk/tutorial/shared/repos/0022/zedboard_leds_switches/fw/src/constraint/zedboard.xdc -O fw/src/constraint/zedboard.xdc
@:/zedboard_leds_switches$ git difftool fw/src/constraint/zedboard.xdc
@:/zedboard_leds_switches$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .gitignore
modified: fw/project.txt
modified: fw/src/constraint/zedboard.xdc
modified: fw/src/diagram/system/hdl/system_wrapper.sv
modified: fw/src/diagram/system/system.bd
Untracked files:
(use "git add <file>..." to include in what will be committed)
fw/src/design/axi_gpio_zed.v
fw/src/design/axi_register_bank.v
fw/src/design/debounce.v
no changes added to commit (use "git add" and/or "git commit -a")
@:/zedboard_leds_switches$ git rm -r fw/src/ip_repo
@:/zedboard_leds_switches$ git add fw/src/design/*
@:/zedboard_leds_switches$ git commit -a -m "Replaced Xilinx GPIO with custom GPIO for the Zedboard. Also replaced auto-generated Register Bank with custom version."
@:/zedboard_leds_switches$ git push
@:/zedboard_leds_switches$ git tag -a v5.0 -m "ZYNQ, GPIO Zed, Register Bank & Identification"
@:/zedboard_leds_switches$ git push origin v5.0

@:~$ cd /zedboard_linux
@:/zedboard_linux$ sed -i 's/10.0/11.0/g' os/petalinux/project-spec/meta-user/recipes-apps/website/files/project.txt
@:/zedboard_linux$ wget https://spacewire.co.uk/tutorial/shared/repos/0023/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/website/files/project.txt -O os/petalinux/project-spec/meta-user/recipes-apps/website/files/project.txt
@:/zedboard_linux$ sed -i 's/0x4120/0x4001/g' os/petalinux/project-spec/meta-user/recipes-apps/led-runner/files/led-runner
@:/zedboard_linux$ wget https://spacewire.co.uk/tutorial/shared/repos/0023/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/led-runner/files/led-runner -O os/petalinux/project-spec/meta-user/recipes-apps/led-runner/files/led-runner
@:/zedboard_linux$ cd os/petalinux
@:/zedboard_linux/os/petalinux$ petalinux-config --get-hw-description ../../../zedboard_leds_switches/fw/system_wrapper.xsa
Select Yes when prompted to save the new configuration.
@:/zedboard_linux/os/petalinux$ petalinux-config -c kernel
Then select Userspace I/O drivers.
Change the Userspace I/O platform driver with generic IRQ handling option from <M> to <*>.
Select < Save > to commit the configuration changes.
Select < Ok > to use the default filename provided.
Select < Exit > to close the dialog.
Select < Exit > to leave the Userspace I/O drivers submenu.
Select < Exit > to leave the Device Drivers submenu.
Select the final < Exit > to close the Configuration window.
@:/zedboard_linux/os/petalinux$ cd ../..
@:/zedboard_linux$ subl os/petalinux/components/plnx_workspace/device-tree/device-tree/pl.dtsi
@:/zedboard_linux$ subl os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/pl-custom.dtsi
@:/zedboard_linux$ subl os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
@:/zedboard_linux$ subl os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
@:/zedboard_linux$ wget https://spacewire.co.uk/tutorial/shared/repos/0023/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi -O os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
@:/zedboard_linux$ cd os/petalinux
@:/zedboard_linux/os/petalinux$ petalinux-build
@:/zedboard_linux/os/petalinux$ petalinux-package --prebuilt --force
Set the boot mode jumpers on the Zedboard for JTAG.
Power on the Zedboard.@:~$ minized
Welcome to minicom 2.7.1
OPTIONS: I18n
Compiled on Dec 23 2019, 02:06:26.
Port /dev/ttyACM0, 06:34:25
Press CTRL-A Z for help on special keys
@:/zedboard_linux/os/petalinux$ petalinux-boot --jtag --prebuilt 3
@:/zedboard_linux/os/petalinux$ cd ../..
root@petalinux:~# ls -la /dev/ui*
crw------- 1 root root 246, 0 Jan 1 1970 /dev/uio0
root@petalinux:~# cat /proc/interrupts
CPU0 CPU1
24: 0 0 GIC-0 27 Edge gt
25: 38988 57081 GIC-0 29 Edge twd
26: 0 0 GIC-0 37 Level arm-pmu
27: 0 0 GIC-0 38 Level arm-pmu
28: 43 0 GIC-0 39 Level f8007100.adc
31: 0 0 GIC-0 35 Level f800c000.ocmc
32: 222 0 GIC-0 82 Level xuartps
33: 0 0 GIC-0 51 Level e000d000.spi
34: 127627 0 GIC-0 54 Level eth0
35: 264 0 GIC-0 56 Level mmc0
36: 0 0 GIC-0 45 Level f8003000.dmac
37: 0 0 GIC-0 46 Level f8003000.dmac
38: 0 0 GIC-0 47 Level f8003000.dmac
39: 0 0 GIC-0 48 Level f8003000.dmac
40: 0 0 GIC-0 49 Level f8003000.dmac
41: 0 0 GIC-0 72 Level f8003000.dmac
42: 0 0 GIC-0 73 Level f8003000.dmac
43: 0 0 GIC-0 74 Level f8003000.dmac
44: 0 0 GIC-0 75 Level f8003000.dmac
45: 0 0 GIC-0 40 Level f8007000.devcfg
47: 0 0 GIC-0 43 Level ttc_clockevent
52: 0 0 GIC-0 41 Edge f8005000.watchdog
53: 0 0 GIC-0 61 Edge axi_gpio_zed
IPI0: 0 0 CPU wakeup interrupts
IPI1: 0 0 Timer broadcast interrupts
IPI2: 3631 5888 Rescheduling interrupts
IPI3: 147 218 Function call interrupts
IPI4: 0 0 CPU stop interrupts
IPI5: 0 0 IRQ work interrupts
IPI6: 0 0 completion interrupts
Err: 0
root@petalinux:~# ls /sys/class/uio/uio0
dev event name subsystem version
device maps power uevent
root@petalinux:~# cat /sys/class/uio/uio0/name
axi_gpio_zed
root@petalinux:~# cat /sys/class/uio/uio0/maps/map0/{addr,name,offset,size}
0x40010000
axi_gpio_zed@40010000
0x0
0x00010000
root@petalinux:~# devmem 0x40010000 w 0x18
root@petalinux:~# devmem 0x40010000
0x00000018
root@petalinux:~# devmem 0x4001011c w 0x80000000
root@petalinux:~# devmem 0x40010128 w 0x4
root@petalinux:~# cat /proc/interrupts | grep axi_gpio_zed
53: 1 0 GIC-0 61 Edge axi_gpio_zed
root@petalinux:~# devmem 0x40010120
0x00000004
root@petalinux:~# devmem 0x40010010
0x00000002
root@petalinux:~# devmem 0x40010010 w 0x0
root@petalinux:~# devmem 0x40010120 w 0x4
root@petalinux:~# echo 0x1>/dev/uio0
root@petalinux:~# devmem 0x4001011c w 0x00000000
root@petalinux:~# devmem 0x40010128 w 0x0
Create a configuration file from the address table by clicking on Create.... A generated link (config.txt) should now appear next to the Create... button. Right click on the link and select Save Link As..., set the name to axi_gpio_zed.txt and save the file in /zedboard_linux/os/src/other.
@:/zedboard_linux$ subl os/src/other/axi_gpio_zed.txt
@:/zedboard_linux$ wget https://spacewire.co.uk/tutorial/shared/repos/0023/zedboard_linux/os/src/other/axi_gpio_zed.txt -O os/src/other/axi_gpio_zed.txt
@:/zedboard_linux$ subl os/src/other/zedboard_leds_switches.txt
@:/zedboard_linux$ wget https://spacewire.co.uk/tutorial/shared/repos/0023/zedboard_linux/os/src/other/zedboard_leds_switches.txt -O os/src/other/zedboard_leds_switches.txt
root@petalinux:~# cat /proc/interrupts | grep axi_gpio_zed
53: 2 0 GIC-0 61 Edge axi_gpio_zed
root@petalinux:~# echo 0x1>/dev/uio0
@:/zedboard_linux$ cd os/petalinux
@:/zedboard_linux/os/petalinux$ petalinux-create --type apps --template c --name axi-gpio-zed-test --enable
@:/zedboard_linux/os/petalinux$ tree project-spec/meta-user/recipes-apps/axi-gpio-zed-test
project-spec/meta-user/recipes-apps/axi-gpio-zed-test
├── files
│ ├── Makefile
│ └── axi-gpio-zed-test.c
├── axi-gpio-zed-test.bb
└── README
1 directory, 4 files
@:/zedboard_linux/os/petalinux$ cd ../..
@:/zedboard_linux$ subl os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/files/axi-gpio-zed-test.c
@:/zedboard_linux$ wget https://spacewire.co.uk/tutorial/shared/repos/0023/zedboard_linux/os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/files/axi-gpio-zed-test.c -O os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/files/axi-gpio-zed-test.c
@:/zedboard_linux$ arm-linux-gnueabihf-gcc os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/files/axi-gpio-zed-test.c -o /tmp/axi-gpio-zed-test
@:/zedboard_linux$ scp /tmp/axi-gpio-zed-test root@:/home/root
root@petalinux:~# ./axi-gpio-zed-test
Simple User Space device driver example with interrupts
Device in use ... /dev/uio0
Memory size ..... 65536 (obtained from /sys/class/uio/uio0/maps/map0/size)
Use the buttons to control the LED's :-
Centre - Reset LED's to 00111100
Left - Rotate LED's left
Right - Rotate LED's right
Up - Increase illuminated LED's
Down - Decrease illuminated LED's
Press Ctrl-C to quit application
Interrupt detected, button register = 0x00000001
Interrupt detected, button register = 0x00000004
@:/zedboard_linux$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: os/petalinux/.petalinux/metadata
modified: os/petalinux/project-spec/configs/rootfs_config
deleted: os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/data/register_bank.mdd
deleted: os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/data/register_bank.tcl
deleted: os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/Makefile
deleted: os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank.c
deleted: os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank.h
deleted: os/petalinux/project-spec/hw-description/drivers/register_bank_v1_0/src/register_bank_selftest.c
modified: os/petalinux/project-spec/hw-description/system.xsa
modified: os/petalinux/project-spec/hw-description/system_wrapper.bit
modified: os/petalinux/project-spec/meta-user/conf/user-rootfsconfig
modified: os/petalinux/project-spec/meta-user/recipes-apps/led-runner/files/led-runner
modified: os/petalinux/project-spec/meta-user/recipes-apps/website/files/project.txt
modified: os/petalinux/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
modified: os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend
modified: os/src/other/zedboard_leds_switches.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test/
os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/user_2023-08-08-08-28-00.cfg
os/src/other/axi_gpio_zed.txt
no changes added to commit (use "git add" and/or "git commit -a")
@:/zedboard_linux$ git add os/petalinux/project-spec/meta-user/recipes-apps/axi-gpio-zed-test
@:/zedboard_linux$ git add os/petalinux/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/user_2023-08-08-08-28-00.cfg
@:/zedboard_linux$ git add os/src/other/axi_gpio_zed.txt
@:/zedboard_linux$ git commit -a -m "Enabled Userspace IO Driver & added application to test new PL AXI GPIO Zed module."
@:/zedboard_linux$ git push
@:/zedboard_linux$ git tag -a v11.0 -m "PetaLinux, Peek/Poke, LED Runner, Webserver, Peek/Poke CGI, PL Access, Style Sheet, Register Bank, ID Strings, UIO & GPIO Zed Test with XSA from zedboard_leds_switches v5.0"
@:/zedboard_linux$ git push origin v11.0