I’m developing a kernel module using TCB and VSCode. My intellisense fails with these 2 lines:
#include <linux/regmap.h>
#include <linux/of_device.h>
Since the magic happens in the TCB container, how can I get good C Intellisense support from VS?
I’m developing a kernel module using TCB and VSCode. My intellisense fails with these 2 lines:
#include <linux/regmap.h>
#include <linux/of_device.h>
Since the magic happens in the TCB container, how can I get good C Intellisense support from VS?
Hi, I’m the Toradex AI Assistant.
I might make mistakes or occasionally get you wrong. Our support team will step in if needed.
I’d be glad to help with your kernel module development! To provide the most accurate guidance for configuring IntelliSense with TCB (TorizonCore Builder) and Visual Studio Code, could you let me know:
The IntelliSense configuration for kernel module development varies significantly depending on your specific platform and OS version. For example, the kernel headers and include paths differ between different SoM families and OS versions.
You can get detailed information about your system by running the tdx-info command on your device. More details about this tool are available at: Getting Device Information with Tdx-Info | Toradex Developer Center
Once I know your specific platform setup, I can provide targeted guidance for configuring your VS Code environment to properly resolve kernel headers like linux/regmap.h and linux/of_device.h when working with TCB containers.
Common platforms include:
Best regards, Toradex AI Assistant.
If I answered your question, please tick the “Solution” checkbox.
For follow-up questions to me, please use @ToradexAI in your post.
Verdin i.MX8M Plus and TCB 7
I don’t have specific documentation about configuring VS Code IntelliSense for kernel module development with TorizonCore Builder (TCB) in the provided sources.
The kernel headers like linux/regmap.h and linux/of_device.h that you’re trying to include are part of the kernel development environment that would be available within the TCB container, but configuring IntelliSense to recognize these paths requires specific setup steps that aren’t covered in the available documentation.
For kernel module development with TCB and proper IntelliSense support, you would typically need to:
However, the specific steps for this configuration aren’t detailed in the current documentation I have access to.
I’d recommend checking the Toradex Developer Portal for more detailed kernel development guides, or you may find relevant discussions on the Toradex Community by searching for “kernel module development” or “IntelliSense TCB”.
Best regards, Toradex AI Assistant.
If I answered your question, please tick the “Solution” checkbox.
For follow-up questions to me, please use @ToradexAI in your post.
How can I configure VS Code to use the kernel headers from within the TCB container? How can I access the container from my dev machine?
How can I configure VS Code to use the kernel headers from within the TCB container? How can I access the container from my dev machine?
I don’t have specific documentation about configuring VS Code IntelliSense for kernel module development with TorizonCore Builder containers in the provided sources.
The available documentation covers general container development setup (1) and application development workflows (2), but doesn’t include specific guidance for:
For kernel module development with TCB, you would typically need to configure your development environment to access the kernel headers and source tree that are available within the container, but the specific steps for this configuration aren’t detailed in the current documentation I have access to.
The general container development setup documentation (1) covers Docker environment configuration and Arm emulation setup, but doesn’t address the specific IntelliSense configuration you’re asking about.
I’d recommend checking the Toradex Developer Portal for more detailed kernel development guides, or you may find relevant discussions on the Toradex Community by searching for “kernel module development” or “TCB kernel headers”.
Best regards, Toradex AI Assistant.
If I answered your question, please tick the “Solution” checkbox.
For follow-up questions to me, please use @ToradexAI in your post.
Greetings @kdubious,
I’m not sure if there’s an “easy” way to have Intellisense access the TCB container in such a way.
What you can do I suppose is give Intellisense/VSCode access to the same files as TCB would have. For starters, you can see the toolchain for compiling that TCB downloads here: torizoncore-builder/tcbuilder/backend/kernel.py at trixie · torizon/torizoncore-builder · GitHub
As for the Linux source/headers that can be found on any device running Torizon OS. It should be in the device filesystem at /usr/src/linux.tar.bz2. This is how TCB gets the correct Linux headers no matter what version of Linux is on the device.
Making these files available to VSCode for Intellisense, is probably easier than trying to figure out how to get Intellisense to “access” TCB. At least that’s my initial impression.
Best Regards,
Jeremias
OK, that makes sense, and I’ll try it out.
I was able to edit tcb-env-setup.sh to use a Bind Mount rather than a Storage Volume.
alias torizoncore-builder='docker run --rm '"$interactive_flags"' '"$volumes"'-v "$(pwd)":/workdir -v /home/kdub/storage:/storage -v /var/run/docker.sock:/var/run/docker.sock'"$network"'$(tcb_dynamic_params) '"$*"' torizon/torizoncore-builder:'"$chosen_tag"
But… that directory still seems to lack all the headers I need?
I’ll see about grabbing the headers from the device.
Close, but not quite:
I brought that content to my dev environment:
scp ``torizon@10.0.10.100``:/usr/src/linux.tar.bz2 ./
tar -xjf linux.tar.bz2 -C ./linux-torizon
My kernel module builds, so I can’t really complain. But, I do love functional intellisense.
In my code, this gets the red squiggle:
#include <linux/regmap.h>
If I F12 my way through the references, I end up with this one missing:
#include <asm/cpucaps.h>
I’ll leave this out here in case anyone has a solution.
@jeremias.tx I’m glad to mark this solved if you prefer.
Yeah this is definitely one downside to having the actual development sources/headers in a containerized environment. It really confuses IDE Intellisense and similar tools.
There is possibly some way around this. But, it probably requires quite a bit of work to get VSCode to acknowledge the containerized sources, if possible at all.
Best Regards,
Jeremias
Ok, closing this out.