In the previous blog post, I have introduced the whole process of establishing the AXI bus custom peripheral, including the Verilog logic part, and the bare metal software part. Naked machine control peripherals is very simple, there is no difference from ordinary microcontrollers, but only have a naked row code far can't play the role of Cortex-A9 hard core. After all, the Zynq chip integrates a maximum dual core that can run to 1GHz. The CPU (XC7Z020 on ZEDBOARD can only be 800MHz). And the zedboard is equipped with Gigabit Ethernet, HDMI, and USB OTG interfaces, not to run the operating system.
Some friends want to do WINCE in zedboard, but this information is extremely scarce, and Wince is a huge size, the copyright cost is high, so that open source has a small embedded Linux to be preferred. Before the rabbit, in order to make a graphical interface, it is also committed to porting the desktop type Linaro Ubuntu system, but the reference example given by Adi has not been optimized. The official version of the Xillinux has not been able to support the simple VGA. Interface (VGA on ZEDBOARD even less than 16 colors), so the rabbit had to give up the previous work, re-enable zedboard factory default lightweight Linux. This system has no graphics desktop, but has included NIC, HDMI drivers, and other basic functions, sufficiently.
Want to control peripherals under Linux, the most important ring is driven, but before you write the drive, you must do some preparations. In order to reduce the workload, we directly modify the factory DEMO of zedboard, join the previously completed MY_GPIO peripheral, and implement the bootloader functionality through U-Boot. This Demo's source project can be found in the zedboard page of the Digilent website:
http://digilentinc.com/products/detail.cfm?navpath=2,400,1028&prod=zedboard
Click Download below to download to zedboard_oob_design.zip files, this compressed package contains XPS project, u-boot file, Linux kernel configuration file, DeviceTree source file, rootfs, etc. There is similar operating instructions in readme.txt, which is recommended to read it again.
The default XPS system project is located under the HW \ XPS_PROJ folder, double-click System.xmp to open the project, and import the MY_GPIO peripheral IP nucleation to the project as previously mentioned.
Port: ZEDBOARD Learning Book (2) Development Custom AXI Bus Peripheral IP Nuclear - Taking LED and Switches as an Example
After that, check if the XPS is assigned an address space for our peripherals. If not, you need to manually set an address. Here we set it 0x75c80000, the space size is 64K of the AXI device uniform.
Set the bus connection according to the method in the zedboard learning incoming (2), the result is as follows:
Modify the XPS_Proj \ Data \ System.ucf file, assign an external pin for the MY_GPIO peripheral (the pin name in the UCF constraint file and must be the same in Ports, there have been many netizens here.). In addition, we allocated the original ARM's GPIO pin position, and should be set to [0: 6] or dry use in the PORT list of XPS to be disabled.
After completing, click Generate BitStream to generate configuration data, then click Export Design, select Export & Launch SDK to export hardware information into the SDK.
In SDK, new C is newly built, different from the bare metal HelloWorld, this time you have to build bootloader, so select FSBL project, the first Stage Bootloader, initialization and startup before implementing U-boot. Other options are default.
Compiling the project, after completing the SDK generates the FSBL ELF file, plus the System.bit from XPS, and U-boot.elf, which we build generated in the first article, you can generate SD cards Start the full bootloader file of the system.
U-boot.el is included in zedboard_oob_design, but this rabbit has not tried it. See: zedboard.Elf through Xilinx U-boot, see: zedboard learning notes (1) First Step - Establish a Xilinx cross-compilation environment
After collecting these three files, click Xilinx Tools → CREATE BOOT Image, add it to the list, select an output path, you can create bootloader.
The SDK will generate a U-boot.bin file in the output road, change it to boot.bin, copy to the SD card, and configure the appropriate jumper for the zedboard board. At this time, open the zedboard power supply, bootloader will initialize the PS, configure PL with BitStream (containing the MY_GPIO peripherals we created) and hand over the operation to U-boot. U-boot automatically loads Device Tree, Linux kernel mirroring and rootfs, and finally launched Linux.
ZEDBOARD APA is also a zimage, devices, and rootfs files, which can be used in this system and controlled peripherals with original C language drivers that use the original, direct translation of Xilinx cross-compilation tools.
Of course, if you want to compile the kernel yourself, or if you don't want to use a static physical address to call your peripheral, you need to take a step back, pay attention to this step, this step is not necessary for the control AXI bus to customize the AXI bus under Linux.
In order to give more interest to friends, you will have a paving, here the rabbit tells the Linux kernel and equipment tree that compiles the zedboard. Of course, this method also records in the ReadMe file in zedboard_oob_design.
In the Linux environment in the PC (rabbit here is ubuntu) Download Digilent Linux kernel source code via the git directive:
Be
Git clone git: //github.com/digilent/linux-3.3-digilent.git
Switch to zedboard branch:
CD Linux-3.3-DIGILENT
Be
git checkout -b zedboard_oob v3.3.0-digilent-12.07-zed-beta
Be
Copy the .config file in zedboard_oob_design to the source directory, then compile the kernel (referring to zedboard_ooard_design):
Cp /Linux/.config ./.config
Be
Make
The generated core mirror zimage is located under the / Arch / ARM / Boot / folder.
Afterwards, the DeviceTree_ramdisk.dts file is then modified, and the MY_GPIO peripheral information is added.
/ ******* LED & SWTICH Controller ***** /
MY_GPIO @ 75c80000 {
Be
Compatible = "XLNX, MY_GPIO-1.00.A";
Be
REG = <0x75c80000 0x10000.1882 .;
Be
XLNX, DPHASE-TIMEOUT = <0x8.1882 .;
Be
XLNX, Family = "Virtex6";
Be
XLNX, C_NUM_REG = <0x1.1882 .;
Be
XLNX, C_NUM_MEM = <0x1.1882 .;
Be
XLNX, S-AXI-min-size = <0x1ff.1882 .;
Be
XLNX, C_SLV_AWIDTH = <0x20.1882 .;
Be
XLNX, C_SLV_DWIDTH = <0x20.1882 .;
Be
XLNX, USE-WSTRB = <0x0.1882 .;
Be
}
Generate a device tree by the following instructions, the same copy to the SD card:
./scripts/dtc/dtc -o dtb -i dts -o ./deventetree_ramdisk.dtb \ /linux/deventetree_ramdisk.dts
This equipment tree file has netizens say that the driver is added to the kernel, but the rabbit is not. If you do not want to load the driver by the physical address of the static device (above 0x75c80000), you can dynamically identify the device according to this device tree information (specifically by XLNX, MY_GPIO-1.00.a Strings).
Specific methods Interested children's shoes can be tried, next time we have to officially write Linux drivers for MY_GPIO peripherals. It's still rain outside the window. I can't get it today. I have to go to the Sunday and my colleagues to go to the arrow. The Great Wall plan is also bubble ...
Our other product: