Skip to content
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
20 changes: 10 additions & 10 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 120
AlignConsecutiveMacros: true
IndentPPDirectives: BeforeHash

---
Language: Cpp
# Force pointers to the type for C++.
DerivePointerAlignment: false
BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 120
AlignConsecutiveMacros: true
IndentPPDirectives: BeforeHash
---
Language: Cpp
# Force pointers to the type for C++.
DerivePointerAlignment: false
PointerAlignment: Left
180 changes: 90 additions & 90 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
# syntax=docker/dockerfile:1.3-labs
# ===== ===== ===== ===== ===== =====
# This image is for compiling STM32 HAL Projects
# My reference from: https://www.youtube.com/watch?v=imUiQkO9YHM
# Since this images uses heredocs, you need buildkit
# ===== ===== ===== ===== ===== =====

# ===== ===== Base image ===== =====
FROM ubuntu:22.04

# ===== ===== Arguments ===== =====
# Download GNU ARM
ARG compiler_dwn_link=https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz?rev=e434b9ea4afc4ed7998329566b764309&hash=CA590209F5774EE1C96E6450E14A3E26
# Host project location
#ARG wDirHost
# You actually can't have a variable for the mounting point
# Tag versioning
# See https://docs.docker.com/reference/dockerfile/#arg
ARG FreeRTOS_tag
ARG STM32F1_tag
ARG STM32F3_tag
ARG STM32F4_tag
ARG STM32H7_tag
ARG USB_tag
ARG eigen_ver

ENV FreeRTOS_tag=${FreeRTOS_tag:-v11.1.0}
ENV STM32F1_tag=${STM32F1_tag:-v1.8.5}
ENV STM32F3_tag=${STM32F3_tag:-v1.11.5}
ENV STM32F4_tag=${STM32F4_tag:-v1.28.0}
ENV STM32H7_tag=${STM32H7_tag:-v1.11.0}
ENV USB_tag=${USB_tag:-v2.11.0}
ENV eigen_ver=${eigen_ver:-3.4.0}

# ===== ===== ===== ===== ===== =====
# TODO:
# * Define version for cmake, make, compiler, repos
# * Extract libraries to somewhere
# ===== ===== Actual image ===== =====
# ===== Update repos
# As a multi-line script
RUN apt update && \
apt upgrade -y && \
apt install -y cmake make xz-utils git clang-format && \
mkdir -p /opt/gcc-arm-none-eabi/ /tmp/gcc-arm-none-eabi/


# ===== Install compiler

ADD "$compiler_dwn_link" /tmp/compiler.tar.xz

