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: 
Observer dviper500
Observer
5,985 Views
Registered: ‎11-08-2010

no includes for linux application?

Jump to solution

This may be a silly problem, but when I generate a new application project for linux, I get no includes folder. Thinking I must be doing something stupid, I went looking for some basic tutorials, and from what I can see they all show an includes folder appearing automatically when the project is generated. My projects show in the project explorer with only Binaries, Debug, and src subdirectories.

 

0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
10,839 Views
Registered: ‎10-06-2016

Re: no includes for linux application?

Jump to solution

Hi,

 

The device tree source file (dts) is only used to create the compiled device tree blob (dtb), which contains the hardware description of the system in that Linux uses to identify which hardware is in the system and pair with the corresponding drivers.

 

When creating a Linux application both in the xSDK or Petalinux environment there is no any BSP project as you can find in the standalone mode, cause in Linux the way to access to the hardware is through Linux device drivers, which are compiled within the kernel or as separated loadable kernel modules. Linux also provides frameworks to access to this devices in a consistent way, in order to be access in a same way to same kind of peripherals of different manufacturers.

 

The case of DMA engine is also special, cause it is designed to be used within kernel space by another device driver. This means that you have to create a linux device driver to control the DMA engine. There is also ways to use the engine from user space applications but it is not the industry standard.

 

Useful pointers:

Xilinx Linux Device Drivers

Linux Device Drivers

Linux DMA from userspace


Ibai
Don’t forget to reply, kudo, and accept as solution.
6 Replies
Observer dviper500
Observer
5,898 Views
Registered: ‎11-08-2010

Re: no includes for linux application?

Jump to solution

No takers, eh? Perhaps the question was a bit too general. I'm new to creating apps for Linux on Zynq, and I'm having a lot of trouble getting started. For context, I'm building on a ZC706 dev board. The purpose of the design is to pull some data from memory via an axi dma core, process it, and put it back. Here are a few things I've tried, plus some more specific followup questions.

 

I pulled the Xlinx device-tree-xlnx repository. I created a BSP in xSDK for the device tree per the instructions in the Xilinx wiki - I was hoping that this might perhaps have a selection of includes I could pull from (sort of like a standalone bsp) but no dice there either. I guess this make sense as the "rt-click -> change referenced BSP" command on my application project appears to do nada. Aside from using DTC to create a device tree blob to boot with, is there anything useful I can do with this as far as building applications? I noticed "device_tree" now appears as an option under OS Platform in the New Project wizard in SDK, so I tried creating an app to target that as an OS, but this only generates a very informative "internal error" message.

 

I likewise pulled the linux-xlnx git repository, and added the include directory of the repo to the include path of my application project (currently just a "hello world"). Adding includes to repo files produced errors about missing asm/ files, so I also added the linux-xlnx/arch/arm/include path to get these. At this point I get MANY errors, culminating eventually with being unable to find asm/current.h. It appears a few arch directories have this file, but arm is not one of them. I figured this is probably a file you get when you build for that arch, so I went ahead and built the kernel according to the xilinx-zynq-defconfig, which did indeed produce the file in the arch/arm/include/generated directory. Adding this include path solves the missing file error, but does nothing for my preponderance of errors, pretty much all of which are some variation of the following:

../src/main.c:13:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
linux-xlnx/include/linux/kernel.h:714:24: error: expected declaration specifiers or ‘...’ before numeric constant
linux-xlnx/include/linux/kernel.h:528:12: error: storage class specified for parameter ‘hex_to_bin’
linux-xlnx/include/linux/bitops.h:64:2: warning: implicit declaration of function ‘fls’ [-Wimplicit-function-declaration]

This is even without using a single function or variable from the includes - all I did was include a file from the repo. I pared the main.c down to int main(void){ return 0; } and still get that top error on the curly brace. 

I guess the moral of this story is I either have something configured badly, or I can't just go and include the linux headers willy nilly. Is there some way to make this work? Do I need to check out a specific branch?

 

Finally, my thoughts turned to the Petalinux SDK... The xSDK new application wizard seems to want a Petalinux project rootfs, so maybe THIS will give me a project that builds and allows access to my hw peripherals? I installed the SDK, created a project, imported my hw definition, and built (following UG980). Everything seemed great until something to do with the axidma driver tripped up the fsbl build. The following is the output:

