Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgesg82 authored Jan 26, 2025
0 parents commit 00a8282
Show file tree
Hide file tree
Showing 48 changed files with 106,151 additions and 0 deletions.
406 changes: 406 additions & 0 deletions .cproject

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ubuntu:24.04

ENV PATH="$PATH:/opt/st/stm32cubeclt_1.16.0/GNU-tools-for-STM32/bin:/opt/st/stm32cubeclt_1.16.0/CMake/bin:/opt/st/stm32cubeclt_1.16.0/Ninja/bin"

# Install git, git-lfs, colorama and build tools
RUN echo "deb http://security.ubuntu.com/ubuntu focal-security main universe" > /etc/apt/sources.list.d/ubuntu-focal-sources.list && \
apt-get update && apt-get -y install git git-lfs python3-colorama cmake g++ build-essential libncurses5 libusb-1.0-0 gdb && \
git lfs install

# Install cubeclt
RUN mkdir /temp && cd /temp && git clone https://github.com/HyperloopUPV-H8/cubeclt.git && \
cd cubeclt && git lfs pull && chmod +x cubeclt_1.16.0_installer.sh && \
echo | LICENSE_ALREADY_ACCEPTED=1 ./cubeclt_1.16.0_installer.sh
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "Dev Container for Template Project",
"build": {
"dockerfile": "Dockerfile",
"options": [
"--platform=linux/amd64"
]
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt=seccomp=unconfined"
],
"remoteUser": "root",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack",
"ms-python.python",
"mcu-debug.debug-tracker-vscode",
"marus25.cortex-debug"
]
}
}
}
51 changes: 51 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build Project

on:
workflow_call:
inputs:
preset:
description: |
'CMake preset to build the project, run `cmake --build --list-presets' to see a complete list of options'
required: true
type: string
default: 'nucleo-debug'
outputs:
build-artifact:
description: 'Build result artifact id for later use'
value: ${{ jobs.build.outputs.build-artifact }}
workflow_dispatch:
inputs:
preset:
description: |
'CMake preset to build the project, run `cmake --build --list-presets' to see a complete list of options'
required: true
type: string
default: 'nucleo-debug'

jobs:
build:
name: Build Project
runs-on: ubuntu-24.04
outputs:
build-artifact: ${{ steps.upload-build-artifact.outputs.artifact-id }}
container:
image: jmaralo/hyperloop-upv-firmware:0.3.0
steps:
- name: Clone Project
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build
run: |
cmake --preset ${{ inputs.preset }} .
cmake --build --preset ${{ inputs.preset }}
- name: Upload Build
id: upload-build-artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.preset }}
path: out/build/latest.elf
retention-days: 7
compression-level: 0
if-no-files-found: error

34 changes: 34 additions & 0 deletions .github/workflows/compile-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Compile Checks

on:
push:
paths:
- '**.cpp'
- '**.hpp'
- '**.c'
- '**.h'
- '**.py'

jobs:
compile-checks:
name: Check project compiles
strategy:
matrix:
preset:
- nucleo-debug
- nucleo-release
- nucleo-relwithdebinfo
- nucleo-debug-eth
- nucleo-release-eth
- nucleo-relwithdebinfo-eth
- board-debug
- board-release
- board-relwithdebinfo
- board-debug-eth
- board-release-eth
- board-relwithdebinfo-eth
- simulator
fail-fast: false
uses: ./.github/workflows/build.yml
with:
preset: ${{ matrix.preset }}
94 changes: 94 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# *-----------------------*
# | General |
# *-----------------------*

# Python
__pycache__/

# Build
Debug/
Release/
build/
out/

# IDE
*.launch
.metadata
.settings/
compile_commands.json

# *-----------------------*
# | CMake |
# *-----------------------*

CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
CMakeUserPresets.json
.cache

# *-----------------------*
# | C/C++ |
# *-----------------------*

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj
*.ko
*.elf

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll
*.so.*

# Compiled Static libraries
*.lai
*.la
*.a
*.lib
*.lo

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Log files
*.log
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "deps/ST-LIB"]
path = deps/ST-LIB
url = https://github.com/HyperloopUPV-H8/ST-LIB
[submodule "Core/Inc/Communications/JSON_ADE"]
path= Core/Inc/Communications/JSON_ADE
url = https://github.com/HyperloopUPV-H8/JSON_ADE
[submodule "Tests/VirtualMCU"]
path = Tests/VirtualMCU
url = https://github.com/HyperloopUPV-H8/VirtualMCU
34 changes: 34 additions & 0 deletions .mxproject

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>template-project</name>
<comment></comment>
<projects>
<project>ST-LIB</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.st.stm32cube.ide.mcu.MCUProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUCubeProjectNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature</nature>
<nature>com.st.stm32cube.ide.mcu.MCURootProjectNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"configurations": [
{
"name": "CMake",
"cStandard": "c17",
"cppStandard": "c++20",
"configurationProvider": "ms-vscode.cmake-tools",
"compileCommands": "compile_commands.json"
}
],
"version": 4
}
66 changes: 66 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "cortex-debug",
"request": "launch",
"name": "Build and Debug Project",
"servertype": "stlink",
"cwd": "${workspaceRoot}",
"runToEntryPoint": "main",
"showDevDebugOutput": "raw",
"executable": "out/build/latest.elf",
"device": "STM32H723ZG",
"configFiles": [".vscode/stlink.cfg", ".vscode/stm32h7x.cfg"],
"svdFile": ".vscode/STM32H723.svd",
"swoConfig": {
"enabled": true,
"cpuFrequency": 8000000,
"swoFrequency": 2000000,
"source": "probe",
"decoders": [{ "type": "console", "label": "ITM", "port": 0 }]
},
"preLaunchTask": "CMake: build"
},
{
"type": "cortex-debug",
"request": "launch",
"name": "Debug Project",
"servertype": "stlink",
"cwd": "${workspaceRoot}",
"runToEntryPoint": "main",
"showDevDebugOutput": "raw",
"executable": "out/build/latest.elf",
"device": "STM32H723ZG",
"configFiles": [".vscode/stlink.cfg", ".vscode/stm32h7x.cfg"],
"svdFile": "./STM32H723.svd",
"swoConfig": {
"enabled": true,
"cpuFrequency": 8000000,
"swoFrequency": 2000000,
"source": "probe",
"decoders": [{ "type": "console", "label": "ITM", "port": 0 }]
},
"stm32cubeprogrammer": "/opt/st/stm32cubeclt_1.16.0/STM32CubeProgrammer/bin"
},
{
"name": "Debug simulator on Rosetta",
"type": "cppdbg",
"request": "launch",
"program": "out/build/latest.elf",
"miDebuggerServerAddress": "localhost:1234",
"miDebuggerPath": "/usr/bin/gdb",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Set architecture to x86-64",
"text": "set architecture i386:x86-64",
"ignoreFailures": false
}
],
"preLaunchTask": "Start Debug Server for Simulator on emulated arch",
"cwd": "${workspaceFolder}",
"externalConsole": false
}
]
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"C_Cpp.default.cppStandard": "c++20",
"C_Cpp.default.cStandard": "c17",
"C_Cpp.clang_format_fallbackStyle": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 80}",
"C_Cpp.formatting": "clangFormat",
"C_Cpp.clang_format_style": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 80}",
"C_Cpp.clang_format_sortIncludes": true,
"C_Cpp.intelliSenseCacheSize": 0
}
16 changes: 16 additions & 0 deletions .vscode/stlink.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# STMicroelectronics ST-LINK/V1, ST-LINK/V2, ST-LINK/V2-1, STLINK-V3 in-circuit
# debugger/programmer
#

adapter driver hla
hla_layout stlink
hla_device_desc "ST-LINK"
hla_vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753

# Optionally specify the serial number of ST-LINK/V2 usb device. ST-LINK/V2
# devices seem to have serial numbers with unreadable characters. ST-LINK/V2
# firmware version >= V2.J21.S4 recommended to avoid issues with adapter serial
# number reset issues.
# eg.
#hla_serial "\xaa\xbc\x6e\x06\x50\x75\xff\x55\x17\x42\x19\x3f"
Loading

0 comments on commit 00a8282

Please sign in to comment.