Build on Debug in VS Code

When I click "Flash" in the nRF Connect extension for VS Code, it will first build the project, then flash the device.

When I click "Debug", it will flash the last built image to the device (but will not build any changes).

Is there a way to include the "Build" step in the "Debug" command, so it functions the same way the "Flash" command does?

  • Hello Jordan,

    You can create a custom launch configuration with the cogwheel icon on the debug button. There's a field in that json object called something like preLaunchTask, which you can add to execute any task from tasks.json before debugging starts. You'll need to make a task binding for the build task to combine the two, but that would be the way to do it

    Regards,

    Elfving

  • Hi Elfving,

    Any chance you could walk us through the steps, as you seem familiar with them?

    It will help us and future ncs users with this problem!

    Thanks Slight smile

  • Hi and sorry about the wait mrd.

    mrd said:

    Any chance you could walk us through the steps, as you seem familiar with them?

    Sure, though have you seen here? I think this page describes everything better than I ever could.

    Regards,

    Elfving

  •  That page seems to explicitly exclude the "Debug" action though, it only lets you modify the ones in bold at the top.

  • Hi Jordan,

    I will continue to help with this ticket.

    Regards,
    Sigurd Hellesvik

Related