Both sides previous revisionPrevious revisionNext revision | Previous revision |
resources:tools-software:linux-drivers:platforms:microblaze [23 Apr 2018 11:33] – [Boot Kernel on FPGA Microblaze] Add XSDB support Istvan Csomortani | resources:tools-software:linux-drivers:platforms:microblaze [11 Nov 2022 13:41] (current) – [Get Microblaze Little Endian Toolchain from Xilinx] Raluca Chis |
---|
====== Linux on the Xilinx FPGA development Board ====== | ====== Linux on the Xilinx FPGA development Board ====== |
| |
| <WRAP info> |
| This content is purely informational, and the best place for questions about this content is normally [[https://forums.xilinx.com/t5/Embedded-Linux/bd-p/ELINUX|Xilinx]], or a friendly consultant (who you will pay), or [[https://training.linuxfoundation.org/training/embedded-linux-development/|trainer]]. These instructions work for us. That does not mean they are complete, accurate, or supported. |
| </WRAP> |
| |
This guide provides some step-by-step instructions on how to build a Microblaze Linux Kernel image for the FMC board connected to an | This guide provides some step-by-step instructions on how to build a Microblaze Linux Kernel image for the FMC board connected to an |
* [[xilinx>KCU105]] | * [[xilinx>KCU105]] |
* [[xilinx>VC707]] | * [[xilinx>VC707]] |
| * [[xilinx>VCU118]] |
| * [[xilinx>VCU128]] |
| |
===== Required Software ===== | ===== Required Software ===== |
| |
* [[http://github.com/analogdevicesinc/linux |Linux Kernel Source]] | * [[http://github.com/analogdevicesinc/linux |Linux Kernel Source]] |
* {{:resources:tools-software:linux-drivers:platforms:rootfs.cpio.gz|Root File-system (initramfs)}} | * [[https://swdownloads.analog.com/cse/microblaze/rootfs/rootfs.cpio.gz|rootfs.cpio.gz]] |
* [[xilinx>Vivado|Xilinx Vivado Design Suite (Microblaze GNU Tools)]] | * [[xilinx>products/design-tools/vivado.html|Xilinx Vivado Design Suite (Microblaze GNU Tools)]] |
* [[http://xilinx.wikidot.com/mb-gnu-tools | Microblaze GNU Toolchain]] (See note below) | * [[http://xilinx.wikidot.com/mb-gnu-tools | Microblaze GNU Toolchain]] (See note below) |
| |
Microblaze gnu toolchain from Xilinx is no longer available on git. Please use gnu tools from SDK installation as below: | Microblaze gnu toolchain from Xilinx is no longer available on git. Please use gnu tools from Vitis installation as below: |
| |
| Dave@HAL9000:~/linux$ export PATH=/opt/Xilinx/Vitis/2021.1/gnu/microblaze/linux_toolchain/lin64_le/bin/:$PATH\\ |
| Dave@HAL9000:~/linux$ export ARCH=microblaze\\ |
| Dave@HAL9000:~/linux$ export CROSS_COMPILE=microblazeel-xilinx-linux-gnu- |
| |
Dave@HAL9000:~/fmcomms1/linux$ export PATH=/opt/Xilinx/SDK/2015.2/gnu/microblaze/linux_toolchain/lin64_le/bin:$PATH\\ | <note tip> |
Dave@HAL9000:~/fmcomms1/linux$ export ARCH=microblaze\\ | Latest released files can be downloaded from [[:resources:tools-software:linux-drivers:platforms:microblaze_loading | here]] |
Dave@HAL9000:~/fmcomms1/linux$ export CROSS_COMPILE=microblazeel-xilinx-linux-gnu- | </note> |
| |
===== Build Linux - Step by Step instructions ===== | ===== Build Linux - Step by Step instructions ===== |
==== Get Microblaze Little Endian Toolchain from Xilinx ==== | ==== Get Microblaze Little Endian Toolchain from Xilinx ==== |
| |
Download the Vivado SDK from here [[xilinx>support/download.html | Download]] | Download the Vivado Vitis from here [[xilinx>support/download/index.html/content/xilinx/en/downloadNav/vitis.html | Download]] |
And make sure you followed the instructions for [[http://xilinx.wikidot.com/mb-gnu-tools | Microblaze GNU Toolchain]] | And make sure you followed the instructions for [[http://xilinx.wikidot.com/mb-gnu-tools | Microblaze GNU Toolchain]] |
| |
<WRAP box><wrap info>This specifies any shell prompt running on the development host</wrap> | <WRAP box><wrap info>This specifies any shell prompt running on the development host</wrap> |
<code> | <code> |
Dave@HAL9000:~/linux$ source /opt/Xilinx/SDK/2014.2/settings64.sh | Dave@HAL9000:~/linux$ source /opt/Xilinx/Vivado/2021.1/settings64.sh |
Dave@HAL9000:~/linux$ export ARCH=microblaze | Dave@HAL9000:~/linux$ export ARCH=microblaze |
Dave@HAL9000:~/linux$ export CROSS_COMPILE=microblazeel-xilinx-linux-gnu- | Dave@HAL9000:~/linux$ export CROSS_COMPILE=microblazeel-xilinx-linux-gnu- |
</code></WRAP> | </code></WRAP> |
| |
| <note tip> |
| Instead of sourcing the Vivado settings64.sh script you can alternatively add your microblaze gcc toolchain directly to your PATH variable:\\ |
| <code> |
| Dave@HAL9000:~/linux$ export PATH=/opt/Xilinx/Vitis/2021.1/gnu/microblaze/linux_toolchain/lin64_le/bin/:$PATH |
| </code> |
| </note> |
==== Configure Kernel ==== | ==== Configure Kernel ==== |
| |
==== Get Root File-System ==== | ==== Get Root File-System ==== |
| |
{{:resources:tools-software:linux-drivers:platforms:rootfs.cpio.gz|Root File-system (initramfs)}} <wrap tip>rootfs.cpio.gz must be placed in the root of your kernel tree.</wrap> | The root file system or rootfs contains everything (besides the Linux kernel itself) needed to support a full Linux system. It contains all the (user) applications, configurations, services, data, etc. Without the rootfs your Linux system cannot run. |
| You can either just download the pre-build image or build it yourself. Instructions can be found here: [[resources:tools-software:linux-build:generic:buildroot|Building with buildroot]] |
| |
| [[https://swdownloads.analog.com/cse/microblaze/rootfs/rootfs.cpio.gz|rootfs.cpio.gz]] <wrap tip>rootfs.cpio.gz must be placed in the root of your kernel tree. (~/linux/rootfs.cpio.gz)</wrap> |
| |
<WRAP box bgblue><wrap info>This specifies any shell prompt running on the target or development host</wrap> | <WRAP box bgblue><wrap info>This specifies any shell prompt running on the target or development host</wrap> |
<code> | <code> |
Dave@HAL9000:~/linux$ wget http://wiki.analog.com/_media/resources/tools-software/linux-drivers/platforms/rootfs.cpio.gz | Dave@HAL9000:~/linux$ wget https://swdownloads.analog.com/cse/microblaze/rootfs/rootfs.cpio.gz |
--2014-11-21 14:27:54-- http://wiki.analog.com/_media/resources/tools-software/linux-drivers/platforms/rootfs.cpio.gz | --2022-01-18 09:52:08-- https://swdownloads.analog.com/cse/microblaze/rootfs/rootfs.cpio.gz |
Resolving wiki.analog.com (wiki.analog.com)... 195.170.124.184 | Resolving swdownloads.analog.com (swdownloads.analog.com)... 23.63.205.142 |
Connecting to wiki.analog.com (wiki.analog.com)|195.170.124.184|:80... connected. | Connecting to swdownloads.analog.com (swdownloads.analog.com)|23.63.205.142|:443... connected. |
HTTP request sent, awaiting response... 200 OK | HTTP request sent, awaiting response... 200 OK |
Length: 3006465 (2.9M) [application/octet-stream] | Length: 6772207 (6,5M) [application/x-gzip] |
Saving to: `rootfs.cpio.gz' | Saving to: ‘rootfs.cpio.gz’ |
| |
100%[===================================================================================================================================================================>] 3,006,465 75.1K/s in 37s | rootfs.cpio.gz 100%[===============================================================================================================>] 6,46M 3,32MB/s in 1,9s |
| |
2014-11-21 14:28:32 (79.2 KB/s) - `rootfs.cpio.gz' saved [3006465/3006465] | |
| |
| 2022-01-18 09:52:12 (3,32 MB/s) - ‘rootfs.cpio.gz’ saved [6772207/6772207] |
Dave@HAL9000:~/linux$ | Dave@HAL9000:~/linux$ |
</code></WRAP> | </code></WRAP> |
| |
| |
| |
==== Build kernel ==== | ==== Build kernel ==== |
<WRAP box bgblue><wrap info>This specifies any shell prompt running on the target or development host</wrap> | <WRAP box bgblue><wrap info>This specifies any shell prompt running on the target or development host</wrap> |
<code> | <code> |
Dave@HAL9000:~/linux$ make -j4 simpleImage.kcu105_ad_fmcdaq2_ebz | Dave@HAL9000:~/linux$ make -j4 simpleImage.vcu118_quad_ad9081_204c_txmode_23_rxmode_25_onchip_pll_revc_nz1 |
scripts/kconfig/conf --silentoldconfig Kconfig | SYNC include/config/auto.conf.cmd |
CHK include/config/kernel.release | |
CHK include/generated/uapi/linux/version.h | |
HOSTCC scripts/dtc/checks.o | |
CC scripts/mod/empty.o | CC scripts/mod/empty.o |
| CC scripts/mod/devicetable-offsets.s |
| MKELF scripts/mod/elfconfig.h |
| HOSTCC scripts/mod/modpost.o |
| HOSTCC scripts/mod/sumversion.o |
| HOSTCC scripts/mod/file2alias.o |
| |
[ --snip-- ] | [ --snip-- ] |
| |
CC net/ipv4/xfrm4_output.o | AR init/built-in.a |
CC net/ipv4/xfrm4_protocol.o | |
LD net/ipv4/built-in.o | |
LD net/built-in.o | |
LINK vmlinux | |
LD vmlinux.o | LD vmlinux.o |
MODPOST vmlinux.o | MODPOST vmlinux.symvers |
GEN .version | MODINFO modules.builtin.modinfo |
CHK include/generated/compile.h | GEN modules.builtin |
UPD include/generated/compile.h | LD .tmp_vmlinux.kallsyms1 |
CC init/version.o | KSYMS .tmp_vmlinux.kallsyms1.S |
LD init/built-in.o | AS .tmp_vmlinux.kallsyms1.S |
KSYM .tmp_kallsyms1.o | LD .tmp_vmlinux.kallsyms2 |
KSYM .tmp_kallsyms2.o | KSYMS .tmp_vmlinux.kallsyms2.S |
| AS .tmp_vmlinux.kallsyms2.S |
LD vmlinux | LD vmlinux |
SORTEX vmlinux | SORTTAB vmlinux |
SYSMAP System.map | SYSMAP System.map |
CP vmlinux arch/microblaze/boot/simpleImage.kcu105_ad_fmcdaq2_ebz.unstrip | OBJCOPY arch/microblaze/boot/simpleImage.vcu118_quad_ad9081_204c_txmode_23_rxmode_25_onchip_pll_revc_nz1 |
OBJCOPY arch/microblaze/boot/simpleImage.kcu105_ad_fmcdaq2_ebz | SHIPPED arch/microblaze/boot/simpleImage.vcu118_quad_ad9081_204c_txmode_23_rxmode_25_onchip_pll_revc_nz1.unstrip |
UIMAGE arch/microblaze/boot/simpleImage.kcu105_ad_fmcdaq2_ebz | STRIP vmlinux arch/microblaze/boot/simpleImage.vcu118_quad_ad9081_204c_txmode_23_rxmode_25_onchip_pll_revc_nz1.strip |
Image Name: Linux-3.17.0-126658-g6807aea | UIMAGE arch/microblaze/boot/simpleImage.vcu118_quad_ad9081_204c_txmode_23_rxmode_25_onchip_pll_revc_nz1.ub |
Created: Thu Nov 20 16:50:28 2014 | Image Name: Linux-5.10.0-97916-g513446e488c3 |
| Created: Tue Jan 18 12:07:35 2022 |
Image Type: MicroBlaze Linux Kernel Image (uncompressed) | Image Type: MicroBlaze Linux Kernel Image (uncompressed) |
Data Size: 8425035 Bytes = 8227.57 kB = 8.03 MB | Data Size: 18398124 Bytes = 17966.92 KiB = 17.55 MiB |
Load Address: 80000000 | Load Address: 80000000 |
Entry Point: 80000000 | Entry Point: 80000000 |
STRIP arch/microblaze/boot/simpleImage.kcu105_ad_fmcdaq2_ebz | Kernel: arch/microblaze/boot/simpleImage.vcu118_quad_ad9081_204c_txmode_23_rxmode_25_onchip_pll_revc_nz1 is ready (#3678) |
Kernel: arch/microblaze/boot/simpleImage.kcu105_ad_fmcdaq2_ebz is ready (#1642) | |
Dave@HAL9000:~/linux$ | Dave@HAL9000:~/linux$ |
</code></WRAP> | </code></WRAP> |
| |
| <note tip> |
| The STRIP image found under arch/microblaze/boot/ is the ELF image which can be loaded via the debugger |
| </note> |
| |
| |
Then one method to load the kernel onto the already built and running FPGA which has the Microblaze processor is to launch XMD or XSDB from the Xilinx Vivado toolset from within .../linux/arch/microblaze/boot and run from the XMD or XSDB shell: | Then one method to load the kernel onto the already built and running FPGA which has the Microblaze processor is to launch XMD or XSDB from the Xilinx Vivado toolset from within .../linux/arch/microblaze/boot and run from the XMD or XSDB shell: |
| |
<note important>XMD has been deprecated and will be removed in the future. XSDB replaces XMD and provides additional functionality. Xilinx recommends you switch to XSDB for command line debugging. You can find more information about these tools in the [[https://www.xilinx.com/support/documentation/sw_manuals/xilinx2017_4/ug1043-embedded-system-tools.pdf|Embedded System Tools Reference Manual]] (UG1043)</note> | <note important>XMD has been deprecated and will be removed in the future. XSDB/XSCT replaces XMD and provides additional functionality. Xilinx recommends you switch to XSDB for command line debugging. You can find more information about these tools in the [[xilinx>support/documentation/sw_manuals/xilinx2017_4/ug1043-embedded-system-tools.pdf|Embedded System Tools Reference Manual]] (UG1043)</note> |
| |
| For XMD: |
<code> | <code> |
xmd> fpga -f system_top.bit | xmd> fpga -f system_top.bit |
</code> | </code> |
| |
| For XSDB or XSCT: |
<code> | <code> |
xsdb> connect | xsdb> connect |
xsdb> dow simpleImage.kcu105_fmcdaq2 | xsdb> dow simpleImage.kcu105_fmcdaq2 |
xsdb> con | xsdb> con |
| </code> |
| |
| === Configure and loading using a TCL script === |
| |
| Example TCL script: |
| |
| <code c run.tcl> |
| run.vcu118_quad_ad9081_204c_txmode_23_rxmode_25_onchip_pll_revc_nz1.tcl |
| connect |
| fpga -f system_top.vcu118_quad_ad9081_204c_txmode_23_rxmode_25_revc.bit |
| after 1000 |
| target 3 |
| dow simpleImage.vcu118_quad_ad9081_204c_txmode_23_rxmode_25_onchip_pll_revc_nz1.strip |
| after 1000 |
| con |
| disconnect |
| </code> |
| |
| From XSDB or XSCT: |
| |
| <code> |
| xsdb> source run.tcl |
</code> | </code> |
| |
(more details, methods of how to get bit file and kernel on flash and/or boot off SD Card is appreciated) | (more details, methods of how to get bit file and kernel on flash and/or boot off SD Card is appreciated) |
| |