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!

Reply

How can I generate a BSP for linux

Accepted Solution Solved
Adventurer
Posts: 87
Registered: ‎03-14-2012
Accepted Solution

How can I generate a BSP for linux

 

Hi,

 

Now I can run some simple examples in ZC702 board without linux OS. We know that there will be a BSP.

 

But if I want to run a linux OS in ZC702, I think that I must build all ip drivers into the linux kernel. That is to say ,I should generate a BSP for kernel.

 

How can I do that ?

 

Thanks. need your help.

 

Chen.

 


Accepted Solutions
Scholar
Posts: 515
Registered: ‎10-26-2012

Re: How can I generate a BSP for linux

If you want to use an IP in a Linux program, you'll have to write a driver to do that.

 

For some devices, you can get away with a standard "pass througg" driver that just maps the memory area into your application. The "devmem" program does this on the commandline, in a C/C++ program you can do the same by opening "/dev/mem" and then mmap the physical memory range for direct access.

 

This will work for plain AXI memory-like access. If you need to handle interrupts or DMA transfers, then you'll have to write a real driver (the "bible" on writing drivers: http://www.makelinux.net/ldd3/).

View solution in original post


All Replies
Scholar
Posts: 1,596
Registered: ‎09-05-2011

Re: How can I generate a BSP for linux

Please follow the steps

 

1. In SDK File--> New Application Project


2. In the window that opens, Select Linux as the Os Platform

 

LINUX.png

 

 

3. In the next window, select Linux Hello World under Available templates and click Finish.

 


This should create a hello world application including the BSP in Linux. 

 

If you are using Zynq, please refer to chapter 5 and chapter 9 tof the following guide to learn how to boot linux and execute the application.

http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_7/ug873-zynq-ctt.pdf 

 

Adventurer
Posts: 87
Registered: ‎03-14-2012

Re: How can I generate a BSP for linux

Hi,

 

I think you dont understand what does I mean.

 

There is example design of UG925. Now there are some IP which is implemented by PL, but I want to my application can

 

control these IPs. I think that the drivers of all IPs must be built into linux kernel. How can I do this ?

 

For example, if there is no linux os, there will genertate a  BSP to support to configure AXI_VDMA.   There are some codes which is offered by xilinx.

/***********************************/

    Config = XAxiVdma_LookupConfig(VDMA_DEVICE_ID);
    if (!Config) {
        xil_printf(
            "No video DMA found for ID %d\r\n", VDMA_DEVICE_ID);

        return XST_FAILURE;
    }

    /* Initialize DMA engine */
    Status = XAxiVdma_CfgInitialize(&AxiVdma, Config, Config->BaseAddress);
    if (Status != XST_SUCCESS) {

        xil_printf(
            "Configuration Initialization failed %d\r\n", Status);

        return XST_FAILURE;
    }

 

/***********************************/

 

But if I wanto run some application on linux.  how can I call this function "XAxiVdma_CfgInitialize()" ?

 

Thanks. Need your help.

 

Contributor
Posts: 26
Registered: ‎12-24-2013

Re: How can I generate a BSP for linux

XAxiVdma_CfgInitialize is coded in bare metal, and this function operates on registers.

As to linux drivers, we need use ioremap to map register address to virtual address. After this, we can use ioread or iowrite to manipulate virtual address.

So, this function can't be used in linux driver.

Scholar
Posts: 515
Registered: ‎10-26-2012

Re: How can I generate a BSP for linux

If you want to use an IP in a Linux program, you'll have to write a driver to do that.

 

For some devices, you can get away with a standard "pass througg" driver that just maps the memory area into your application. The "devmem" program does this on the commandline, in a C/C++ program you can do the same by opening "/dev/mem" and then mmap the physical memory range for direct access.

 

This will work for plain AXI memory-like access. If you need to handle interrupts or DMA transfers, then you'll have to write a real driver (the "bible" on writing drivers: http://www.makelinux.net/ldd3/).

Explorer
Posts: 169
Registered: ‎09-02-2013

Re: How can I generate a BSP for linux


milosoftware wrote:

(the "bible" on writing drivers: http://www.makelinux.net/ldd3/ )


Fixed that link for you. (it included the ")." at the end)

 

Also, I found this link to be useful

http://www.wiki.xilinx.com/Linux+User+Mode+Pseudo+Driver

It more specifically mentions using /dev/mem and mmap() to map memory for a driver

 

And here is some info about the mmap() function

http://man7.org/linux/man-pages/man2/mmap.2.html

Adventurer
Posts: 87
Registered: ‎03-14-2012

Re: How can I generate a BSP for linux

 

Hi, thanks for all your advices.

 

Yes, I have know that now.

 

Writing a linux driver for one  IP which is implemented by PL is some trouble.

 

If Xilinx can offer some linux driver for their IP cores, Isn't it good ?

 

Thanks to you all.

 

Chen.

Scholar
Posts: 1,596
Registered: ‎09-05-2011

Re: How can I generate a BSP for linux

You will find the Linux drivers at:
http://www.wiki.xilinx.com/Linux+Drivers

Also, you might want to look at:
https://github.com/Xilinx/linux-xlnx
Scholar
Posts: 515
Registered: ‎10-26-2012

Re: How can I generate a BSP for linux

Note that if you instantiate, for example, a 16550 UART in PL, you can use the generic 16550 driver to control it, and need not write a driver yourself.

 

Lots of logic can be made to look like existing hardware. Some logic cores, like the opencore ones, come with existing drivers. So if you write an audio device in logic, outputting the sound like a class-D device on a logic pin, you could make it look like an existing device and use that device's driver to control it.

 

If you have a custom device that processes data, you can also wait for Dyplo to be released. That'll let you control the data flows using code or even shell commands to move the data around between logic, CPU and I/O parts.