VS Code: Data Breakpoints and Watchpoints

There are many cases where setting a breakpoint on a line of code does not help much. Cases like data or variables get modified from somewhere. That can be data in a linked list somewhere, and all what I have found out so far that it gets changed or corrupted. But I do not know what piece of code is responsible for it.

The solution for such problems are ‘data breakpoints’ or ‘watchpoints‘. Still, not many developers seem to be aware of watchpoints? They are incredibly helpful. And VS Code has at least some basic support for it.

Data Breakpoints in VS Code
Continue reading

VS Code: Cure the Extension Creep with Profiles

What makes Microsoft Visual Studio Code really useful is the concept of Extensions: Probably for every problem or use case you might find an extension. There are more than 40K extensions available for VS Code. And VS Code asks to install extensions:

VS Code asking to install an extension

The issue with this is: more and more extensions get added, making VS Code slower and slower, caused by that ‘extension creep’. Even worse: extensions can cause conflicts, and clutter the development flow. Luckily, there is a cure for this in VS Code: Profiles.

Active Profile in VS Code
Continue reading

“No Kit Selected”: Fixing VS Code CMake Kit Assignment

One important thing in using VS Code and CMake projects is that one needs to have a CMake kit assigned to the project. But after a restart of VS Code or if I re-load a project, VS Code has lost the previously assigned CMake kit:

VS Code has forgotten about the previously assigned CMake Kit?

This is very annoying, but luckily I have found a fix for this.

Continue reading

Implementing File I/O Semihosting for the RP2040 and VS Code

I’m working recently on a new lecture module using the Raspberry Pi Pico (RP2040) board, which highlights several aspects of modern software engineering, including DevOps and CI/CD. An important part of any CI/CD pipeline is testing. For a host application, one could pass arguments to the application, e.g. ‘myapp --test=module1‘, or let it read such information from a configuration file which describes the tests. Or write GNU gcov data to a file to collect coverage information.

Unfortunately, a normal embedded application has no argv[], and many system have no file system. A solution to this problem would be using semihosting with file I/O. Unfortunately for the Raspberry Pi Pico SDK 1.5.1 for the RP2040, there is no semihosting file I/O implemented :-(.

I have now implemented and added file I/O to the SDK, making it possible for the RP2040 to access and use files on the host, among other things. This greatly extends the capabilities of the device, and is very useful for testing, including gathering test coverage information.

RP2040 writing files on the host with semihosting
Continue reading

Debug Probes for RP2040 with VS Code

For systematic debugging, an engineer needs a debug probe. For the Raspberry Pi Pico (RP2040) device there are plenty of debug options with VS Code.

In this article I show different options, from professional tools to DIY solutions and the settings in VS Code I’m using.

Continue reading

Semihosting with VS Code on RP2040

With semihosting I can use standard I/O function like printf() and I can read and write data on the host through the debug connection. If used with care, this is a great feature especially for unit testing.

Raspberry Pi Pico-W (RP2040) board
Continue reading

Global Constructors and Destructors with C (not C++)

In the OOP world, global objects get initialized with a constructor and destroyed at the end with a destructor. Interestingly, the GNU gcc has attributes to mark functions as constructor and destructors, which can greatly simply system startup and shutdown, even if not using C++.

C Function marked as Constructor and called before main()

With the GNU gcc compiler, I can mark functions with an attribute, so they get called before entering main() or after exit of main(). The attribute works both in C and C++, but it especially useful in C to initialize modules in an automated way.

Continue reading

CI/CD for Embedded with VS Code, Docker and GitHub Actions

“Our highest priority is to satisfy the customer
through early and continuous delivery
of valuable software.”

Agile Manifesto, https://agilemanifesto.org/principles.html

It is interesting to see that modern tools and agile development workflows are getting more and more into the embedded world. CI/CD is a strategy where code changes to an application get automatically integrated, tested and released automatically into a production environment.

VS Code with CI/CD
Continue reading

Selecting J-Link Debug Probe by Nickname

I have lots of hardware and debug probes on my desk, and I discussed using nicknames for debug probes to better identify them.

‘Green’ and ‘Yellow’ Robots and J-Link Probes

So far so good. At that time of the previous article, it was possible to assign nicknames to J-Link debug probes, but not to use the nickname instead of the USB serial number. Well, SEGGER was fast again, and responded with a new J-Link software pack version 7.92d which implements that features: I can now use the nickname to connect to a debug probe :-).

Continue reading

Electrical Race Car: From 0 to 100 km/h in 0.956 Seconds

Every year, the students of HSLU and ETHZ build an electrical race car and compete in Formula Student, the world’s biggest competition for engineers. A team of students and alumni wanted to break the current acceleration record of an electrical car (1.461 seconds). They achieved an incredible acceleration from 0 to 100 km/h in less than one second!

‘mythen’ in Dübendorf (Source: http://www.srf.ch)
Continue reading