UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor rsgrimes
Visitor
1,492 Views
Registered: ‎10-15-2009

PetaLinux AXI Device Drivers (MicroZed/IOCC)

I am trying to get a simple (!) PetaLinux project working. I have a MicroZed paired with the I/O Carrier Card (IOCC); the latter provides 8 user LEDs and four user push buttons.  I am using Vivado 16.02 and PetaLinux 16.02, and I want to create an example system that boots Linux (developed with PetaLinux, probably), and is able to control the LEDs and switches from a Linux application, developed either with the SDK or outside of Xilinx tools.  (FWIW - ultimately, I have an existing Linux app that runs on a computer that I want to port to the MicroZed board; I'd like to continue to support both targets.)

 

I started by working through first the MicroZed tutorials (Vivado/MicroZed familiarization), then through the PetaLinux  UG1144 "PetaLinux Tools Documentation", which got me to a working, bootable MicroZed image!  Yay!  (Kudos to UG1144, as it got me going rather easily.)  The first step got me to some working hardware, with standalone (i.e. bare metal) applications, while the second got me up and running in Linux.  But of course, this was all without support for the IOCC.

 

Next step was to create another hardware configuration the supports the IOCC, and can host Linux.  I think I have that done, and after updating my PetaLinux project, I an boot into Linux.  At this point I haven't verified the hardware is working; probably I should do that in standalone mode as I can use the Xilinx standalone drivers to help.  But looking forward, I realize that I have no detailed idea of how I am going to be able to access the AXI GPIO and Timer modules, nor any others I might add in the future. I've seen the memory-mapped approach that should work for GPIO at first, but I do think I'll need proper LInux drivers soon.

 

I have found some references to the Xilinx wiki pages that talk about "LInux Device Drivers" and device trees, and have found numerous posts here about issues people have had with these facilities, but I don't know where to start; I'm missing a roadmap that outlines the concepts are, how various pieces fit together, where to obtain the correct driver code, and how to incorporate it into my MicroZed Linux apps. Does anyone know of such a technical, detailed introduction, and ideally, with a suitable tutorial that walks through all the steps?  Bonus points if a working example that demonstrates an example for the MicroZed/IOCC!

 

FWIW - I'm willing to work on such a tutorial on the Xilinx wiki, if I can get write access, and I get enough support from the experts out there - paying it forward to future newbies like me!

10 Replies
Scholar jmcclusk
Scholar
1,483 Views
Registered: ‎02-24-2014

Re: PetaLinux AXI Device Drivers (MicroZed/IOCC)

0 Kudos
Moderator
Moderator
1,466 Views
Registered: ‎09-12-2007

Re: PetaLinux AXI Device Drivers (MicroZed/IOCC)

You could create a device driver, or you could use the AXI GPIO and use a UIO to control the pins.

I have created a wiki here
http://www.wiki.xilinx.com/Testing+UIO+with+Interrupt+on+Zynq+Ultrascale

Note: there is a link at the boot on of this wiki to another wiki where there is application code you can use as a reference.



0 Kudos
Visitor rsgrimes
Visitor
1,464 Views
Registered: ‎10-15-2009

Re: PetaLinux AXI Device Drivers (MicroZed/IOCC)

Thanks for the info. Some of these I haven't found, and seem to contain useful information.

 

However, it appears I haven't been as clear as I wanted to be.  I'm wishing for pre-developed drivers for Xilinx-provided IP (such as AXI GPIO, AXI Timer, etc), as they do for standalone, bare-metal systems; does that exist?  I am intrigued by this page: http://www.wiki.xilinx.com/Linux%20Drivers, which seems to indicate there are a wide array of drivers for Xilinx AXI IP, which is what i would have expected and hoped for.  I'm not sure how to include those in my system, though, as they refer to editing things that I don't know how to find.  For example, http://www.wiki.xilinx.com/AXI%20GPIO looks to be exactly what I need, but to use it I need to edit "Kernel Configuration Options" and the "Devicetree".  I don't know where those are located.

 

Some more questions:

  1. Where do I find those two configuration files?
  2. Are these all in the standard PetaLinux environment?  In other words, when I install PetaLinux, are the files and drivers available to me, and all I need to do is configure them thusly?
  3. (Bonus question) . What version of PetaLinux should I be using?

The last question is kind of indicative of my situation.  There are lots of examples of many different topics in the general domain of Xilinx Zync and Linux/PetaLinux; unfortunately, most support only one or a few different versions of the Xilinx tools, and my experience has shown that it is not always easy to extrapolate from an "app note" or the like written for Vivaldo/PetaLinux version X to version Y tools!  For example, last year when I first looked at this project and did some initial investigation, it seems 2016.2 was best for me, as at the time I wanted to do an OpenAMP solution with PetaLinux and FreeRTOS, and that version seemed to have the most info available.  However, I was never able to get that platform built, and I moved to a single core Linux approach.  Anyway, things have changed since my investigation, so I'm open to change.  I do feel I need something with the PetalLinux BSP for the MicroZed board, though.  Any advice there is also welcome.

0 Kudos
Visitor rsgrimes
Visitor
1,459 Views
Registered: ‎10-15-2009

Re: PetaLinux AXI Device Drivers (MicroZed/IOCC)

Yeah, maybe I'm being a bit lazy, but if these exist, no sense reinventing!  Of course, eventually I may need to develop my own driver for some custom IP I may develop, but that is not the critical thing right now.  Clearly, details on how to write drivers, if/when they are needed, is indeed valuable, and appreciated.

0 Kudos
1,428 Views
Registered: ‎04-20-2017

Re: PetaLinux AXI Device Drivers (MicroZed/IOCC)

Device tree is configured withing petalinux directory, system-user.dtsi
The kernel configuration in petalinux-config - c kernel

As far as I understood, please anybody correct me if I am wrong, those drivers on the page are for kernels pace and only usefull when writing ones own kernel driver.

I did not want to do that, so I bound the axi devices to the Uio framework as described in previous post and wrote userspace drivers for them modifying axi registers on the ip cores. That way you get the functionality you actually need
0 Kudos
Visitor rsgrimes
Visitor
1,424 Views
Registered: ‎10-15-2009

Re: PetaLinux AXI Device Drivers (MicroZed/IOCC)

Interesting.  I did find the kernel configuration in another's reply.  I see the system-user.dtsi file, but it is marked with this:

 

/*
 * CAUTION: This file is automatically generated by PetaLinux SDK.
 * DO NOT modify this file
 */

How am I supposed to modify this file?  I didn't see it in UG1157 (e.g. petalinux-config) so I'm not sure what to do there...

0 Kudos
Scholar vanmierlo
Scholar
1,380 Views
Registered: ‎06-10-2008

Re: PetaLinux AXI Device Drivers (MicroZed/IOCC)

You should find it here under your petalinux project dir:

project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

And it does not contain that CAUTION remark. You found that in another file.

0 Kudos
Visitor rsgrimes
Visitor
1,319 Views
Registered: ‎10-15-2009

Re: PetaLinux AXI Device Drivers (MicroZed/IOCC)

Thanks.  I did indeed find that file, but this is all that is in it:

 

/include/ "system-conf.dtsi"
/ {
};

 

 

And of course, this is what is in that file:

 

/*
 * CAUTION: This file is automatically generated by PetaLinux SDK.
 * DO NOT modify this file
 */

 

So I'm still not sure...  That being said, this post and this wiki page have got me where I need to go for now.  I think I'd like to better understand my original questions, but they are not on the critical path right now!

 

0 Kudos
Scholar vanmierlo
Scholar
1,312 Views
Registered: ‎06-10-2008

Re: PetaLinux AXI Device Drivers (MicroZed/IOCC)

Well, since you did not write anything more into it, then there won't be anything else.

 

And the remark is in the included file, because you're not supposed to modify that included file. But you may certainly modify the file that includes it.

0 Kudos
Visitor rsgrimes
Visitor
667 Views
Registered: ‎10-15-2009

Re: PetaLinux AXI Device Drivers (MicroZed/IOCC)

Ah, of course!  Got it, thanks!

0 Kudos