Using Visual Studio Code for Embedded Linux Development

Using Visual Studio Code for Embedded Linux Development

Embedded Linux Conference Europe 2020 Using Visual Studio Code for Embedded Linux Development Michael Opdenacker [email protected] © Copyright 2004-2020, Bootlin. embedded Linux and kernel engineering Creative Commons BY-SA 3.0 license. Corrections, suggestions, contributions and translations are welcome! - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 1/24 Michael Opdenacker I Founder and Embedded Linux engineer at Bootlin: I Embedded Linux engineering company I Specialized in low level development: kernel and bootloader, embedded Linux build systems, boot time reduction, secure booting, graphics layers... I Contributing to the community as much as possible (code, experience sharing, free training materials) I Current maintainer of the Elixir Cross Referencer indexing the source code of Linux, U-Boot, BusyBox... (https://elixir.bootlin.com) I Interested in discovering new tools and sharing the experience with the community. I So far, only used Microsoft tools with the purpose of replacing them! - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 2/24 Using Visual Studio Code for Embedded Linux Development In the Stack Overflow 2019 Developer Survey, Visual Studio Code was ranked the most popular developer environment tool, with 50.7% of 87,317 respondents claiming to use it (Wikipedia) - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 3/24 Disclaimer and goals I I’m not a Visual Studio Code guru! I After hearing about VS Code from many Bootlin customers, I wanted to do my own research on it and share it with you. I The main focus of this research is to find out to what extent VS Code can help with embedded Linux development, and how it compares to the Elixir Cross Referencer in terms of code browsing. I Please share your experience while this pre-recorded talk is played, by posting comments and questions. I’ll be available during and after the talk. - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 4/24 Visual Studio Code https://code.visualstudio.com/ I Visual Studio Code is a free source-code editor made by Microsoft for Windows, Linux and macOS. Features include support for debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git. Users can change the theme, keyboard shortcuts, preferences, and install extensions that add additional functionality. (Wikipedia) I First release in 2015 I Over 16,000 extensions developed by the community I Image source (Wikipedia): Not a free software / open-source project, but https://frama.link/GoHrYMy5 based on the vscode open-source project which is MIT licensed: https://github.com/microsoft/vscode - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 5/24 Issues in Visual Studio Code I Telemetry: I Visual Studio Code collects usage data and sends it to Microsoft. The Microsoft Privacy Statement is about all Microsoft products and doesn’t reveal details about such data collection. I But can can be disabled in user settings (look for telemetry), and the source code is available. I Extensions marketplace: I Another issue is that Microsoft prohibits non Visual Studio applications from downloading binaries from their extensions marketplace. I See section 1.b. of their Marketplace terms I This is disappointing as most extensions are open-source and not developed by Microsoft. I As a consequence, extension owners have to push their extensions to other extension registries too. - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 6/24 An alternative: VSCodium https://vscodium.com/ I A 100 % open-source build of Visual Studio Code, with telemetry disabled I Strengths: I Very frequent updates, staying in sync with VS Code releases I Limitations: I Doesn’t have all of VS Code extensions (cannot use the same marketplace). Missing extensions: DeviceTree, kconfig, Embedded Linux Kernel Dev. I In particular, C/C++ support is built-in and doesn’t Image source (VSCodium project): work out of the box. See my bug report. https://frama.link/0onEnRzS I Project definitely worth supporting, but we will stick to VS Code for the moment. - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 7/24 Other related solutions Theia IDE (https://theia-ide.org/) I Directly supports VS Code extensions I But a different project with its own architecture, more modular and allowing for more customizations. Designed Image source (Theia project): from the ground up to run on both cloud and desktop. (https://theia-ide.org/) I Developed and hosted by a vendor-neutral open-source foundation (Eclipse Foundation) I Adopted in many IDEs: new Arduino PRO IDE, ARM mbed, Eclipse Che, SAP’s web IDE... Eclipse OpenVSX (http://open-vsx.org/) I Vendor-neutral open-source alternative to the Visual Studio Marketplace See the very clear article on https://frama.link/MYGsYuXg for Image source: details. https://github.com/open-vsx - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 8/24 Quick Visual Studio Code glossary For words you will see in the interface... I Intellisense : Code Completion Tool built into Microsoft Visual Studio. See https://code. visualstudio.com/docs/editor/intellisense I Emmet: The essential toolkit for web-developers I Language Server Protocol: open protocol for communication between code editors and IDEs. See https://en.wikipedia.org/wiki/Language_ Server_Protocol - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 9/24 Demo: Visual Studio Code setup I Installation on Ubuntu I Quick interface overview I Disable telemetry I Most important shortcuts - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 10/24 Demo: cpptools extension I For C and C++ I License: proprietary, but based on https: //github.com/microsoft/vscode-cpptools/ (MIT) I Open the Linux kernel source directory I Looking up identifiers I Expansion of defines I Typing code and autocompletion - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 11/24 Demo: VIM extension I https://github.com/VSCodeVim/Vim I License: MIT I Easy to enable, all commands seem to work Note: other extensions exist for other editors: Emacs, Atom... - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 12/24 Demo: Checkpatch Lint extension I https://github.com/idanpa/vscode-checkpatch I License: MIT I Need to install checkpatch.pl on your system I Very useful to create code that’s compliant with the Linux kernel coding style and rules right from the start. - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 13/24 Demo: Kconfig syntax highlighting Kconfig syntax highlighting I https://github.com/luveti/kconfig-vscode I License: MIT I Just for syntax highlighting in Linux kernel and Buildroot configuration parameter definitions. No symbol lookup. I Comparing to Elixir capabilities - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 14/24 Demo: Embedded Linux Kernel Dev extension I https://github.com/microhobby/linuxkerneldev I License: MIT I Symbol autocompletion, function and symbol navigation, for C, Kconfig, defconfig, .config and device tree files. I Also adds some automation to match device tree compatibles and open their respective driver or documentation files. I Based on universal-ctags but less advanced than Elixir - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 15/24 Demo: GitLens I https://github.com/eamodio/vscode- gitlens.git I License: MIT I Git blame feature - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 16/24 Demo: Linux kernel cross-compiling I Setting the environment in a terminal I Using the terminal to configure and build the kernel. I Didn’t find much added value here. cpptools could help using cross-toolchains. - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 17/24 Demo: cross-compiling a simple C program I How to specify the use of a cross-compiler I How build tasks are defined - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 18/24 Demo: CMake Tools From Microsoft I https://github.com/microsoft/vscode-cmake- tools I License: MIT I Can generate a template project for you I Nice feature: capability to detect cross-toolchains (Kits), but partially broken. I Support for multiple compiling profiles (production, debug, size or speed optimizations...) I Limitation: example code and CMake files only for C++ (no C, no Rust...) - Kernel, drivers and embedded Linux - Development, consulting, training and support - https://bootlin.com 19/24 Demo: remote debugging with gdbserver I Implementing a script to cross-compile code, deploy the generated executable on the target through SSH, and start it remotely through gdbserver. I Customizing VSCode for the use of a remote debugger. I Using the remote debugger: inserting breakpoints, step

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    24 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us