Jump to content
  • 0

deppenkaiser

Question

Hello,

i made the following design:

Simple-Arty-Z7-20.thumb.JPG.b05a95c91756ed8f31e4b6744f9347af.JPG

 

You can see two GPIO Ports:

- GPIO_RGB_LED, 3 Bit, Output only

- GPIO_SW, two data bits plus one interrupt bit (e.g. Input clk), this port should throw Interrupts into the Linux App.

 

After i build that design with Vivado, i used petalinux to create a Linux image. Here you can see the "/dev"-Folder which contains the installed Drivers:

 

Simple-Arty-Z7-20-Linux.thumb.JPG.bd6383ae7ae0f55a6963a6d153b3e84d.JPG

You can see three GPIO-Drivers.

Now my question:

In former questions i ask for the Driver Support in Linux and how i can write or use them. You told me, that there is a simple way to access memory mapped ip-cores with the "uio"-Driver.

First i was glad to see that the Drivers are automaticaly added to the image. But i'am missing the expected "uio"-Drivers. What must i do to get the "uio"-Drivers for my design with petalinux?

Thank you...

Link to comment
Share on other sites

22 answers to this question

Recommended Posts

Hello @morsucci,

it does not help, because i mean that i do the same.

So i try to write a bare metal Firmware for my design:

#include <stdio.h>
#include <stdbool.h>

#include "platform.h"
#include "xil_printf.h"
#include "xil_exception.h"

#include "sleep.h"
#include "xparameters.h"
#include "xgpio.h"
#include "xscugic.h"

XGpio gpio_rgb;
XGpio gpio_sw;

XScuGic gic;
XScuGic_Config* pgiccfg = NULL;

volatile bool g_bInterrupt = false;

void IRQ_Handler(void* pData)
{
 g_bInterrupt = true;
    XGpio_InterruptClear((XGpio*) pData, 0xFFFFFFFF);
}

int main()
{
    if (XGpio_Initialize(&gpio_rgb, XPAR_AXI_GPIO_0_DEVICE_ID) == XST_SUCCESS)
    {
     if (XGpio_SelfTest(&gpio_rgb) == XST_SUCCESS)
     {
         XGpio_SetDataDirection(&gpio_rgb, 1, 0x00000000);

         for (int i = 0; i < 100; i++)
   {
    XGpio_DiscreteWrite(&gpio_rgb, 1, i);
    usleep(10000);
   }
     }
    }

 XGpio_DiscreteWrite(&gpio_rgb, 1, 0);

 if ((pgiccfg = XScuGic_LookupConfig(XPAR_PS7_SCUGIC_0_DEVICE_ID)) != NULL)
 {
  if (XScuGic_CfgInitialize(&gic, pgiccfg, pgiccfg->CpuBaseAddress) == XST_SUCCESS)
  {
   if (XScuGic_SelfTest(&gic) == XST_SUCCESS)
   {
    Xil_ExceptionInit();
    Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler) XScuGic_InterruptHandler, &gic);
    Xil_ExceptionEnable();

    if (XScuGic_Connect(&gic, XPAR_FABRIC_AXI_GPIO_1_IP2INTC_IRPT_INTR, IRQ_Handler, &gpio_sw) == XST_SUCCESS)
    {
     XScuGic_SetPriorityTriggerType(&gic, XPAR_FABRIC_AXI_GPIO_1_IP2INTC_IRPT_INTR, 0, 3);
     XScuGic_Enable(&gic, XPAR_FABRIC_AXI_GPIO_1_IP2INTC_IRPT_INTR);

        if (XGpio_Initialize(&gpio_sw, XPAR_AXI_GPIO_1_DEVICE_ID) == XST_SUCCESS)
        {
         if (XGpio_SelfTest(&gpio_sw) == XST_SUCCESS)
         {
             XGpio_SetDataDirection(&gpio_sw, 1, 0xFFFFFFFF);
             XGpio_InterruptGlobalEnable(&gpio_sw);
             XGpio_InterruptEnable(&gpio_sw, 0x1);
             XGpio_InterruptClear(&gpio_sw, 0xFFFFFFFF);

             while (true)
             {
        usleep(1000);
             }
         }
        }
    }
   }
  }
 }

    return 0;
}