RUN tar xf /tmp/compiler.tar.xz -C /tmp/gcc-arm-none-eabi/ && \
mv /tmp/gcc-arm-none-eabi/arm-gnu-toolchain-*/* /opt/gcc-arm-none-eabi/ && \
rm -rf /tmp/*

# Symlink to /usr/local/bin
# TODO: Why?
RUN ln -s /opt/gcc-arm-none-eabi/bin/* /usr/local/bin

# Add compiler to the path, note how we don't use export to set it globally
ENV PATH="$PATH:/opt/gcc-arm-none-eabi/bin"

# ===== STM32 dependencies
WORKDIR /opt
# Download CMSIS V2 FreeRTOS
# I think this not entirely necessary
# Currently supported chips:
# Since these are the Firmware package, it includes HAL drivers and CMSIS MCU config
# STM32F4 processor series
# Release notes: https://htmlpreview.github.io/?https://github.com/STMicroelectronics/STM32CubeF4/blob/master/Release_Notes.html
# STM32H7 processor series
# Release notes: https://htmlpreview.github.io/?https://github.com/STMicroelectronics/STM32CubeH7/blob/master/Release_Notes.html
# STM32F1 processor series
# STM32F3 processor series
RUN git clone --depth 1 --branch $FreeRTOS_tag https://github.com/ARM-software/CMSIS-FreeRTOS.git && \
git clone --recursive --depth 1 --branch $STM32F4_tag https://github.com/STMicroelectronics/STM32CubeF4.git && \
git clone --recursive --depth 1 --branch $STM32H7_tag https://github.com/STMicroelectronics/STM32CubeH7.git && \
git clone --recursive --depth 1 --branch $STM32F1_tag https://github.com/STMicroelectronics/STM32CubeF1.git && \
git clone --recursive --depth 1 --branch $STM32F3_tag https://github.com/STMicroelectronics/STM32CubeF3.git && \
git clone --depth 1 --branch $USB_tag https://github.com/STMicroelectronics/stm32_mw_usb_device.git && \
git clone --branch $eigen_ver https://gitlab.com/libeigen/eigen.git


# ===== ===== Build Project ===== =====

# Change working dir to project location in container
WORKDIR /home/myProjects

# Keep the container running
ENTRYPOINT [ "tail", "-f", "/dev/null" ]
# syntax=docker/dockerfile:1.3-labs
# ===== ===== ===== ===== ===== =====
# This image is for compiling STM32 HAL Projects
# My reference from: https://www.youtube.com/watch?v=imUiQkO9YHM
# Since this images uses heredocs, you need buildkit
# ===== ===== ===== ===== ===== =====
# ===== ===== Base image ===== =====
FROM ubuntu:22.04
# ===== ===== Arguments ===== =====
# Download GNU ARM
ARG compiler_dwn_link=https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz?rev=e434b9ea4afc4ed7998329566b764309&hash=CA590209F5774EE1C96E6450E14A3E26
# Host project location
#ARG wDirHost
# You actually can't have a variable for the mounting point
# Tag versioning
# See https://docs.docker.com/reference/dockerfile/#arg
ARG FreeRTOS_tag
ARG STM32F1_tag
ARG STM32F3_tag
ARG STM32F4_tag
ARG STM32H7_tag
ARG USB_tag
ARG eigen_ver
ENV FreeRTOS_tag=${FreeRTOS_tag:-v11.1.0}
ENV STM32F1_tag=${STM32F1_tag:-v1.8.5}
ENV STM32F3_tag=${STM32F3_tag:-v1.11.5}
ENV STM32F4_tag=${STM32F4_tag:-v1.28.0}
ENV STM32H7_tag=${STM32H7_tag:-v1.11.0}
ENV USB_tag=${USB_tag:-v2.11.0}
ENV eigen_ver=${eigen_ver:-3.4.0}
# ===== ===== ===== ===== ===== =====
# TODO:
# * Define version for cmake, make, compiler, repos
# * Extract libraries to somewhere
# ===== ===== Actual image ===== =====
# ===== Update repos
# As a multi-line script
RUN apt update && \
apt upgrade -y && \
apt install -y cmake make xz-utils git clang-format && \
mkdir -p /opt/gcc-arm-none-eabi/ /tmp/gcc-arm-none-eabi/
# ===== Install compiler
ADD "$compiler_dwn_link" /tmp/compiler.tar.xz
RUN tar xf /tmp/compiler.tar.xz -C /tmp/gcc-arm-none-eabi/ && \
mv /tmp/gcc-arm-none-eabi/arm-gnu-toolchain-*/* /opt/gcc-arm-none-eabi/ && \
rm -rf /tmp/*
# Symlink to /usr/local/bin
# TODO: Why?
RUN ln -s /opt/gcc-arm-none-eabi/bin/* /usr/local/bin
# Add compiler to the path, note how we don't use export to set it globally
ENV PATH="$PATH:/opt/gcc-arm-none-eabi/bin"
# ===== STM32 dependencies
WORKDIR /opt
# Download CMSIS V2 FreeRTOS
# I think this not entirely necessary
# Currently supported chips:
# Since these are the Firmware package, it includes HAL drivers and CMSIS MCU config
# STM32F4 processor series
# Release notes: https://htmlpreview.github.io/?https://github.com/STMicroelectronics/STM32CubeF4/blob/master/Release_Notes.html
# STM32H7 processor series
# Release notes: https://htmlpreview.github.io/?https://github.com/STMicroelectronics/STM32CubeH7/blob/master/Release_Notes.html
# STM32F1 processor series
# STM32F3 processor series
RUN git clone --depth 1 --branch $FreeRTOS_tag https://github.com/ARM-software/CMSIS-FreeRTOS.git && \
git clone --recursive --depth 1 --branch $STM32F4_tag https://github.com/STMicroelectronics/STM32CubeF4.git && \
git clone --recursive --depth 1 --branch $STM32H7_tag https://github.com/STMicroelectronics/STM32CubeH7.git && \
git clone --recursive --depth 1 --branch $STM32F1_tag https://github.com/STMicroelectronics/STM32CubeF1.git && \
git clone --recursive --depth 1 --branch $STM32F3_tag https://github.com/STMicroelectronics/STM32CubeF3.git && \
git clone --depth 1 --branch $USB_tag https://github.com/STMicroelectronics/stm32_mw_usb_device.git && \
git clone --branch $eigen_ver https://gitlab.com/libeigen/eigen.git
# ===== ===== Build Project ===== =====
# Change working dir to project location in container
WORKDIR /home/myProjects
# Keep the container running
ENTRYPOINT [ "tail", "-f", "/dev/null" ]
154 changes: 77 additions & 77 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
"dockerfile": "Dockerfile",
"args": {
"-t": "owltech/compiler"
}
},
// Avoid git problems:
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}/robotConfig ${containerWorkspaceFolder}/Middlewares/owlware ${containerWorkspaceFolder}/Middlewares/ST/stm32_mw_usb_device",
//
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"C_Cpp.enhancedColorization": "enabled",
"cSpell.words": [
"automations",
"Robomaster",
"Gobilda",
"Owltech"
],
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-vscode.cpptools",
//"editor.defaultFormatter": "xaver.clang-format",
"clang-format.executable": "${workspaceRoot}/.clang-format",
"clang-format.formatOnSave": true,
"doxdocgen.c.firstLine": "/**",
"doxdocgen.c.commentPrefix": " * ",
"doxdocgen.c.lastLine": " **/",
"doxdocgen.cpp.tparamTemplate": "@tparam {param} ",
"doxdocgen.file.fileOrder": [
"file",
"author",
"brief",
"date"
],
"doxdocgen.generic.dateFormat": "YYYY-MM-DD",
"doxdocgen.generic.useGitUserName": true,
"doxdocgen.generic.useGitUserEmail": true,
"cmake.configureOnOpen": false,
"files.associations": {
"main.C": "cpp",
"cmath": "cpp",
"iostream": "cpp"
}
},
"extensions": [
// ===== C++
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
// ===== Build
"ms-vscode.makefile-tools",
"ms-vscode.cmake-tools",
// ===== Code documentation
"cschlosser.doxdocgen",
// ===== Intelli
"visualstudioexptteam.vscodeintellicode",
"visualstudioexptteam.intellicode-api-usage-examples",
// ===== Other tools
"xaver.clang-format",
"streetsidesoftware.code-spell-checker"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"build": {
"dockerfile": "Dockerfile",
"args": {
"-t": "owltech/compiler"
}
},
// Avoid git problems:
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}/robotConfig ${containerWorkspaceFolder}/Middlewares/owlware ${containerWorkspaceFolder}/Middlewares/ST/stm32_mw_usb_device",
//
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"C_Cpp.enhancedColorization": "enabled",
"cSpell.words": [
"automations",
"Robomaster",
"Gobilda",
"Owltech"
],
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-vscode.cpptools",
//"editor.defaultFormatter": "xaver.clang-format",
"clang-format.executable": "${workspaceRoot}/.clang-format",
"clang-format.formatOnSave": true,
"doxdocgen.c.firstLine": "/**",
"doxdocgen.c.commentPrefix": " * ",
"doxdocgen.c.lastLine": " **/",
"doxdocgen.cpp.tparamTemplate": "@tparam {param} ",
"doxdocgen.file.fileOrder": [
"file",
"author",
"brief",
"date"
],
"doxdocgen.generic.dateFormat": "YYYY-MM-DD",
"doxdocgen.generic.useGitUserName": true,
"doxdocgen.generic.useGitUserEmail": true,
"cmake.configureOnOpen": false,
"files.associations": {
"main.C": "cpp",
"cmath": "cpp",
"iostream": "cpp"
}
},
"extensions": [
// ===== C++
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
// ===== Build
"ms-vscode.makefile-tools",
"ms-vscode.cmake-tools",
// ===== Code documentation
"cschlosser.doxdocgen",
// ===== Intelli
"visualstudioexptteam.vscodeintellicode",
"visualstudioexptteam.intellicode-api-usage-examples",
// ===== Other tools
"xaver.clang-format",
"streetsidesoftware.code-spell-checker"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
24 changes: 12 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot
version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
Loading