diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..120b10c --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,25 @@ +FROM mcr.microsoft.com/devcontainers/universal:2 AS build + +SHELL [ "/bin/bash", "-c" ] +WORKDIR /root + +RUN . <(curl -L https://aka.ms/vcpkg-init.sh) + +COPY vcpkg-configuration.json /root +COPY packlist.txt /root + +RUN . ~/.vcpkg/vcpkg-init && \ + vcpkg-shell x-update-registry --all && \ + vcpkg-shell activate && \ + cpackget init https://www.keil.com/pack/index.pidx && \ + cpackget add -a -f packlist.txt + +FROM mcr.microsoft.com/devcontainers/universal:2 + +RUN mkdir -p /codespace/.vcpkg/ && \ + chown -R codespace:codespace /codespace/.vcpkg && \ + mkdir -p /codespace/.cache/arm/packs/ && \ + chown -R codespace:codespace /codespace/.cache + +COPY --from=build --chown=codespace:codespace /root/.vcpkg/downloads /codespace/.vcpkg/ +COPY --from=build --chown=codespace:codespace /root/.cache/arm/packs/.Download /codespace/.cache/arm/packs/ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..3c8ce3b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "image":"ghcr.io/arm-examples/hello_b-u585i-iot02a/devcontainer:pr-9", + "customizations": { + "vscode": { + "extensions": [ + "redhat.vscode-yaml", + "arm.keil-studio-pack", + "arm.cmsis-csolution", + "arm.environment-manager", + "arm.device-manager", + "arm.embedded-debug", + "eclipse-cdt.peripheral-inspector", + "eclipse-cdt.memory-inspector" + ] + } + } +} diff --git a/.devcontainer/packlist.txt b/.devcontainer/packlist.txt new file mode 100644 index 0000000..850f694 --- /dev/null +++ b/.devcontainer/packlist.txt @@ -0,0 +1,6 @@ +Keil::STM32U5xx_DFP +Keil::B-U585I-IOT02A_BSP +ARM::CMSIS-Driver_STM32 +ARM::CMSIS +ARM::CMSIS-Compiler +ARM::CMSIS-RTX diff --git a/.devcontainer/vcpkg-configuration.json b/.devcontainer/vcpkg-configuration.json new file mode 100644 index 0000000..88893ce --- /dev/null +++ b/.devcontainer/vcpkg-configuration.json @@ -0,0 +1,17 @@ +{ + "registries": [ + { + "name": "arm", + "kind": "artifact", + "location": "https://artifacts.tools.arm.com/vcpkg-registry" + } + ], + "requires": { + "arm:tools/open-cmsis-pack/cmsis-toolbox": "^2.6.1", + "arm:tools/kitware/cmake": "^3.28.4", + "arm:tools/ninja-build/ninja": "^1.12.0", + "arm:compilers/arm/armclang": "^6.22.0", + "arm:compilers/arm/arm-none-eabi-gcc": "^13.2.1", + "arm:debuggers/arm/armdbg": "*" + } +} diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml new file mode 100644 index 0000000..5a59047 --- /dev/null +++ b/.github/workflows/devcontainer.yml @@ -0,0 +1,63 @@ +name: Devcontainer +on: + workflow_dispatch: + pull_request: + branches: [main] + paths: + - .github/workflows/devcontainer.yml + - .devcontainer/**/* + push: + branches: [main] + paths: + - .github/workflows/devcontainer.yml + - .devcontainer/**/* + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}/devcontainer + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Login to Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + id: push + uses: docker/build-push-action@v6 + with: + context: .devcontainer + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v2 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index eca134f..d5e9c87 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,6 +13,16 @@ "cmsisPack": "${command:cmsis-csolution.getTargetPack}", "deviceName": "${command:cmsis-csolution.getDeviceName}", "processorName": "${command:cmsis-csolution.getProcessorName}" + }, + { + "name": "Arm Embedded Debugger", + "type": "embedded-debug", + "request": "launch", + "serialNumber": "${command:device-manager.getSerialNumber}", + "program": "${command:embedded-debug.getApplicationFile}", + "cmsisPack": "${command:cmsis-csolution.getTargetPack}", + "deviceName": "${command:cmsis-csolution.getDeviceName}", + "processorName": "${command:cmsis-csolution.getProcessorName}" } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a35e5a3..aa14e4a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -10,6 +10,16 @@ "processorName": "${command:cmsis-csolution.getProcessorName}", "problemMatcher": [], "label": "arm-debugger.flash: Flash Device" + }, + { + "type": "embedded-debug.flash", + "serialNumber": "${command:device-manager.getSerialNumber}", + "program": "${command:embedded-debug.getApplicationFile}", + "cmsisPack": "${command:cmsis-csolution.getTargetPack}", + "deviceName": "${command:cmsis-csolution.getDeviceName}", + "processorName": "${command:cmsis-csolution.getProcessorName}", + "problemMatcher": [], + "label": "embedded-debug.flash: Flash Device" } ] } \ No newline at end of file