This Software is working, if i press the button i got the Interrupt and i can repeat it.

Here you can see a new Version of my Linux code:

SUIOAccess uio_sw = { 0 };

 

UIOAccess_Initialize(&uio_sw, 1, 0);

 

MEMORY_ACCESS(uio_sw.base_addr, GPIO_CHANNEL_1_DIRECTION) = 0xFFFFFFFF;

MEMORY_ACCESS(uio_sw.base_addr, GPIO_GLOBAL_IRQ_ENABLE) = 0x8000000;

MEMORY_ACCESS(uio_sw.base_addr, GPIO_IRQ_ENABLE) = 0x00000001;

MEMORY_ACCESS(uio_sw.base_addr, GPIO_IRQ_STATUS) = 0xFFFFFFFF;

 

if (UIOAccess_ActivateInterrupt(&uio_sw))

{

if (UIOAccess_WaitForInterrupt(&uio_sw))

{

MEMORY_ACCESS(uio_sw.base_addr, GPIO_IRQ_STATUS) = 0xFFFFFFFF;

}

}

 

UIOAccess_DeInitialize(&uio_sw);

 

I learned,  while i was implementing the bare metal Version, that i must clear the Interrupt even if no Interrupt has occured to propper initialize the gpio-interrupt. Now i transpose this into the Linux Version, but it didn't help.

Now my concrete question:

In the bare metal Version, i must configure the Interrupt Controller too. Is this in an Linux Environment even necessary? I run out of ideas, should i implement a stand alone Interrupt Controller (AXI-IP-Core, outside the Zynq) to handle Interrupts?

 

Thank you...

 

Link to comment
Share on other sites

@morsucci

the file "/proc/interrupts" is empty (size == 0). I had no interrupts after booting the Arty (including my interrupt).

So it seems to be an "petalinux-config -c kernel"-issue... But, i do not understand why i have got "uio" devices, which are not fully configured?

My next problem is to understand the dependencies between some kernel settings and the "uio" functionality. It's a bit funny, it is like buying a car but it has no engine - it needs a special order to get a car with engine. Do you know what i mean?

Link to comment
Share on other sites

@morsucci

I do not understand the question "Where are you looking for the interrupts to be registered?". Do you mean, that i must Register an Interrupt (Interrupt-handler) first? I thought, that the universal "uio" device handles Interrupts without any Special Registration, you must only attach them to a address; the "uio" device configuration is the Registration, isn't it?

I will examine the " /proc/interrupts" file and i will tell you later my results.

Link to comment
Share on other sites

@deppenkaiser

 

Where are you looking for the interrupts to be registered?

Are you checking /proc/interrupts?

There you should be able to see a count of all the interrupts that have been fired since the system booted.

Check this file and then fire some more interrupts, and then check it again and see if you have any change under the /uio devices.

Link to comment
Share on other sites

@morsucci,

here is the more detailed view of my GPIO-Interrupt design:

5aa0db40d547d_IRQconnection.JPG.ba0447c4f439654a11ef05316cb20250.JPG

Here is the Interrupt configuration:

5aa0dbcfb3795_IRQConfig.JPG.1c8d8458ba3c1b8028aca73ea5e47820.JPG

Here is the file you like to see:

plnx_arm-system.dts

system-user.dtsi

And finally here my simple IRQ-Handler (own thread):

memvalue32_t nValue = 0;

SUIOAccess uio = { 0 };

 

UIOAccess_Initialize(&uio, 1, 0);

MEMORY_ACCESS(uio.base_addr, GPIO_GLOBAL_IRQ_ENABLE) = 0x8000000;

MEMORY_ACCESS(uio.base_addr, GPIO_IRQ_ENABLE) = 0x00000001;

