ARMmbed / connectedhomeip

Project Connected Home over IP is a new Working Group within the Zigbee Alliance. This Working Group plans to develop and promote the adoption of a new connectivity standard to increase compatibility among smart home products, with security as a fundamental design tenet.
https://www.connectedhomeip.com
Apache License 2.0
10 stars 4 forks source link

Add vscode tasks for flashing and debugging Mbed Shell examples #86

Closed lukgni closed 3 years ago

lukgni commented 3 years ago

Problem

Missing capability to flash and debug mbed shell examples in vscode.

As someone may notice, I didn't change profile of build shell application to 'debug' - ConnectivyManagerImpl.h stub causes a problem when we want to build application with debug profile (undefined reference in multiple places). I decided to not fix this issue within this change because problem probably will be solved when we merge wifi or ble work into 'development' branch (as they extend ConnectivityManagerImpl.h)

After switching to Mbed 6.7.0 and mbed-tools 7.1.2 it is possible to have separated build directory depending on mbed application profile. This change includes that 'feature'

I observed that for STLink probe, the gdbserver can't automatically detect debug target if it's run inside container. This is related to limited access to host mounted volumes inside container, which are used by STLink to pass information about connected stm hardware. In result,breakpoints doesn't work properly during debugging. We may workaround this issue by passing directly target name to gdbserver and for that reason I decided to use fixed configuration for debug tasks which are run inside container.

In result we will have below tasks:

[Build]

[Debug]

Summary of Changes

Update .devcontainer.json to pass through usb debug probe from host to vscode container. Add flash tasks to tasks.json, add sepearted tast for building shell example on DISCO board and rename build tasks. Add debug launch configuration for debugging mbed shell example. Add pyocd, pyusb modules to the final vscode container. Add mbed_example_utils.sh helper script for simplify calling pyocd within vscode tasks.

Fixes #74 Fixes #75

This change requires #88.

pan- commented 3 years ago

@fkjagodzinski Can you try this PR on linux ?

pan- commented 3 years ago

There is still some build issues, I supposed it is due to mbed-tools being used which is v7.

lukgni commented 3 years ago

@pan- #88 solves issue with mbed-tools v7. Additionally it improves a little bit creating build output directory structure so we could reuse it as feature for debug/flash tasks (as a possibility to have debug/release/develop builds in separated directory).