Skip to content

Commit

Permalink
Merge pull request #1 from rovo89/devcontainer
Browse files Browse the repository at this point in the history
Added development container
  • Loading branch information
ClemensElflein authored Feb 4, 2025
2 parents 60194ef + 5c31695 commit 6ea90ed
Show file tree
Hide file tree
Showing 5 changed files with 100,128 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:22.04

ARG USERNAME=dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME && \
useradd --uid $USER_UID --gid $USER_GID --groups sudo --password '' -s /bin/bash -m $USERNAME

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
rm -f /etc/apt/apt.conf.d/docker-clean && \
apt-get update && \
apt-get install --no-install-recommends --yes \
sudo git less \
gcc gcc-arm-none-eabi libstdc++-arm-none-eabi-newlib \
libasio-dev iproute2 \
python3 python3-venv python3-pip \
cmake make \
gdb-multiarch && \
ln -s /usr/bin/nm /usr/bin/nm-multiarch && \
ln -s /usr/bin/objdump /usr/bin/objdump-multiarch

USER $USERNAME
13 changes: 13 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack",
"marus25.cortex-debug",
]
}
}
}
57 changes: 57 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// For remote debugging, you need to prepare your CM4 host with a recent OpenOCD version.
// Simply follow steps 1 and 2 of this description:
// https://core.x-tech.online/docs/tutorials/flashing-stm32-from-cm4/
// Once done, start OpenOCD on your CM4 host via:
// openocd -f interface/xcore.cfg -f target/stm32h7x.cfg -c "bindto 0.0.0.0"
// Also make sure you have the Dev Mode enabled in the bootloader.
{
"version": "0.2.0",
"configurations": [
{
"name": "cppdbg (remote)",
"type": "cppdbg",
"request": "launch",
"preLaunchTask": "CMake: build",
"cwd": "${workspaceFolder}",
"program": "${command:cmake.launchTargetPath}",
"postRemoteConnectCommands": [
{
"text": "-target-download",
}
],
"svdPath": "${workspaceFolder}/cfg/STM32H723.svd",
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "gdb-multiarch",
"miDebuggerServerAddress": "${input:target}:3333",
},
},
{
"name": "Cortex-Debug (remote)",
"type": "cortex-debug",
"cwd": "${workspaceFolder}",
"request": "launch",
"servertype": "external",
"gdbPath": "gdb-multiarch",
"gdbTarget": "${input:target}:3333",
"executable": "${command:cmake.launchTargetPath}",
"svdFile": "${workspaceFolder}/cfg/STM32H723.svd",
// Rebuild and flash on "Restart", but not on "Reset device".
"preLaunchTask": "CMake: build",
"preRestartCommands": [
"-target-download",
],
"preResetCommands": [],
"breakAfterReset": false,
// Uncomment to break in main before debugging
// "runToEntryPoint": "main",
},
],
"inputs": [
{
"id": "target",
"description": "Select hostname where OpenOCD is running",
"type": "promptString",
}
],
}
15 changes: 13 additions & 2 deletions build-binary.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
#!/bin/sh
docker build --output=out .
#!/bin/bash
set -euo pipefail

PRESET=${1:-Release}

mkdir -p build out

cd build
cmake .. --preset=$PRESET
cd $PRESET
make -j$(nproc)

cp -v openmower-with-unsafe-bootloader.bin openmower.bin openmower.elf ../../out/
Loading

0 comments on commit 6ea90ed

Please sign in to comment.