How to preprocess a C file in a VS Code project using nRF Connect SDK (3.0.0 or later)?

How do I preprocess a C file (typically done by passing the "-E" option to the compiler) in VS Code with nRF Connect SDK 3.0.0 or later?  I want to see how a complex macro expands.  Unfortunately the build process is so convoluted (west, sysbuild, cmake, kconfig, zephyr, devicetree, etc) that I cannot quickly figure out how to accomplish this.  For example, how would I preprocess the main.c file in the sample project at https://github.com/nrfconnect/sdk-nrf/tree/main/samples/bluetooth/throughput ?

It would be great if there was some way I could just right-click a C file in VS Code and get it to generate the preprocessed file (this feature exists in other IDEs) but at this point I'll take what I can get.

As for why I am using VS Code with nRF Connect SDK instead of some other IDE, that is because VS Code with nRF Connect SDK is the recommended IDE taught by Nordic in their DevAcademy courses.

Related