INFO: Checking component...
INFO: Generating make files and build linux
INFO: Generating make files for the subcomponents of linux
INFO: Building linux
[INFO ] pre-build linux/rootfs/fwupgrade
[INFO ] pre-build linux/rootfs/gpio-demo
[INFO ] pre-build linux/rootfs/latencystat
[INFO ] pre-build linux/rootfs/peekpoke
[INFO ] build linux/kernel
[INFO ] generate linux/u-boot configuration files
[INFO ] update linux/u-boot source
[INFO ] build linux/u-boot
[INFO ] build zynq_fsbl
[ERROR] make[3]: *** [libs] Error 127
[ERROR] make[2]: *** [ps7_cortexa9_0/libsrc/axidma_v9_2/src/make.libs] Error 2
[ERROR] make[1]: *** [build] Error 255
ERROR: Failed to build linux

Undeterred (as I already have an fsbl) I proceeded to petalinux-build -c rootfs, which completed successfully, and generated a new xSDK application project to utilize my new rootfs/stage directory. The resultant project does indeed have an includes folder, but the only directory in it was rootfs/stage/lib, (which, of course, was full of lib files, not includes). I edited this to the only include directory in the vicinity, which was rootfs/stage/usr/lib. Adding includes to these files does not give me the crazy errors I got from the xlnx kernel includes, BUT there appear to be no dma-related header files at all. The hunt continues...

 

 Sorry that was a bit of a long ride - kudos if you're still with me. Any words of guidance/context/advice would be welcome. I feel like the solution to all this has got to be something simple that I'm missing, or nobody would ever develop for linux on zynq!

0 Kudos
Observer dviper500
Observer
5,887 Views
Registered: ‎11-08-2010

Re: no includes for linux application?

Jump to solution

FWIW, the issue building the Petalinux bootloader seems to have been that my libstdc++.so.6 was 64-bit (since I'm running 64-bit Ubuntu). Installing lib32stdc++6 remedied this issue, and now the entire project builds.

 

No luck finding DMA API files exposed to me in xSDK through the rootfs, however. I hoped petalinux-config -c rootfs might allow me to select additional libraries or modules, but both of these submenus are empty in the configuration utility.

 

I generated a petalinux app project following UG981 in hopes it might yield differing results to xSDK...it seems able to find certain kernel files, but including things like linux/dma-mapping.h or linux/dmaengine.h or linux/dma/xilinx_dma.h gets me "no such file or directory" errors. It seems to be telling the truth at least, as I searched the entire project directory, and darn if they aren't there, even after turning on every blessed DMA-related device driver in petalinux-config -c kernel (though there are .o's for each of these in the build directory...appears these are copied from the repo rather than built). I briefly attempted adding the repo's 'drivers/dma' directory to my include path in xSDK, but as these include kernel files themselves, this puts me right back into a barrage of errors like before.

 

0 Kudos
Moderator
Moderator
10,840 Views
Registered: ‎10-06-2016

Re: no includes for linux application?

Jump to solution

Hi,

 

The device tree source file (dts) is only used to create the compiled device tree blob (dtb), which contains the hardware description of the system in that Linux uses to identify which hardware is in the system and pair with the corresponding drivers.

 

When creating a Linux application both in the xSDK or Petalinux environment there is no any BSP project as you can find in the standalone mode, cause in Linux the way to access to the hardware is through Linux device drivers, which are compiled within the kernel or as separated loadable kernel modules. Linux also provides frameworks to access to this devices in a consistent way, in order to be access in a same way to same kind of peripherals of different manufacturers.

 

The case of DMA engine is also special, cause it is designed to be used within kernel space by another device driver. This means that you have to create a linux device driver to control the DMA engine. There is also ways to use the engine from user space applications but it is not the industry standard.

 

Useful pointers:

Xilinx Linux Device Drivers

Linux Device Drivers

Linux DMA from userspace


Ibai
Don’t forget to reply, kudo, and accept as solution.
Visitor russellsnow
Visitor
631 Views
Registered: ‎09-17-2018

Re: no includes for linux application?

Jump to solution

I am frustrated completely by this Xilinx toolchain. Nothing seems to work as advertised. It take days of research to get a simple demo working. I have spent way too much time trying to find metal/include.

In making a new Linux app with the Windows SDK I cannot find the stage file anywhere.


0 Kudos
Visitor russellsnow
Visitor
597 Views
Registered: ‎09-17-2018

Re: no includes for linux application?

Jump to solution

So it seems you need to petalinux-build --sdk in order to generate these files.

