Skip to content

Commit

Permalink
Merge pull request #9 from osu-uwrt/dev
Browse files Browse the repository at this point in the history
Make master the new "dev" branch
  • Loading branch information
rjp5th committed Mar 29, 2024
2 parents 3f2c244 + 683a50e commit 3fc19d6
Show file tree
Hide file tree
Showing 410 changed files with 103,460 additions and 16,366 deletions.
87 changes: 87 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
BasedOnStyle: LLVM
Language: Cpp

AccessModifierOffset: -4
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AttributeMacros:
- __capability
- __packed
- __unused
BitFieldColonSpacing: None
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
ColumnLimit: 120
CommentPragmas: '(^ IWYU pragma:)|(^ ?PICO_CONFIG:)'
Cpp11BracedListStyle: false

IncludeBlocks: Regroup
IncludeCategories:
# Sorting from local to global scope, as this is best for catching weird dependency errors in your local libraries
# Separate ros types into their own section
- Regex: '^<[a-z0-9_]*\/(msg|srv|action)\/'
Priority: 3
SortPriority: 4
CaseSensitive: false
# Also put ROS core libraries in that seciton, but sorted above ros types
- Regex: '^<(libyaml_vendor|rcutils|tracetools|ucdr|uxr|rmw[a-z0-9_]*|rcl[a-z0-9_]*|rosidl[a-z0-9_]*)\/'
Priority: 3
SortPriority: 3
CaseSensitive: false
# Put all remaining system libraries (starting with <) at the end
- Regex: '^<'
Priority: 5
SortPriority: 5
CaseSensitive: false
# Next put pico-sdk headers in its own section
- Regex: '^"(pico|hardware)\/'
Priority: 2
SortPriority: 2
CaseSensitive: false
# Put titan firmware library headers in same section as pico-sdk
- Regex: '^"(titan|driver|micro_ros_pico|canmore)\/'
Priority: 2
SortPriority: 2
CaseSensitive: false
# Finally put the remaining headers at the top (this should only be project headers)
- Regex: '.*'
Priority: 1
SortPriority: 1
CaseSensitive: false

IndentCaseLabels: false
IndentExternBlock: NoIndent
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
LineEnding: LF
NamespaceIndentation: Inner
SortIncludes: CaseSensitive
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: false
SpacesBeforeTrailingComments: 2
SpacesInContainerLiterals: false
TabWidth: 4
UseTab: Never
16 changes: 15 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#git ignore attempt

######################
# Vscode Files #
######################
/.vscode/**/*

# Ignore files to configure the workspace
!/.vscode/extensions.json
!/.vscode/launch.json
!/.vscode/settings.json
!/.vscode/tasks.json

######################
# OS generated files #
######################
Expand All @@ -9,7 +20,6 @@
#######################
# Build/Cache Files #
#######################
.vscode/
build/
__pycache__/
*.pyc
Expand All @@ -27,5 +37,9 @@ __pycache__/
#######################
/scratch_projects/

#######################
# Thruster cal data #
#######################

COLCON_IGNORE

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lib/pico-sdk"]
path = lib/pico-sdk
url = https://github.com/raspberrypi/pico-sdk
[submodule "lib/titan_canmore"]
path = lib/titan_canmore
url = https://github.com/osu-uwrt/titan_canmore
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"ms-vscode.cpptools-extension-pack",
"dan-c-underwood.arm",
"chris-hock.pioasm",
"cschlosser.doxdocgen",
"Gruntfuggly.todo-tree",
"marus25.cortex-debug"
]
}
60 changes: 60 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Pico Debug",
"cwd": "${command:cmake.launchTargetDirectory}",
"executable": "${command:cmake.launchTargetPath}",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
// Configure toolchain path
// Note this MUST begin with arm-non-eabi-gdb, but most distros nowadays just have gdb-multiarch
// Run 'sudo ln -s gdb-multiarch /usr/bin/arm-none-eabi-gdb' and it'll make it happy
// This is just since Cortex Debug assumes your toolchain prefix based on your gdb executable
"gdbPath": "arm-none-eabi-gdb",
// Configure OpenOCD
"openOCDLaunchCommands": [
"adapter speed 2000"
],
"configFiles": [
"interface/cmsis-dap.cfg",
"target/rp2040.cfg"
],
// Using our custom upload task (since bootloader gets squirly when you upload the raw elf)
"preLaunchTask": "Upload SWD",
"overrideLaunchCommands": [],
// Configure how we want vscode to interact with things
"device": "RP2040",
"svdFile": "${workspaceRoot}/lib/pico-sdk/src/rp2040/hardware_regs/rp2040.svd",
"postRestartCommands": [
"break main",
"continue"
],
"postStartSessionCommands": [
"monitor reset halt",
"break main",
"continue"
]
},
{
"name": "Canmore Debug",
"cwd": "${command:cmake.getLaunchTargetDirectory}",
"executable": "${command:cmake.getLaunchTargetPath}",
"request": "attach",
"type": "cortex-debug",
"servertype": "external",
// Using localhost:3333 for gdbserver on CanmoreCLI
"gdbTarget": "localhost:3333",
// Configure toolchain path
"gdbPath": "arm-none-eabi-gdb",
// Using our custom upload task (since bootloader gets squirly when you upload the raw elf)
"preLaunchTask": "Verify Remote Version",
"overrideAttachCommands": [],
// Configure how we want vscode to interact with things
"device": "RP2040",
"svdFile": "${workspaceRoot}/lib/pico-sdk/src/rp2040/hardware_regs/rp2040.svd",
"breakAfterReset": false
}
]
}
39 changes: 39 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"cmake.sourceDirectory": [
"${workspaceFolder}/talos/Actuator/",
"${workspaceFolder}/talos/CameraCageBB/",
"${workspaceFolder}/talos/ESCBoard/",
"${workspaceFolder}/talos/PowerBoard/",
"${workspaceFolder}/talos/SmartBattery/",
"${workspaceFolder}/puddles/Backplane/",
"${workspaceFolder}/tools/upload_tool/",
"${workspaceFolder}/tools/canmore_cli/"
],
"cmake.configureOnOpen": true,
"cmake.generator": "Unix Makefiles",
"cmake.options.advanced": {
"build": {
"statusBarVisibility": "visible"
},
"launch": {
"statusBarVisibility": "hidden"
},
"debug": {
"statusBarVisibility": "hidden"
}
},
"debug.onTaskErrors": "abort",
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.rulers": [
120
],
"editor.tabSize": 4,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"git.autofetch": true,
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"C_Cpp.formatting": "clangFormat",
"C_Cpp.autoAddFileAssociations": false
}
43 changes: 43 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Upload SWD",
"detail": "Uploads Active CMake Project over SWD",
"type": "shell",
"isBackground": false,
"command": "make swd_flash",
"options": {
"cwd": "${command:cmake.launchTargetDirectory}"
},
"presentation": {
"reveal": "always",
"panel": "dedicated",
"focus": true,
"clear": true,
"showReuseMessage": true
},
"problemMatcher": []
},
{
"hide": true,
"label": "Verify Remote Version",
"detail": "Verifies that the GDB remote version matches the copiled version",
"type": "shell",
"isBackground": false,
"command": "${workspaceRoot}/.vscode/verify_remote_version.sh",
"args": [
"${command:cmake.getLaunchTargetPath}"
],
"options": {
"cwd": "${command:cmake.getLaunchTargetDirectory}",
},
"presentation": {
"reveal": "silent",
"panel": "dedicated",
"clear": true,
"showReuseMessage": false
}
}
]
}
23 changes: 23 additions & 0 deletions .vscode/verify_remote_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Verifies that the firmware version on the GDB remote target matches the locally compiled version

REMOTE_URL="localhost:3333"
LOCAL_FILE="$1"
TIMEOUT_SEC=5

if [ -z "$1" ]; then
echo "Expected filename!"
echo "Usage: $0 [elf file]"
exit 2
fi

LOCAL_VERSION="$(gdb-multiarch -batch -silent -ex 'printf "%s", FULL_BUILD_TAG' -ex quit "$LOCAL_FILE")"
REMOTE_VERSION="$(gdb-multiarch -batch-silent -ex "set tcp connect-timeout $TIMEOUT_SEC" -ex "target remote $REMOTE_URL" -ex "set logging file /dev/stdout" -ex "set logging enabled on" -ex 'printf "%s", FULL_BUILD_TAG' -ex "set logging enabled off" -ex quit "$LOCAL_FILE")"

if [[ "$LOCAL_VERSION" != "$REMOTE_VERSION" ]]; then
echo -e "\033[91mVersion on remote does not match local version!\033[0m" >&2
echo -e "\033[32mLocal Version:\033[0m $LOCAL_VERSION"
echo -e "\033[32mRemote Version:\033[0m $REMOTE_VERSION"
exit 1
fi
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Titan Firmware
Firmware for OSU UWRT's RP2040 microcontrollers. Written in C using the [Pico SDK](https://github.com/raspberrypi/pico-sdk).

### Read the setup documentation [here](docs/01_Setup.md).

## Features
* **[micro-ROS](https://micro.ros.org/)**: Runs ROS, used by the software stack, directly in firmware to simplify application development. Supports multiple transports:
* CAN Bus: Used on all Talos MCUs
Expand All @@ -19,6 +21,7 @@ Firmware for OSU UWRT's RP2040 microcontrollers. Written in C using the [Pico SD

## Repository Structure

* `docs/`: Documentation for working with Titan Firmware
* `examples/`: Contains example code as a starting point for new projects
* `lib/`: Common code shared across several projects. Libraries are split into driver and titan library types.
* `puddles/`: Code for the puddles vehicle microcontrollers
Expand Down

0 comments on commit 3fc19d6

Please sign in to comment.