Digilent Arty board and Linux - Part 2 - Linux Device Tree

We created a basic FPGA system capable to run Linux in the Part 1 around a Microblaze processor in a Xilinx Artix 7 FPGA (Arty evaluation board) and now it is time to build the Linux image.

For that task we are using Buildroot, an integrated tool to generate embedded Linux system including the generation of needed cross toolchain.

So the first thing we need to generate is the Linux Device Tree, which contains the hardware data needed by the booter and operative system to know how to deal with the created hardware. All memory map, existing buses, CPU details like cache configuration, interrupts or clock frequency, existing timers, UART modules details, etc.

  • To create our hardware we used IP cores from Xilinx, like AXI_Uartlite or the own Microblaze so we need to download the linux device tree for Xilinx, last version can be found in the following link. However I included the package file at the end containing used files.

    https://github.com/Xilinx/device-tree-xlnx.github

    Extract device-tree-xlnx-master on Vivado project *.sdk subfolder.
     

  • On our Vivado project, go to File > Launch SDK. Once Eclipse is opened, go to Xilinx Tools > Repositories to include the new folder as a repository.
    Then click New ... and find the extracted folder.


     

  •  Go to File > New > Board Support Package and at the bottom, select device_tree. Default settings are ok to continue so click on Finish to create the project.
    A new window with the BSP settings is opened but with the default settings are enough to perform the example so click OK to go back to the Eclipse main view. In the future if you want to change the BSP settings you can double click to the .mss file and modify them.
    You can note the assigned drivers for each device:
    • axi_ethernetlite_0: emaclite
    • axi_timer_0: tmrctr
    • axi_uartlite_0: uartlite
    • microblaze_0_axi_intc: intc
    • microblaze_0_local_memory*: generic
    • mig_7series_0: mig_7series
       

It is time to create a .dts file containing the Linux Device Tree which will be included in the buildroot to build the kernel. We are going to merge the files "pl.dtsi" and "system.dts" created by the SDK.

  • Open the "pl.dtsi" and "system.dts" files. From the second one, copy the /dts-v1/; to the "pl.dtsi" file, previous to "/ {".
    In the same way, copy from "chosen {" to the closing "};" before the "cpus {" line. The result should look like the following screenshot.

Save the file as "artylinux.dts".

[PENDING] The MAC information for the ethernet interface needs to be located in the linux device tree in order to load the MAC address at the system start. I need to check where to put the information.

 

At this moment we have the Linux Device Tree for our created hardware, a file containing all needed information to compile and configure the booter and Linux kernel to be ran on our system.

The next step will be to compile the Linux kernel

 

References

[1] http://www.devicetree.org/specifications-pdf

[2] https://docs.numato.com/kb/neso-microblaze-linux-run-linux-neso-artix-7-fpga-module/

[3] https://events.linuxfoundation.org/sites/events/files/slides/petazzoni-device-tree-dummies.pdf
 

 

AttachmentSize
device-tree-xlnx-master.zip166.36 KB
artylinux.dts6.86 KB