If you use a docker image to simplify the setup of the development toolchain there are several issues. There is a suggestion to use a Python venv but this is not fully isolating the toolchain. A docker image is preferred to speedup getting up and running with a working toolchain.
Docker image source: Package mbed-os-env · GitHub
Help page to use docker: https://os.mbed.com/docs/mbed-os/v6.16/build-tools/docker.html
- No support for st-link
A lot of people use ST-Link programmers or clones and/or non mbed enabled devices. The project located at https://github.com/stlink-org/stlink is the Linux answer for STLink programmers that are only supported officially in Windows. The docker container does not contains this driver natively and because the container is non persistent you have to install the tool each time you start the container. The suggestion is to add this driver in the container natively.
- Rights on files and folders:
If you use a command like mbed-tools deploy, the folders and files are checked out with root ownership. If you want to manipulate the project files outside the container you have a lot of right issues and ambigious git ownership. You need ‘sudo chown’ and add trusted git sources to solve it. There is maybe a way to execute the docker with the same rights as the caller.
- mbed-tools detect works with udev
To enable mbed-detect you need to map additional files in the docker session and if you use WSL2 in Windows you need to forward the USB device with a tool like https://github.com/dorssel/usbipd-win. The suggestion is to run docker with the following options:
run -it --privileged --mount=type=bind,source="$(pwd)",destination=/var/mbed -w /var/mbed -v /dev/disk/by-id:/dev/disk/by-id -v /dev/serial/by-id:/dev/serial/by-id -v /run/udev:/run/udev:ro ghcr.io/armmbed/mbed-os-env:master-latest
- Docker deamon in WSL2 not enabled by default
You need to start the deamon in another window first with ‘sudo dockerd’
- Mismatch in pip packages when executing ‘mbed-tools detect’
solve error: cannot import name ‘collections_abc’ from ‘six.moves’ after mbed-tools detect
pip3 install click==7.1
pip3 install --upgrade six>=1.13.0
ImportError: cannot import name ‘soft_unicode’ from ‘markupsafe’
pip install markupsafe==2.0.1