MEMORY_ACCESS(uio.base_addr, GPIO_CHANNEL_1_DIRECTION) = 0x00000000;

UIOAccess_ActivateInterrupt(&uio);

UIOAccess_WaitForInterrupt(&uio);

nValue = MEMORY_ACCESS(uio.base_addr, GPIO_CHANNEL_1_DATA);

UIOAccess_DeInitialize(&uio);

 

UIOAccess_Initialize(&uio, 0, 0);

MEMORY_ACCESS(uio.base_addr, GPIO_CHANNEL_1_DIRECTION) = 0xFFFFFFFF;

MEMORY_ACCESS(uio.base_addr, GPIO_CHANNEL_1_DATA) = nValue;

UIOAccess_DeInitialize(&uio);

 

Michael

 

 

Link to comment
Share on other sites

Hello @morsucci,

here is my next Problem:

I can access the "uio" devices and i can perform read and write operations like before with the "mem" devices. After that i tried to use the Interrupt ability of my design, here is my next issue.

The Arty-Z7-20 board has two user switches and four user Buttons. In my design you can see the "GPIO_SW" port, which is a three bit Input only port; two bits are connected with the two switches and one bit is connected with one button.

The idea was, that a button press Input raises an Interrupt which leads into a port read Operation wich takes the switch positions and write them to the RGB-LEDs to Show success. This would test the read and write ability in combination with the Interrupt ability.

To achive this i enabled the GPIO_GLOBAL_INTERRUPT and set the GPIO_INTERRUPT_CHANNEL like this:

#define GPIO_CHANNEL_1_DATA 0x00

#define GPIO_CHANNEL_1_DIRECTION 0x04

#define GPIO_CHANNEL_2_DATA 0x08

#define GPIO_CHANNEL_2_DIRECTION 0x0C

#define GPIO_GLOBAL_IRQ_ENABLE 0x011C

#define GPIO_IRQ_STATUS 0x0120

#define GPIO_IRQ_ENABLE 0x0128

MEMORY_ACCESS(uioa.base_addr, GPIO_GLOBAL_IRQ_ENABLE) = 0x8000000;

MEMORY_ACCESS(uioa.base_addr, GPIO_IRQ_ENABLE) = 0x00000001;

MEMORY_ACCESS(uioa.base_addr, GPIO_CHANNEL_1_DIRECTION) = 0x00000000;

Then i activate the Interrupt with a write Operation on the "uio" device, followed by a read Operation to wait for the Interrupt.

But if i press the button nothing happens... I remember that in a microblaze design i must program the Interrupt-Controller. If i comment out the Interrupt code, then i can read the Switches and write the value to the LEDS via uio.

What is wrong?

Thank you...

Link to comment
Share on other sites

try replacing &GPIO_SW with &axi_gpio_1 and &GPIO_RGB_LED with &axi_gpio_0 

That should fix your latest reported build error. Petalinux auto-generates the device tree nodes based on the names of the IP blocks, not the names of the external interfaces.

FYI, pl.dtsi in the components folder is where you will find the axi_gpio nodes that you are modifying. 

Link to comment
Share on other sites

@deppenkaiser are you modifying system-conf.dtsi?

 

When you are adding entries into the device tree in petalinux, you should be modifying system-user.dtsi, not system-conf.dtsi.

 

System-user.dtsi can be found in /base_project_folder/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

If you want, send me a copy of your system-user.dtsi as well as your "pl.dtsi" file which can be found in /base_project_folder/components/plnx_workspace/device-tree-generation/pl.dtsi

Erase anything you added to system-conf.dtsi and then try adding this stuff to system-user.dtsi.

 

Re-run build and send me the output

Link to comment
Share on other sites

Hello @morsucci,

thank you very much for your detailed answers.

Here is the result of my last build:

