Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added development container #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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