diff --git a/.claude/commands/add-packet.md b/.claude/commands/add-packet.md deleted file mode 100644 index 2c41fbcf..00000000 --- a/.claude/commands/add-packet.md +++ /dev/null @@ -1,44 +0,0 @@ -Add a new packet to the board JSON configuration. Arguments: $ARGUMENTS -Expected format: `[board_key] [packet_name] [data|order]` - -Steps: - -1. Read `Core/Inc/Code_generation/JSON_ADE/boards.json` — confirm the board key exists and find its config path -2. Read `[board_path]/[BOARD].json` — find which measurement files and packet files it references -3. Read the board's `[BOARD]_measurements.json` — check if all variables for the new packet already exist - - If not, add the missing variables with correct types: `bool`, `uint8`, `uint16`, `uint32`, `uint64`, `int8`, `int16`, `int32`, `int64`, `float`, `double` - - Each measurement entry: `{"id": "snake_case_name", "name": "Human Name", "type": "..."}` -4. Add the new packet to `packets.json` (data) or `orders.json` (order): - - Data packet format: - ```json - { - "type": "data", - "name": "packet_name", - "variables": ["var1", "var2"], - "id": 20XXX, - "socket": "socket_name", - "period": 50, - "period_type": "ms" - } - ``` - - Order packet format: - ```json - { - "type": "order", - "name": "packet_name", - "variables": ["var1", "var2"], - "id": 20XXX - } - ``` - - - `id` must be unique across all packets and orders — check existing IDs to avoid collision - - `socket` must match a name defined in `sockets.json` (only for data packets with telemetry) - -5. Regenerate headers: - ```bash - python3 Core/Inc/Code_generation/Generator.py [BOARD] - ``` - -6. Show the relevant generated section from `Core/Inc/Communications/Packets/DataPackets.hpp` or `OrderPackets.hpp` so the developer knows the exact C++ names to use in firmware code diff --git a/.claude/commands/analyze-hardfault.md b/.claude/commands/analyze-hardfault.md deleted file mode 100644 index aa2f4d4e..00000000 --- a/.claude/commands/analyze-hardfault.md +++ /dev/null @@ -1,34 +0,0 @@ -Run the hard fault analysis tool and interpret the output in plain language. - -1. Run the tool: - ```bash - ./hyper hardfault-analysis - ``` - Common failures: - - `"Stop debugging"` → you must disconnect the active debug session in your IDE first - - `STM32_Programmer_CLI not found` → install STM32CubeCLT and ensure it's in PATH - - ELF not found → the board must be built first; `out/build/latest.elf` is copied automatically on each board build - -2. Parse and explain the output: - - **Fault type** (from CFSR register): - - MMFSR bits → Memory Management Fault (MPU violation, invalid memory access) - - BFSR bits → Bus Fault (invalid bus transaction, imprecise/precise) - - UFSR bits → Usage Fault (undefined instruction, unaligned access, divide-by-zero) - - HFSR → Hard Fault escalation (forced from lower priority fault) - - **Fault address**: - - If MMARVALID=1 → MMFAR is valid, shows exact faulting address - - If BFARVALID=1 → BFAR is valid, shows exact bus fault address - - If IMPRECISERR=1 → address is unreliable (out-of-order execution); to narrow down: rebuild with `-fno-inline` or add `__DSB()` barriers around suspect code - - **PC at fault**: the instruction address that triggered the fault — cross-reference with source using `addr2line -e out/build/latest.elf -f [PC_VALUE]` - - **Call stack**: the sequence of functions leading to the crash — look up each address with addr2line - -3. Suggest the most likely root cause based on the fault type and addresses. Common causes in embedded firmware: - - NULL pointer dereference → MMFSR DACCVIOL - - Stack overflow → MMFSR MSTKERR or DACCVIOL near stack bottom - - Unaligned access of packed struct → UFSR UNALIGNED - - Return to corrupted LR → BFSR INVSTATE or INVPC - - DMA writing to wrong memory region → MMFSR DACCVIOL diff --git a/.claude/commands/new-example.md b/.claude/commands/new-example.md deleted file mode 100644 index 8b312af5..00000000 --- a/.claude/commands/new-example.md +++ /dev/null @@ -1,25 +0,0 @@ -Generate a new ST-LIB example for: $ARGUMENTS - -Read `Core/Src/Examples/ExampleADC.cpp` first to understand the exact pattern, then create `Core/Src/Examples/Example$ARGUMENTS.cpp`. - -Follow these rules precisely: - -1. Wrap the entire file in `#ifdef EXAMPLE_[NAME]` / `#endif // EXAMPLE_[NAME]` -2. Includes: `main.h`, `ST-LIB.hpp`. Use `using namespace ST_LIB`. -3. Use an anonymous `namespace { }` for all constants, configs, and helper functions -4. Declare hardware configs as `constexpr` at namespace scope — never inside `main()` -5. Output variables (ADC values, sensor readings) must be `constinit float` (or matching type), also at namespace scope -6. Create at least two test variants: - - `#ifdef TEST_0` — minimal/single-input variant - - `#ifdef TEST_1` — extended/multi-input variant - - Each variant has its own `int main(void)` -7. Board type defined inside each variant: `using Example[Name]Board = ST_LIB::Board` -8. Init sequence: `Example[Name]Board::init()` → `Example[Name]Board::instance_of()` to get runtime instance -9. Add a `start_terminal()` helper if UART output is needed (UART3, 115200 8N1 via ST-LINK VCP) -10. Add a `print_banner()` helper that prints the test name, wiring hints, and column headers - -After creating the file, verify it compiles: -``` -./hyper build [name_lowercase] --test 0 --preset simulator -./hyper build [name_lowercase] --test 1 --preset simulator -``` diff --git a/.claude/commands/validate-board.md b/.claude/commands/validate-board.md deleted file mode 100644 index 3c8739e0..00000000 --- a/.claude/commands/validate-board.md +++ /dev/null @@ -1,36 +0,0 @@ -Validate all JSON configuration files for board: $ARGUMENTS - -1. Read `Core/Inc/Code_generation/JSON_ADE/boards.json` — confirm the board key exists - -2. Read the board's main JSON file (`boards/[BOARD]/[BOARD].json`) and identify all referenced files - -3. Read all referenced files: measurements, packets, orders, sockets - -4. Run these checks and report each issue clearly (file + field): - - **Measurements** - - No duplicate `id` values - - Each entry has `id`, `name`, `type` - - `type` is one of: `bool`, `uint8`, `uint16`, `uint32`, `uint64`, `int8`, `int16`, `int32`, `int64`, `float`, `double` - - **Packets / Orders** - - No duplicate `id` values across all packets AND orders combined - - Each entry has `type`, `name`, `id` - - All `variables` entries exist as `id` in a measurements file - - `socket` references (if present) exist in `sockets.json` - - `period_type` (if present) is `"ms"` or `"us"` - - **Sockets** - - Each entry has `type` and `name` - - `type` is one of: `ServerSocket`, `Socket`, `DatagramSocket` - - Required fields by type: - - `ServerSocket`: `port` - - `Socket`: `local_port`, `remote_ip`, `remote_port` - - `DatagramSocket`: `port`, `remote_ip` - -5. Attempt actual generation to catch Python-level errors: - ```bash - python3 Core/Inc/Code_generation/Generator.py [BOARD] - ``` - -6. Report: PASS (with a summary) or FAIL (with each error listed) diff --git a/.claude/commands/which-preset.md b/.claude/commands/which-preset.md deleted file mode 100644 index a507eb66..00000000 --- a/.claude/commands/which-preset.md +++ /dev/null @@ -1,33 +0,0 @@ -Recommend the correct CMake preset for: $ARGUMENTS - -Read `CMakePresets.json` to confirm available presets, then recommend based on this decision logic: - -**No hardware / testing / CI:** -- Default → `simulator` -- With memory safety checks → `simulator-asan` (AddressSanitizer + UBSan) - -**STM32H7 Nucleo development board** (not a custom HyperloopUPV PCB): -- No Ethernet, debugging → `nucleo-debug` -- No Ethernet, production deploy → `nucleo-release` -- No Ethernet, profiling (optimized + debug symbols) → `nucleo-relwithdebinfo` -- With Ethernet, debugging → `nucleo-debug-eth` -- With Ethernet, production → `nucleo-release-eth` - -**Custom HyperloopUPV PCB:** -- No Ethernet, debugging → `board-debug` -- No Ethernet, production → `board-release` -- Ethernet + KSZ8041 PHY chip, debugging → `board-debug-eth-ksz8041` -- Ethernet + KSZ8041 PHY chip, production → `board-release-eth-ksz8041` -- Ethernet + LAN8700 PHY chip, debugging → `board-debug-eth-lan8700` -- Ethernet + LAN8700 PHY chip, production → `board-release-eth-lan8700` - -**Key differences between nucleo and board:** -- `nucleo` presets set `TARGET_NUCLEO=ON` — adjusts LED pin (PB0 on Nucleo vs PF13 on custom board) and some other pin remappings -- `board` presets target the custom HyperloopUPV PCB pinout exactly - -**PHY chip identification:** -- KSZ8041 → Microchip/Micrel, used in older HyperloopUPV boards -- LAN8700 → Microchip, used in newer HyperloopUPV boards -- Check the board schematic or ask a hardware engineer if unsure - -Provide the exact preset name and the full `./hyper build` command to use it. diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml deleted file mode 100644 index 18b65263..00000000 --- a/.github/workflows/claude-code-review.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Claude Code Review - -on: - pull_request: - types: [opened, synchronize, ready_for_review, reopened] - -jobs: - claude-review: - if: github.event.pull_request.user.login == 'jsaegar' - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: read - issues: read - id-token: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Run Claude Code Review - id: claude-review - uses: anthropics/claude-code-action@v1 - with: - claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' - plugins: 'code-review@claude-code-plugins' - prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}' diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml deleted file mode 100644 index ec6e1e25..00000000 --- a/.github/workflows/claude.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Claude Code - -on: - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - issues: - types: [opened, assigned] - pull_request_review: - types: [submitted] - -jobs: - claude: - if: | - github.actor == 'jsaegar' && ( - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || - (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || - (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) - ) - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: read - issues: read - id-token: write - actions: read # Required for Claude to read CI results on PRs - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Run Claude Code - id: claude - uses: anthropics/claude-code-action@v1 - with: - claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - - # This is an optional setting that allows Claude to read CI results on PRs - additional_permissions: | - actions: read