DEBUG: Executing shell function do_compile
Error: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/system-user.dtsi:10.1-14 Label or path GPIO_RGB_LED not found
Error: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/system-user.dtsi:15.1-9 Label or path GPIO_SW not found
FATAL ERROR: Syntax error parsing input tree
WARNING: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/run.do_compile.7719:1 exit 1 from 'dtc -I dts -O dtb -R 8 -p 0x1000 -i /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0 -i /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation -o /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation/plnx_arm-system.dtb /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation/plnx_arm-system.pp'
ERROR: Function failed: do_compile (log file is located at /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/log.do_compile.7719)

I have undefined symbols.

Here is the the Content of my "system-conf.dtsi":

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


/ {
 chosen {
  bootargs = "console=ttyPS0,115200 earlyprintk";
  stdout-path = "serial0:115200n8";
 };
};

&gem0 {
 local-mac-address = [00 0a 35 00 1e 53];
};

&qspi {
 u-boot,dm-pre-reloc;
 #address-cells = <1>;
 #size-cells = <0>;
 flash0: flash@0 {
  compatible = "micron,m25p80";
  reg = <0x0>;
  #address-cells = <1>;
  #size-cells = <1>;
  spi-max-frequency = <50000000>;
  partition@0x00000000 {
   label = "boot";
   reg = <0x00000000 0x00500000>;
  };
  partition@0x00500000 {
   label = "bootenv";
   reg = <0x00500000 0x00020000>;
  };
  partition@0x00520000 {
   label = "kernel";
   reg = <0x00520000 0x00a80000>;
  };
  partition@0x00fa0000 {
   label = "spare";
   reg = <0x00fa0000 0x00000000>;
  };
 };
};

In my auto generated "system-conf.dtsi" file are no gpio entries.

 

Regards,

deppenkaiser

Link to comment
Share on other sites

@deppenkaiser

Try moving the "chosen" field into the first bracket set.

 

The rest of your entries should be outside of the bracket set.

Here is an example:

  /include/ "system-conf.dtsi"
   
  / {
   
   
  chosen {
          bootargs = "console=ttyPS0,115200 earlyprintk uio_pdrv_genirq.of_id=generic-uio";
  };
   
   
   
 

};

 

&GPIO_RGB_LED
{
 compatible = "generic-uio";
};

&GPIO_SW
{
 compatible = "generic-uio";
};

Try out this configuration and let me know if you run into errors during the build process

Link to comment
Share on other sites

Hello @morsucci,

i'am sorry about my demanding behavior, but i got not the expected result.

Here you can see my "system-user.dtsi" file:

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

&GPIO_RGB_LED
{
 compatible = "generic-uio";
};

&GPIO_SW
{
 compatible = "generic-uio";
};

chosen
{
 bootargs = "console=ttyPS0,115200 earlyprintk uio_pdrv_genirq.of_id=generic-uio";
};

I read your example "system-user.dtsi" from the "Petalinux-Arty-Z7-20-master.zip" Archive. After that i wrote my file including your code given in this thread.

The result is:

