cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
4,144 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
Highlighted
Scholar
Scholar
4,126 Views
Registered: ‎03-22-2016

@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.
Highlighted
Explorer
Explorer
4,122 Views
Registered: ‎03-22-2017

@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
Highlighted
Scholar
Scholar
4,114 Views
Registered: ‎03-22-2016

@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.
Highlighted
Explorer
Explorer
4,102 Views
Registered: ‎03-22-2017

@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
Highlighted
Explorer
Explorer
4,063 Views
Registered: ‎03-22-2017

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

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