Toolchain missing GPIO user space API v2

We have upgraded our project from Jetson 35.4.1 to 36.3, including new rootfs and new bootlin toolchain from the download page.

Moving from Linux kernel 5.10 to 5.15 has deprecated the sysfs GPIO interface (/sys/class/gpio/export etc). We’ve updated our code to use the new “GPIO Character Device Userspace API”, we are using version 2 of the API which was added to the Linux kernel in version 5.10 according to the documentation (GPIO Character Device Userspace API — The Linux Kernel documentation).

However the headers included in the toolchain archive (Bootlin Toolchain gcc 11.3 - https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v3.0/toolchain/aarch64--glibc--stable-2022.08-1.tar.bz2) only supports version 1 of the GPIO API, sysroot/usr/include/gpio.h doesn’t have ioctls like GPIO_V2_GET_LINE_IOCTL causing compile errors like:

error: 'GPIO_V2_GET_LINE_IOCTL' was not declared in this scope; did you mean 'GPIO_GET_LINEINFO_IOCTL'?

Headers that do support GPIO user space API v2 can be found in the rootfs and kernel source code from the download page so it is possible to run applications using the API on the board, just not build them using the toolchain.

Do you have an updated bootlin toolchain archive available?

Hi asmund,

Are you using the devkit or custom board for AGX Orin?

The toolchain in current r36 release page seems should be updated to 11.4.
Please let me check this with internal.

Hi,

We are using a custom board.

Yes, an updated version of the bootlin toolchain would be very good.

There are ways to work around the problem, e.g. by using headers from the generated board;
symlinking from rootfs instead of the included sysroot folder and also subfolders in usr/include/aarch64-linux-gnu folder into usr/include (like asm, sys, gnu, and bits), but it’s hacky and doesn’t work well with our build system.

1 Like

Any update on the new toolchain package?

I’ve checked using gcc toolchain 11.3 in Jetson Linux Toolchain and the steps in Kernel Customization to build kernel image/dtb can work as expected on AGX Orin with R36.3.0.

If you have the requirement to use gcc toolchain 11.4, you can try using docker and refer to the steps in JetPack Cross Compilation container | NVIDIA NGC to build your module.

Yes, there are workarounds, and we did end up compiling our own toolchain.
However the toolchain (Bootlin Toolchain gcc 11.3) that is available on Jetson Linux | NVIDIA Developer does not have kernel header files matching the rootfs available on the same page (missing support for GPIO API v2).
So it would be good if you could update that. :)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.