czymic@ubuntu:~/projects/pc$ petalinux-build
[INFO] building project
[INFO] sourcing bitbake
INFO: bitbake petalinux-user-image
Loading cache: 100% |############################################| Time: 0:00:04
Loaded 3234 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:00:06
Parsing of 2446 .bb files complete (2414 cached, 32 parsed). 3236 targets, 224 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#######################################| Time: 0:00:32
Checking sstate mirror object availability: 100% |###############| Time: 0:00:13
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: device-tree-generation-xilinx+gitAUTOINC+43551819a1-r0 do_compile: Function failed: do_compile (log file is located at /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/log.do_compile.4445)
ERROR: Logfile of failure stored in: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/log.do_compile.4445
Log data follows:
| DEBUG: Executing shell function do_compile
| Error: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/system-user.dtsi:6.1-14 Label or path GPIO_RGB_LED not found
| Error: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/system-user.dtsi:11.1-9 Label or path GPIO_SW not found
| Error: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/system-user.dtsi:16.1-7 syntax error
| FATAL ERROR: Unable to parse input tree
| WARNING: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/run.do_compile.4445:1 exit 1 from 'dtc -I dts -O dtb -R 8 -p 0x1000 -i /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0 -i /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation -o /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation/plnx_arm-system.dtb /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation/plnx_arm-system.pp'
| ERROR: Function failed: do_compile (log file is located at /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/log.do_compile.4445)
ERROR: Task (/home/czymic/petalinux/components/yocto/source/arm/layers/meta-xilinx-tools/recipes-bsp/device-tree/device-tree-generation_git.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2375 tasks of which 2363 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/czymic/petalinux/components/yocto/source/arm/layers/meta-xilinx-tools/recipes-bsp/device-tree/device-tree-generation_git.bb:do_compile
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
ERROR: Failed to build project
czymic@ubuntu:~/projects/pc$

And here is the log file:

DEBUG: Executing shell function do_compile
Error: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/system-user.dtsi:6.1-14 Label or path GPIO_RGB_LED not found
Error: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/system-user.dtsi:11.1-9 Label or path GPIO_SW not found
Error: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/system-user.dtsi:16.1-7 syntax error
FATAL ERROR: Unable to parse input tree
WARNING: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/run.do_compile.4445:1 exit 1 from 'dtc -I dts -O dtb -R 8 -p 0x1000 -i /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0 -i /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation -o /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation/plnx_arm-system.dtb /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation/plnx_arm-system.pp'
ERROR: Function failed: do_compile (log file is located at /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/log.do_compile.4445)

The log file says that i have undefined symbols (GPIO_RGB_LED, GPIO_SW). So what must i do to give it what it Needs?

 

Thank you...

Link to comment
Share on other sites

Hello @morsucci,

i have edited the "system-user.dtsi" as you wrote:

&GPIO_RGB_LED {
    compatible = "generic-uio";
};

&GPIO_SW {
    compatible = "generic-uio";
};

chosen {
     bootargs = "console=ttyPS0,115200 earlyprintk uio_pdrv_genirq.of_id=generic-uio";
};

TEXT A

After that i got the Error:

*****************************************************************************************************************************************************************************************************

[INFO] building project
[INFO] sourcing bitbake
INFO: bitbake petalinux-user-image
Loading cache: 100% |############################################| Time: 0:00:03
Loaded 3234 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:00:06
Parsing of 2446 .bb files complete (2414 cached, 32 parsed). 3236 targets, 224 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#######################################| Time: 0:00:32
Checking sstate mirror object availability: 100% |###############| Time: 0:00:10
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: device-tree-generation-xilinx+gitAUTOINC+43551819a1-r0 do_compile: Function failed: do_compile (log file is located at /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/log.do_compile.12796)
ERROR: Logfile of failure stored in: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/log.do_compile.12796

Log data follows:
| DEBUG: Executing shell function do_compile
| Error: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/system-user.dtsi:4.2-15 syntax error
| FATAL ERROR: Unable to parse input tree
| WARNING: /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/run.do_compile.12796:1 exit 1 from 'dtc -I dts -O dtb -R 8 -p 0x1000 -i /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0 -i /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation -o /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation/plnx_arm-system.dtb /home/czymic/projects/pc/build/../components/plnx_workspace/device-tree-generation/plnx_arm-system.pp'
| ERROR: Function failed: do_compile (log file is located at /home/czymic/projects/pc/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/log.do_compile.12796)
ERROR: Task (/home/czymic/petalinux/components/yocto/source/arm/layers/meta-xilinx-tools/recipes-bsp/device-tree/device-tree-generation_git.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2376 tasks of which 2374 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/czymic/petalinux/components/yocto/source/arm/layers/meta-xilinx-tools/recipes-bsp/device-tree/device-tree-generation_git.bb:do_compile
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
ERROR: Failed to build project

*****************************************************************************************************************************************************************************************************

Is your code snipped

"gpio@41210000 {
            #gpio-cells = <0x2>;
            compatible = "generic-uio";
            gpio-controller;
            reg = <0x41210000 0x10000>;
            xlnx,all-inputs = <0x0>;
            xlnx,all-inputs-2 = <0x0>;
            xlnx,all-outputs = <0x0>;
            xlnx,all-outputs-2 = <0x0>;
            xlnx,dout-default = <0x0>;
            xlnx,dout-default-2 = <0x0>;
            xlnx,gpio-width = <0xe>;
            xlnx,gpio2-width = <0x20>;
            xlnx,interrupt-present = <0x0>;
            xlnx,is-dual = <0x0>;
            xlnx,tri-default = <0xffffffff>;
            xlnx,tri-default-2 = <0xffffffff>;
        }; "

TEXT B

in the same file as the other stuff (see top of page, TEXT A)?

The two GPIO-Ports have different adresses, do i Need also two entries like the second one (TEXT B)?

 

Thank you...

Link to comment
Share on other sites

Hello @morsucci,

what is the name and location of the "device tree file" where i insert

 "gpio@41210000 {
            #gpio-cells = <0x2>;
            compatible = "generic-uio";
            gpio-controller;
            reg = <0x41210000 0x10000>;
            xlnx,all-inputs = <0x0>;
            xlnx,all-inputs-2 = <0x0>;
            xlnx,all-outputs = <0x0>;
            xlnx,all-outputs-2 = <0x0>;
            xlnx,dout-default = <0x0>;
            xlnx,dout-default-2 = <0x0>;
            xlnx,gpio-width = <0xe>;
            xlnx,gpio2-width = <0x20>;
            xlnx,interrupt-present = <0x0>;
            xlnx,is-dual = <0x0>;
            xlnx,tri-default = <0xffffffff>;
            xlnx,tri-default-2 = <0xffffffff>;
        };"?

