This commit is contained in:
r.koeppe 2024-06-18 09:25:09 +00:00
parent 307fc7f909
commit 97bae60da3
11 changed files with 339 additions and 0 deletions

View File

@ -0,0 +1,26 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "stm32_devcontainer",
"dockerComposeFile": "../docker/docker-compose.yaml",
"service": "stm32_devcontainer",
"workspaceFolder": "/home/stm32_devcontainer",
"shutdownAction": "stopCompose",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"waderyan.gitblame",
"ms-vscode.cpptools-themes",
"twxs.cmake",
"donjayamanne.python-extension-pack",
"ms-iot.vscode-ros",
"mhutchie.git-graph",
"arturock.gitstash",
"bierner.markdown-mermaid",
"marus25.cortex-debug",
"tomoki1207.pdf"
]
}
}
}

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build
example
*.zip

26
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/${PROJECT_NAME_VN200}/Converter/Inc/**",
"${workspaceFolder}/${PROJECT_NAME_VN200}/Core/Inc/**",
"${workspaceFolder}/${PROJECT_NAME_VN200}/Drivers/STM32F3xx_HAL_Driver/Inc/**",
"${workspaceFolder}/${PROJECT_NAME_VN200}/Drivers/CMSIS/Device/ST/STM32F3xx/Include",
"${workspaceFolder}/${PROJECT_NAME_VN200}/Drivers/CMSIS/Include",
"/usr/local/include/**"
],
"defines": [
"__cplusplus",
"USE_HAL_DRIVER",
"STM32F302xC", // Change this to your MCU for correct linting
"DEBUG"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4,
}

19
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "F3 - VN200",
"type": "cortex-debug",
"request": "launch",
"servertype": "openocd",
"cwd": "${workspaceRoot}/${env:PROJECT_NAME_VN200}",
"executable": "${workspaceRoot}/${env:PROJECT_NAME_VN200}/build/${env:PROJECT_NAME_VN200}.elf",
"configFiles": [
"/usr/share/openocd/scripts/interface/stlink.cfg",
"/home/stm32_devcontainer/.vscode/stm32f3x_custom.cfg"
],
//"svdFile": "${workspaceRoot}/path/to/your.svd",
"preLaunchTask": "build_vn200"
}
]
}

13
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,13 @@
{
"files.associations": {
"main.h": "cpp",
"main.c": "cpp",
"test.h": "cpp",
"test.cpp": "cpp",
"array": "cpp",
"string": "cpp",
"string_view": "cpp",
"ranges": "cpp"
},
"C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 150}"
}

109
.vscode/stm32f3x_custom.cfg vendored Normal file
View File

@ -0,0 +1,109 @@
# script for stm32f3x family
#
# stm32 devices support both JTAG and SWD transports.
#
source [find target/swj-dp.tcl]
source [find mem_helper.tcl]
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME stm32f3x
}
set _ENDIAN little
# Work-area is a space in RAM used for flash programming
# By default use 16kB
if { [info exists WORKAREASIZE] } {
set _WORKAREASIZE $WORKAREASIZE
} else {
set _WORKAREASIZE 0x4000
}
# JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
#
# Since we may be running of an RC oscilator, we crank down the speed a
# bit more to be on the safe side. Perhaps superstition, but if are
# running off a crystal, we can run closer to the limit. Note
# that there can be a pretty wide band where things are more or less stable.
adapter speed 140
adapter srst delay 100
if {[using_jtag]} {
jtag_ntrst_delay 100
}
#jtag scan chain
if { [info exists CPUTAPID] } {
set _CPUTAPID $CPUTAPID
} else {
if { [using_jtag] } {
# See STM Document RM0316
# Section 29.6.3 - corresponds to Cortex-M4 r0p1
set _CPUTAPID 0x4ba00477
} {
set _CPUTAPID 0x2ba01477
}
}
swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
if {[using_jtag]} {
jtag newtap $_CHIPNAME bs -irlen 5
}
set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME stm32f1x 0 0 0 0 $_TARGETNAME
reset_config srst_nogate
if {![using_hla]} {
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
cortex_m reset_config sysresetreq
}
proc stm32f3x_default_reset_start {} {
# Reset clock is HSI (8 MHz)
adapter speed 1000
}
proc stm32f3x_default_examine_end {} {
# Enable debug during low power modes (uses more power)
mmw 0xe0042004 0x00000007 0 ;# DBGMCU_CR |= DBG_STANDBY | DBG_STOP | DBG_SLEEP
# Stop watchdog counters during halt
mmw 0xe0042008 0x00001800 0 ;# DBGMCU_APB1_FZ |= DBG_IWDG_STOP | DBG_WWDG_STOP
}
proc stm32f3x_default_reset_init {} {
# Configure PLL to boost clock to HSI x 8 (64 MHz)
mww 0x40021004 0x00380400 ;# RCC_CFGR = PLLMUL[3:1] | PPRE1[2]
mmw 0x40021000 0x01000000 0 ;# RCC_CR |= PLLON
mww 0x40022000 0x00000012 ;# FLASH_ACR = PRFTBE | LATENCY[1]
sleep 10 ;# Wait for PLL to lock
mmw 0x40021004 0x00000002 0 ;# RCC_CFGR |= SW[1]
# Boost JTAG frequency
adapter speed 140
}
# Default hooks
$_TARGETNAME configure -event examine-end { stm32f3x_default_examine_end }
$_TARGETNAME configure -event reset-start { stm32f3x_default_reset_start }
$_TARGETNAME configure -event reset-init { stm32f3x_default_reset_init }
$_TARGETNAME configure -event trace-config {
# Set TRACE_IOEN; TRACE_MODE is set to async; when using sync
# change this value accordingly to configure trace pins
# assignment
mmw 0xe0042004 0x00000020 0
}

19
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build_vn200",
"type": "shell",
"command": "make -C /home/stm32_devcontainer/${env:PROJECT_NAME_VN200}/build", // or any other build command
"args": [],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
],
"detail": "Generated task by Debugger."
}
]
}

79
docker/Dockerfile Normal file
View File

@ -0,0 +1,79 @@
FROM public.ecr.aws/lts/ubuntu:jammy as prerequisites
ENV STM32CUBEIDE_VERSION=1.15.1
ENV STM32CUBEMX_VERSION=1.15.1
ENV STLINK_GDB_SERVER_VERSION=2.1.1
ENV TZ=Etc/UTC
ENV LICENSE_ALREADY_ACCEPTED=1
RUN apt-get update && \
apt-get -y install \
zip \
libgtk-3-0 \
cmake \
net-tools \
gdb-arm-none-eabi \
gcc-arm-none-eabi \
build-essential \
git \
libxtst6 \
wget \
ca-certificates \
libncurses5 \
openocd \
pip && \
pip install --upgrade pip && \
rm -rf /var/lib/apt/lists/*
# Install Chrome to be able to login to MyST
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/google-chrome-stable_current_amd64.deb && \
apt update && apt install -y /tmp/google-chrome-stable_current_amd64.deb
#FROM prerequisites AS stm32_cubeide
#COPY docker/en.st-stm32cubeide_1.15.1_21094_20240412_1041_amd64.sh.zip /tmp/stm32cubeide-installer.sh.zip
# Install STM32 Cube IDE and delete installer
# RUN unzip -p /tmp/stm32cubeide-installer.sh.zip > /tmp/stm32cubeide-installer.sh && \
# rm -rf /tmp/stm32cubeide-installer.sh.zip && \
# chmod +x /tmp/stm32cubeide-installer.sh && \
# echo "/opt/st/stm32cubeide_1.15.1\nqy\ny" | /tmp/stm32cubeide-installer.sh
#ENV PATH="${PATH}:/opt/st/stm32cubeide_${STM32CUBEIDE_VERSION}"
FROM prerequisites AS stm32_cubemx
# Install STM32 Cube MX
COPY docker/en.stm32cubemx-lin-v6-11-1.zip /tmp/stm32cubemx-installer.zip
COPY docker/auto-install.xml /tmp/auto-install.xml
RUN unzip /tmp/stm32cubemx-installer.zip -d /tmp/stm32cubemx-installer && \
rm -rf /tmp/stm32cubemx-installer.zip && \
chmod +x /tmp/stm32cubemx-installer/SetupSTM32CubeMX-6.11.1 && \
/tmp/stm32cubemx-installer/SetupSTM32CubeMX-6.11.1 /tmp/auto-install.xml && \
echo "alias stm32cubemx=/opt/st/stm32cubemx_6.11.1/STM32CubeMX" > ~/.bashrc
FROM stm32_cubemx AS stlink_gdb_server
# Install ST-Link GDB Server
COPY docker/en.st-link-server-v2-1-1.zip /tmp/st-link-server-installer.zip
RUN unzip /tmp/st-link-server-installer.zip -d /tmp/st-link-server-installer && \
rm -rf /tmp/st-link-server-installer.zip && \
apt install -y /tmp/st-link-server-installer/en.st-link-server_v2.1.1-2/st-stlink-server-2.1.1-1-linux-amd64.deb
# Link the debugger correctly
RUN ln -s /usr/bin/gdb-multiarch /usr/bin/arm-none-eabi-gdb
# Install firmware
RUN mkdir /root/STM32Cube && mkdir /root/STM32Cube/Repository
COPY docker/stm32cube_fw_f4_1280.zip /tmp/stm32cube_fw_f4_1280.zip
RUN unzip /tmp/stm32cube_fw_f4_1280.zip -d /root/STM32Cube/Repository && \
rm -rf /tmp/stm32cube_fw_f4_1280.zip
COPY docker/STM32Cube_FW_F3_V1.11.4.zip /tmp/STM32Cube_FW_F3_V1.11.4.zip
RUN unzip /tmp/STM32Cube_FW_F3_V1.11.4.zip -d /root/STM32Cube/Repository && \
rm -rf /tmp/STM32Cube_FW_F3_V1.11.4.zip
RUN git config --global --add safe.directory /home/stm32_devcontainer
ENTRYPOINT ["bash"]

12
docker/auto-install.xml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<AutomatedInstallation langpack="eng">
<com.st.microxplorer.install.MXHTMLHelloPanel id="readme"/>
<com.st.microxplorer.install.MXLicensePanel id="licence.panel"/>
<com.st.microxplorer.install.MXAnalyticsPanel id="analytics.panel"/>
<com.st.microxplorer.install.MXTargetPanel id="target.panel">
<installpath>/opt/st/stm32cubemx_6.11.1</installpath>
</com.st.microxplorer.install.MXTargetPanel>
<com.st.microxplorer.install.MXShortcutPanel id="shortcut.panel"/>
<com.st.microxplorer.install.MXInstallPanel id="install.panel"/>
<com.st.microxplorer.install.MXFinishPanel id="finish.panel"/>
</AutomatedInstallation>

View File

@ -0,0 +1,30 @@
services:
stm32_devcontainer:
image: git.fasttube.de/fasttube/stm32_devcontainer:latest
pull_policy: never
container_name: stm32_devcontainer
stdin_open: true
tty: true
privileged: true
build:
context: ../
dockerfile: docker/Dockerfile
volumes:
- type: bind
source: ../
target: /home/stm32_devcontainer
- type: bind
source: /tmp/.X11-unix
target: /tmp/.X11-unix
- type: bind
source: /dev
target: /dev
network_mode: host
pid: "host"
ipc: "host"
environment:
DISPLAY: $DISPLAY
ROS_AUTOMATIC_DISCOVERY_RANGE: "LOCALHOST"
ROS_DOMAIN_ID: "0"
PROJECT_NAME_VN200: vn200

3
docker/download.bash Executable file
View File

@ -0,0 +1,3 @@
wget https://cloud.fasttube.de/f/3245593
wget https://cloud.fasttube.de/f/3245659
wget https://cloud.fasttube.de/f/3245586