Through the previous two articles, we not only created the custom IP module but also ported the Linux operating system. Today, the content of this article is to link these two parts. In fact, the myLed IP we created can be one of its relative to the Linux operating system. The underlying device, because the PS bus allocates the addressing address for myLed IP, so that we can create the hardware driver of the myLed IP module, and then build the application to achieve hardware and software co-design.
Of course, you need to understand the basics of the Linux driver and the usage of the Makefile before you start.
Step 1: Set up the working directory, create a Makefile
We first create the working directory of the drivers, and write the Makefile in this directory (above). The Makefile defines the compilation rules, and you only need to use the make command to automate the compilation of the entire project.
Step 2: Write the myLed module driver source file
Our requirement is to create an operational file myled in the /proc/ directory of linux when this module is loaded. By writing data to this file, you can control the status of the led light on the zybo board (according to myLed IP function logic) Related).
Write a good driver myled.c link:
Step 3: Compile the driver and generate the driver module
Just use the make command directly, but be sure to ensure that the cross-compilation environment has been configured before the make command. The generated myLed.ko file is the driver module we need.
Step 4: Modify the device tree file
From the above figure, we can see that the addressing space of the myLed module is 0x43c30000—0x43c3FFFF, so we need to add this device node to the device source code file.
After the source code is modified, we need to recompile and generate the devicetree.dtb file.
Step 5: Test the driver module
We will copy the driver module myLed.ko file and the modified devicetree.dtb file to the SD card, and let zybo start in SD card mode.
Through the insmod and rmmod commands we can load and unload the driver module. After loading the myled.ko module, we can see that the myled file can be seen in the /proc/ directory, and the data read and write operations are supported, indicating that the driver is all normal.
Step 6: Create an application led_blink.c
Create a user_app folder in the directory and create the led_blink.c program. This application achieves the blinking effect by writing 0x0F and 0x00 data to the /proc/myled file to achieve the blinking of the four Led lights.
Step 7: Compile the application
Compilation method We also use the Makefile method, the compilation rules are as shown in the figure above, and the makefile is modified.
The executable application led_blink is generated by the make command.
Step 8: Functional Test
We need to copy the led_blink generated in the previous step to the SD card, then zybo powers up again to start in SD card mode.
After booting, we manually mount the SD card to the /mnt/ directory, then install the driver module via the insmod myled.ko command, and finally execute our application (./led_blink), we will see four on the zybo board. The blinking state of the led light.
At this point, the zybo full-stack development introductory tutorial has come to an end. The Zynq development method is different from the traditional FPGA or ARM development. It combines the two friendly and realizes the software and hardware collaborative design. Of course, in the actual project, the amount of engineering is relatively large, and it is necessary to carry out the division of tasks. This series of introductory tutorials only gives you an understanding of Zynq's comprehensive development model. Of course, more in-depth content requires you to experience it yourself.
The stadium LED screen is ideal for places of with huge crowd. Its high resolution picture and wide viewing angle ensure best quality pictures and videos to every corner of the stadium. Stable body protects the display from any damage, even high speed ball.
The LED Display is manufactured by using best quality material, purchased from most reputed vendors. The final products feature supreme quality and offers best outputs. High refresh rate and gray scale ensures the picture quality remains seamless.
The display features a wide viewing angle of 120° horizontal and 120° in vertical which reaches more viewers. The picture quality remains seamless in all direction and at a distance, presenting all viewers the same highly quality outputs. This makes it suitable for large gathering. -
Stadium LED Display,Football Led Display,Staduim Led Display,Outdoor Football Led Display
Guangzhou Chengwen Photoelectric Technology co.,ltd , http://www.cwledpanel.com