I found the other file ("system-user.dtsi").

Do you have or is there a general Manual for such device tree entries? Does Xilinx provide it? What is if i build a custom-ip-core, what is the basic data structure in such a device tree entry?

 

Regards,

deppenkaiser

 

Link to comment
Share on other sites

@deppenkaiser

 

In order for the GPIO devices to be registered with the Kernel as UIO devices, you must declare them as such in the device tree.

 

        gpio@41210000 {
            #gpio-cells = <0x2>;
            compatible = "generic-uio";
            gpio-controller;
            reg = <0x41210000 0x10000>;
            xlnx,all-inputs = <0x0>;
            xlnx,all-inputs-2 = <0x0>;
            xlnx,all-outputs = <0x0>;
            xlnx,all-outputs-2 = <0x0>;
            xlnx,dout-default = <0x0>;
            xlnx,dout-default-2 = <0x0>;
            xlnx,gpio-width = <0xe>;
            xlnx,gpio2-width = <0x20>;
            xlnx,interrupt-present = <0x0>;
            xlnx,is-dual = <0x0>;
            xlnx,tri-default = <0xffffffff>;
            xlnx,tri-default-2 = <0xffffffff>;
        };

 

Here is an example of a GPIO device in the device tree with the compatible string of "generic-uio"

 

To set one of your devices as a UIO device, you must use "system-user.dtsi" which will allow you to overwrite certain properties in the Xilinx-generated device tree for your hardware design. This file can be accessed in "you-base-project/project-spec/meta-user/recipes-bsp/device-tree/files".

 

In "system-user.dtsi", add a part such as this:

&GPIO_RGB_LED {
    compatible = "generic-uio";
};

&GPIO_SW {
    compatible = "generic-uio";
};

Additionally, add a portion like this:

    chosen {
        bootargs = "console=ttyPS0,115200 earlyprintk uio_pdrv_genirq.of_id=generic-uio";
    };

This last portion will tell the kernel to load the uio drivers on boot. You can find examples for this in our repo for the Arty-Z7-20 which is here.

After adding these parts to system-user.dtsi, re-build and re-boot your project and look at your /dev folder again. you should now see some uio entries.

 

Let me know if you need any more help with this.

Regards,
morsucci

 

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...