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: 
Explorer
Explorer
3,726 Views
Registered: ‎03-22-2017

Porting bare metal SDK application to Linux + Device Driver

So far 

  • I tested my PL accelerators in bare-metal through the SDK;
  • I am also able to run remote user space applications in Linux (Remote ARM Linux Application).

 

The final step will be to integrate the SDK-generated device drivers with the user space application and run them on Linux on the board. Is there any tutorial about that?

 

This video shows only the setup of a user space application

https://www.xilinx.com/video/hardware/how-to-create-linux-applications.html

 

Thank you

0 Kudos
6 Replies
Scholar hbucher
Scholar
3,708 Views
Registered: ‎03-22-2016

Re: Porting bare metal SDK application to Linux + Device Driver

@gdg Usually you would just create a device driver and embed the baremetal code inside. It is not much different. 

https://www.safaribooksonline.com/library/view/linux-device-drivers/0596005903/ch02.html

Have you considered leaving that app running on baremetal and just talking to Linux on other cores?

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
Explorer
Explorer
3,704 Views
Registered: ‎03-22-2017

Re: Porting bare metal SDK application to Linux + Device Driver

@hbucher, I guess I will "integrate/port" the baremetal core to the device driver.

 

But I am still wondering if Xilinx provide an example of how to "seamlessly" port a traditional baremetal application to user app + device driver.

 

Thank you

0 Kudos
Scholar hbucher
Scholar
3,696 Views
Registered: ‎03-22-2016

Re: Porting bare metal SDK application to Linux + Device Driver

@gdg  Perhaps but I dont know of.

The issue is that under linux you have to choose the way your driver will interact with the user app - or if it is going to expose any device at all.

At this point it is not Xilinx-specific anymore since on standalone everything is basically done through memory poking. 

 There are a few choices: char device, block device, through ioctl, memory mapped, etc. 

https://en.wikipedia.org/wiki/Device_file

Brief tutorials

http://freesoftwaremagazine.com/articles/drivers_linux/

 

vitorian.com --- We do this for fun. Always give kudos. Accept as solution if your question was answered.
I will not answer to personal messages - use the forums instead.
Explorer
Explorer
3,684 Views
Registered: ‎03-22-2017

Re: Porting bare metal SDK application to Linux + Device Driver

@hbucher, I understand the point.

 

As an alternative to the Vivado flow (HLS, integrator, SDK), I use another HLS tool to design accelerators on FPGAs. In that case, I manually write the device drivers (char device, memory map, and ioctl). I assume that adapting those drivers is doable. But I do not want to re-invent the wheel if there is a Xilinx automatic flow.

 

In particular, I can find in my Vivado project these files:

 

 

accelerator_project/accelerator_project.sdk/accelerator_design_wrapper_hw_platform_0/drivers/accelerator_v1_0/src/accelerator.c

accelerator_project/accelerator_project.sdk/accelerator_design_wrapper_hw_platform_0/drivers/accelerator_v1_0/src/accelerator.h

accelerator_project/accelerator_project.sdk/accelerator_design_wrapper_hw_platform_0/drivers/accelerator_v1_0/src/accelerator_linux.c

accelerator_project/accelerator_project.sdk/accelerator_design_wrapper_hw_platform_0/drivers/accelerator_v1_0/src/accelerator_sinit.c

 

These seem to be Linux User Space device drivers:

http://blog.idv-tech.com/wp-content/uploads/2014/09/drivers-session3-uio-4public.pdf

 

I am wondering if I can use them.

 

0 Kudos
Explorer
Explorer
3,645 Views
Registered: ‎03-22-2017

Re: Porting bare metal SDK application to Linux + Device Driver

The drivers that are generated in SDK seems to be good both for bare-metal and UIO on Linux. I put here an image showing what I am looking at. Hopefully, someone can tell me if they can be really used in Linux and how.

 

drivers.png

0 Kudos
Explorer
Explorer
3,233 Views
Registered: ‎03-22-2017

Re: Porting bare metal SDK application to Linux + Device Driver

I have almost successfully ported the generated UIO drivers to Linux, but there is a problem on ZynqUltrascale+ (i.e. ARM Cortex-A53, 64bit-processor).

 

I opened a different topic for that:

https://forums.xilinx.com/t5/UltraScale-Architecture/UIO-driver-are-for-32bit-ARM-architecture-not-64bit/m-p/795766#M5187

 

 

0 Kudos