Visual Studio Code Dev environment - clarity request

Hi,

I’m looking at the examples and the projects created by the python tool and trying to understand how the toolchain works. I’m trying to achieve 2 simple things:

  1. Turn off optimisations in DEBUG builds
  2. Enable C++ 17

I see that the VS Code tasks.json diverts all building to a supplied makefile. If I try to add flags in the makefile though (e.g. CXXFLAGS += -std=c++17), they are not picked up.

Where is the compiler actually specified? From the output I can see that arm-none-eabi-gcc is being used, but I can’t see this specified anywhere. Where does this tool path come from? I see in c_cpp_properties.json that arm-none-eabi-g++.exe is specified, and c++17 is already defined but this clearly isn’t being used.

Any clarity on how the VS Code jsons and the makefile work together would be much appreciated!

To answer my own question (not the first time on this forum) :slight_smile: Everything is handled within the makefile, and tasks.json just invokes this. My confusion was where was the compiler was invoked and where the flags come from, but from more digging I can see it’s from here:

include $(SYSTEM_FILES_DIR)/Makefile

So the core of the flags are within the Daisy folder. Makes sense now! And it turns out this make file already disable optimisations in debug builds. To enable c++ 17 I simply needed to add

CPP_STANDARD = -std=gnu++17

after the main makefile is included (previously I was doing it above the include of the main makefile and it was overridden).

Hopefully this is helpful for someone else too :slight_smile:

2 Likes