So of course it fails with:

 

 Submodule 'capstone' (git://git.qemu.org/capstone.git) registered for path 'capstone'
| Submodule 'ui/keycodemapdb' (git://git.qemu.org/keycodemapdb.git) registered for path 'ui/keycodemapdb'
| Cloning into '/scratch/rds/projs/desperate_try3/build/tmp/work/x86_64-nativesdk-petalinux-linux/nativesdk-qemu-xilinx/v2.11.0-xilinx-v2018.1+gitAUTOINC+1d5516986e-r0/git/capstone'...
| fatal: Unable to look up git.qemu.org (port 9418) (Name or service not known)
| fatal: clone of 'git://git.qemu.org/capstone.git' into submodule path '/scratch/rds/projs/desperate_try3/build/tmp/work/x86_64-nativesdk-petalinux-linux/nativesdk-qemu-xilinx/v2.11.0-xilinx-v2018.1+gitAUTOINC+1d5516986e-r0/git/capstone' failed
| Failed to clone 'capstone'. Retry scheduled
| Cloning into '/scratch/rds/projs/desperate_try3/build/tmp/work/x86_64-nativesdk-petalinux-linux/nativesdk-qemu-xilinx/v2.11.0-xilinx-v2018.1+gitAUTOINC+1d5516986e-r0/git/ui/keycodemapdb'...
| fatal: Unable to look up git.qemu.org (port 9418) (Name or service not known)
| fatal: clone of 'git://git.qemu.org/keycodemapdb.git' into submodule path '/scratch/rds/projs/desperate_try3/build/tmp/work/x86_64-nativesdk-petalinux-linux/nativesdk-qemu-xilinx/v2.11.0-xilinx-v2018.1+gitAUTOINC+1d5516986e-r0/git/ui/keycodemapdb' failed
| Failed to clone 'ui/keycodemapdb'. Retry scheduled
| Cloning into '/scratch/rds/projs/desperate_try3/build/tmp/work/x86_64-nativesdk-petalinux-linux/nativesdk-qemu-xilinx/v2.11.0-xilinx-v2018.1+gitAUTOINC+1d5516986e-r0/git/capstone'...
|   GEN     qapi-visit.c
| fatal: Unable to look up git.qemu.org (port 9418) (Name or service not known)
| fatal: clone of 'git://git.qemu.org/capstone.git' into submodule path '/scratch/rds/projs/desperate_try3/build/tmp/work/x86_64-nativesdk-petalinux-linux/nativesdk-qemu-xilinx/v2.11.0-xilinx-v2018.1+gitAUTOINC+1d5516986e-r0/git/capstone' failed
| Failed to clone 'capstone' a second time, aborting
| ./scripts/git-submodule.sh: failed to update modules
|
| Unable to automatically checkout GIT submodules ' ui/keycodemapdb capstone'.
| If you require use of an alternative GIT binary (for example to
| enable use of a transparent proxy), then please specify it by
| running configure by with the '--with-git' argument. e.g.
|
|  $ ./configure --with-git='tsocks git'
|
| Alternatively you may disable automatic GIT submodule checkout
| with:
|
|  $ ./configure --disable-git-update'
|
| and then manually update submodules prior to running make, with:
|
|  $ scripts/git-sbumodule.sh update  ui/keycodemapdb capstone
|
| make: *** [Makefile:39: git-submodule-update] Error 1
| make: *** Waiting for unfinished jobs....
|   GEN     qapi-event.c
| ERROR: oe_runmake failed
| WARNING: /scratch/rds/projs/desperate_try3/build/tmp/work/x86_64-nativesdk-petalinux-linux/nativesdk-qemu-xilinx/v2.11.0-xilinx-v2018.1+gitAUTOINC+1d5516986e-r0/temp/run.do_compile.58710:1 exit 1 from 'exit 1'
| ERROR: Function failed: do_compile (log file is located at /scratch/rds/projs/desperate_try3/build/tmp/work/x86_64-nativesdk-petalinux-linux/nativesdk-qemu-xilinx/v2.11.0-xilinx-v2018.1+gitAUTOINC+1d5516986e-r0/temp/log.do_compile.58710)

0 Kudos
Visitor m.schappeit
Visitor
196 Views
Registered: ‎08-08-2018

Re: no includes for linux application? - possible workaround

Jump to solution

Hi!

I found this thread while searching for a solution for a similar problem. I found a workaround and documented it here:

https://forums.xilinx.com/t5/Embedded-Linux/Failed-to-petalinux-build-sdk-with-2018-3/td-p/932961

Hope this helps someone.

Bye, Marc.

0 Kudos