From 3223383a348bf2ec2ffa74f533cfe560ce74ca9a Mon Sep 17 00:00:00 2001 From: Obsidian-MBPM4 Date: Tue, 30 Sep 2025 08:27:33 +0200 Subject: [PATCH] vault backup: 2025-09-30 08:27:33 Affected files: .obsidian/workspace.json 3 Knowledge/5 AI/PromptDB/Prompt - Flightcontroller Review.md Temporary/Untitled 1.md Temporary/Untitled 10.md Temporary/Untitled 11.md Temporary/Untitled 12.md Temporary/Untitled 13.md Temporary/Untitled 14.md Temporary/Untitled 15.md Temporary/Untitled 2.md Temporary/Untitled 3.md Temporary/Untitled 4.md Temporary/Untitled 5.md Temporary/Untitled 6.md Temporary/Untitled 7.md Temporary/Untitled 8.md Temporary/Untitled 9.md Temporary/Untitled.md --- .obsidian/workspace.json | 46 +++--- .../Prompt - Flightcontroller Review.md | 132 ++++++++++++++++++ Temporary/Untitled 1.md | 0 Temporary/Untitled 10.md | 0 Temporary/Untitled 11.md | 0 Temporary/Untitled 12.md | 7 - Temporary/Untitled 13.md | 7 - Temporary/Untitled 14.md | 0 Temporary/Untitled 15.md | 0 Temporary/Untitled 2.md | 0 Temporary/Untitled 3.md | 0 Temporary/Untitled 4.md | 0 Temporary/Untitled 5.md | 0 Temporary/Untitled 6.md | 0 Temporary/Untitled 7.md | 45 ------ Temporary/Untitled 8.md | 0 Temporary/Untitled 9.md | 0 Temporary/Untitled.md | 0 18 files changed, 155 insertions(+), 82 deletions(-) create mode 100644 3 Knowledge/5 AI/PromptDB/Prompt - Flightcontroller Review.md delete mode 100644 Temporary/Untitled 1.md delete mode 100644 Temporary/Untitled 10.md delete mode 100644 Temporary/Untitled 11.md delete mode 100644 Temporary/Untitled 12.md delete mode 100644 Temporary/Untitled 13.md delete mode 100644 Temporary/Untitled 14.md delete mode 100644 Temporary/Untitled 15.md delete mode 100644 Temporary/Untitled 2.md delete mode 100644 Temporary/Untitled 3.md delete mode 100644 Temporary/Untitled 4.md delete mode 100644 Temporary/Untitled 5.md delete mode 100644 Temporary/Untitled 6.md delete mode 100644 Temporary/Untitled 7.md delete mode 100644 Temporary/Untitled 8.md delete mode 100644 Temporary/Untitled 9.md delete mode 100644 Temporary/Untitled.md diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 770aff4..b3cb8d8 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -506,36 +506,38 @@ "periodic-notes:Open today": false } }, - "active": "4005286987a3a3ae", + "active": "b2f0aff0beb8228f", "lastOpenFiles": [ - "Temporary/Markov Chains.md", + "Temporary/Untitled 16.md", + "Temporary/Untitled 15.md", + "Temporary/Untitled 14.md", + "Temporary/Untitled 13.md", + "Temporary/Untitled 12.md", + "Temporary/Untitled 11.md", + "Temporary/Untitled 10.md", + "Temporary/Untitled 9.md", + "Temporary/Untitled 8.md", + "Temporary/Untitled 7.md", + "Temporary/Untitled 6.md", + "Temporary/Untitled 1.md", + "Temporary/Untitled 2.md", + "Temporary/Untitled 4.md", + "Temporary/Untitled 5.md", + "Temporary/Untitled 3.md", + "OneNote/NAS/Setup Calibre Server.md", + "3 Knowledge/5 AI/PromptDB/Prompt - Flightcontroller Review.md", + "3 Knowledge/5 AI/PromptDB", + "6 Ablagen/User Manuals and Warranty/Kuhn Rikon Trophy.md", + "3 Knowledge/5 AI", "0 Journal/0 Daily/2025-09-29.md", + "Temporary/Markov Chains.md", "OneNote/NAS/Fotos Strategie.md", "Temporary/Webapp - Chirp Log Review.md", "99 Work/0 OneSec/OneSecNotes/10 Projects/TeensyFlightcontroller/Parameter System Desing Document.md", "99 Work/0 OneSec/OneSecNotes/10 Projects/OneSecServer/OneSec Server.md", "99 Work/0 OneSec/OneSecNotes/10 Projects/TeensyFlightcontroller", "Attachments/Pasted image 20250922115441.png", - "Temporary/Untitled 15.md", "0 Journal/0 Daily/2025-09-19.md", - "0 Journal/1 Weekly/2025-W37.md", - "0 Journal/0 Daily/2025-09-15.md", - "5 Media/0 Books/In Order to Live by Yeonmi Park.md", - "Temporary/Untitled 14.md", - "0 Journal/0 Daily/2025-07-14.md", - "0 Journal/1 Weekly/2025-W36.md", - "0 Journal/0 Daily/2025-08-14.md", - "2 Personal/Home Lab/Homelab.md", - "Temporary/Drone Regulation Overview.md", - "2 Personal/Lists/Business Ideas.md", - "0 Journal/0 Daily/2025-07-22.md", - "2 Personal/Home Lab/Syncthing.md", - "2 Personal/Home Lab/Light Show.md", - "2 Personal/Home Lab/NAS/Zerotier Installation.md", - "2 Personal/Home Lab/NAS/Virtual Machine Hosting.md", - "2 Personal/Home Lab/NAS/SSH.md", - "2 Personal/Home Lab/NAS/Ports Opening.md", - "2 Personal/Home Lab/NAS/Photo Apps.md", "7 People/0_People.base", "Attachments/Belts, Suspenders.mp3", "Attachments/image 21.jpg", @@ -553,8 +555,6 @@ "Attachments/Pasted image 20250627101456.png", "99 Work/0 OneSec/OneSecNotes/40 - User Manuals", "2 Personal/1 Skills/IT", - "Sync", - "Shared_Folder", "99 Work/0 OneSec/OneSecNotes/30 Engineering Skills/Computer Science/Untitled.canvas", "8 Work/OneSecNotes/Temporary/Untitled.canvas" ] diff --git a/3 Knowledge/5 AI/PromptDB/Prompt - Flightcontroller Review.md b/3 Knowledge/5 AI/PromptDB/Prompt - Flightcontroller Review.md new file mode 100644 index 0000000..a5b2ae0 --- /dev/null +++ b/3 Knowledge/5 AI/PromptDB/Prompt - Flightcontroller Review.md @@ -0,0 +1,132 @@ +You are GPT-5 Thinking acting as a brutally honest, senior embedded software/firmware reviewer. Your task is to perform a deep, technical code review of a Teensy 4.0 (NXP i.MX RT1062, Cortex-M7 @ 600 MHz, FPU, caches, DMA) flight-controller codebase. Assume hard real-time constraints (control loop 250–2 kHz), multiple sensors (IMU, baro, GPS), ESC/actuator outputs (PWM/DSHOT), logging (SDIO/SPI), and communications (UART/SPI/I2C/CAN). + +## Review Philosophy (follow strictly) +- **Harsh truth, no fluff.** If something is bad, say it’s bad and why. If it’s good, say why. +- **Evidence-based.** Base every claim on proven embedded principles and concrete code evidence (files, symbols, line ranges). Avoid speculation. +- **Real-time first.** Prioritize determinism, bounded latency, and reliability over elegance. +- **Safety & correctness > cleverness.** Prefer simple, testable designs to fragile optimizations. +- **No invention.** If you don’t know, mark the item as **UNSURE** and provide a suggested Google query as a markdown link like: `[search](https://www.google.com/search?q=)`. + +## Canonical references to ground your critique (cite which principle you’re invoking) +- Barr Group Embedded C/C++ best practices (ISRs, shared data, reentrancy, scheduling, watchdogs) +- MISRA C/C++ & CERT C++ (safety subsets, undefined behavior avoidance) +- ISO-style safety thinking (fault containment, fail-safe defaults), even if not fully certifiable +- ARM Cortex-M7 specifics (caches, TCM vs OCRAM, D-cache maintenance with DMA, FPU context save, ITCM/DTCM usage) +- RT logging & storage patterns (double-buffering, DMA, lock-free queues, priority inversion avoidance) +- Common embedded anti-patterns (dynamic allocation in ISRs, unbounded loops, printf in hot paths, hidden blocking I/O) + +## What to Review (be exhaustive) +1. **Architecture & Scheduling** + - Control-loop ownership, timing sources (PIT/GPT), jitter/overrun handling, priority scheme across tasks/ISRs/threads. + - Separation of concerns: HAL vs business logic vs estimator/controller vs comms/logging. + - Watchdog strategy (independent vs windowed), heartbeat, brown-out handling, safe boot, panic path. + +2. **Concurrency & Timing** + - ISR design, latency, work deferral (defer heavy work to thread via queues), interrupt priorities, preemption chain. + - Shared data access: atomicity, lock strategies, memory barriers, volatile correctness, ring buffers, lock-free patterns. + - Deterministic execution in the main loop (no hidden blocking calls, bounded loops). + +3. **I/O, Buses, and DMA** + - SPI/I2C/UART/CAN configuration, timeouts, bus errors, retry policies. + - DMA usage (cache-coherency on M7, buffer alignment, dcache clean/invalidate), SDIO write path. + - Sensor drivers: rate matching, timestamping, anti-aliasing, calibration persistence. + +4. **Storage & Logging** + - SD logging strategy: buffering, back-pressure, foreground vs background, **never** blocking the control loop. + - File system interactions (FAT FS reentrancy, allocation strategy, pre-allocation). + - Data integrity (CRC/frame checks), log versioning, time sync, loss handling. + +5. **Control & Estimation** + - Numeric stability (units, scaling, saturation), overflow/underflow protections. + - Controller/estimator separation, rate limits, integrator anti-windup, failsafes on NaN/Inf. + - Calibration pipelines and state validity gating. + +6. **C++ on Embedded** + - Allocation policy (no `new`/`delete` in hot paths/ISRs), `std::optional`/`variant`/`array`/`span` usage sanity. + - Exceptions disabled? RTTI? `-fno-exceptions`/`-fno-rtti` consistency. + - `constexpr`/`noexcept`/`[[nodiscard]]`, `enum class`, strong types, avoiding undefined behavior. + - Compile-time vs run-time parameters; configuration management. + +7. **Memory, Caches, and Performance** + - Stack/heap budgeting per task/ISR. Static analysis of worst-case stack. + - ITCM/DTCM placement for hot code/data; OCRAM vs external RAM usage; linker script sanity. + - Cache maintenance for DMA buffers; alignment; MPU configuration if used. + +8. **Error Handling & Failsafe** + - Error taxonomy, propagation, and recovery paths. Safe state transitions (loss of sensors, overrun). + - Arming/disarming logic; preflight checks; interlocks. + +9. **Testing & Tooling** + - Unit tests, HIL/SIL, fault injection, timing tests, regression tests. + - Compile flags (`-O2/-O3`, LTO, `-fno-strict-aliasing`), warnings as errors, static analysis (clang-tidy, cppcheck). + - Logging levels vs build types; asserts vs production guards. + +10. **Security & Robustness** + - Interface hardening, packet/frame validation, bounds checks, watchdog recoveries. + - Persistent config integrity (CRC), versioning, migration. + +## Required Output Format (follow exactly) +Produce the following sections: + +### Summary (1–2 paragraphs) +- Overall assessment of readiness for flight. Be blunt. + +### Critical Risks (ordered by severity) +For each item: +- **Title:** short description +- **Why it matters:** concise, impact on real-time/safety +- **Evidence:** file(s) + function(s) + line ranges (if available), or symbol names +- **Principle:** cite concrete rule/practice (e.g., “DMA + D-cache requires clean/invalidate”) +- **Fix (concrete):** specific refactor/config/patch steps +- **Test to prove it:** exact measurement or experiment (e.g., toggle GPIO around write() and measure on logic analyzer; add scope markers) + +### Major Findings (ordered by severity) +Same fields as above, but for non-immediate show-stoppers. + +### Minor Findings / Style +Bullet list; still actionable. + +### Performance & Timing Budget +- Current suspected worst-case paths and their cost; identify any unbounded work. +- Proposed target budgets per loop/ISR and how to measure them (cycle counter, DWT CYCCNT, GPIO pulse). + +### SD Logging Path Audit +- Draw the path: producer → buffer → writer → filesystem. +- State whether anything in this path can block the control loop; if yes, **red flag** and propose a double-buffer + DMA solution with back-pressure. +- Note FAT fragmentation risks and recommend pre-allocation/contiguous files. + +### Memory & Cache Audit +- Table of buffers/queues (size, location, DMA safety). +- Call out any missing `SCB_CleanDCache_by_Addr`/`Invalidate…` around DMA. +- Stack worst-case estimates; identify recursion or large stack objects. + +### Parameter & Config Strategy +- What is compile-time vs runtime; risks of fleet variance; propose a parameter server with versioning and safe defaults. + +### Test Plan (do these next) +- **Timing:** instrument each hot path with GPIO pulses; capture min/max/avg with logic analyzer. +- **Stress:** burst sensor read + SD write at 2× nominal rate; verify no loop overrun. +- **Power:** brown-out/voltage sag test; verify safe behavior. +- **Faults:** unplug/replug sensors, corrupt packets, full SD card, slow SD card, filesystem error. +- **Watchdog:** prove it catches a deadlock in < X ms and reboots to safe state. + +### Tooling & CI Recommendations +- Compiler flags, sanitizers in host builds, clang-tidy profile, cppcheck profile, unit test harness. +- Size/regression gates: fail build if flash/ram exceed ceilings; enforce `-Werror`. + +### Open Questions / UNSURE +- List any items where the code is ambiguous. Mark each as **UNSURE** and add a helpful Google query link: + - Example: **UNSURE:** “Teensy 4.0 SDIO cache coherency best practices” → [search](https://www.google.com/search?q=Teensy+4.0+SDIO+cache+coherency+DMA+M7) + +## Constraints & Style +- Be concise but complete. Prefer bullets and tables over prose walls. +- Use concrete filenames/symbols/lines when possible. +- Order all issues strictly by severity (flight safety, data integrity, real-time determinism, then maintainability). +- Provide minimally invasive patches when possible, but do not sugarcoat structural rewrites if required. + +## Inputs +- Codebase is available to you (use your repo tools to open files). Review *all* modules touching: main loop/scheduler, ISR sources, sensor drivers, logging, storage, comms, controller/estimator, parameter/config, and build/linker scripts. +- Teensy 4.0 environment: Arduino/Teensyduino or PlatformIO; note compiler flags and linker script. + +## Deliverables +Return one structured review in the exact format above. Do **not** omit the **Test to prove it** field for each finding. If you cannot substantiate a claim with evidence or a known principle, mark it **UNSURE** and add a Google query link. \ No newline at end of file diff --git a/Temporary/Untitled 1.md b/Temporary/Untitled 1.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 10.md b/Temporary/Untitled 10.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 11.md b/Temporary/Untitled 11.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 12.md b/Temporary/Untitled 12.md deleted file mode 100644 index b1398bd..0000000 --- a/Temporary/Untitled 12.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -aliases: -person_type: -person_hobbies: -ref: -person: ---- diff --git a/Temporary/Untitled 13.md b/Temporary/Untitled 13.md deleted file mode 100644 index b1398bd..0000000 --- a/Temporary/Untitled 13.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -aliases: -person_type: -person_hobbies: -ref: -person: ---- diff --git a/Temporary/Untitled 14.md b/Temporary/Untitled 14.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 15.md b/Temporary/Untitled 15.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 2.md b/Temporary/Untitled 2.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 3.md b/Temporary/Untitled 3.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 4.md b/Temporary/Untitled 4.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 5.md b/Temporary/Untitled 5.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 6.md b/Temporary/Untitled 6.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 7.md b/Temporary/Untitled 7.md deleted file mode 100644 index a67d15a..0000000 --- a/Temporary/Untitled 7.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Who by Geoff Smart -created_date: 2025-06-09 -updated_date: 2025-06-09 -aliases: -tags: - - book -type: book -book_name: Who -author: Geoff Smart -status: not_started ---- -# Who by Geoff Smart -- **🏷️Tags** : #06-2025 #book ---- -## Summary - -> [!summary] Summary -> 3 Sentences only! -> - What are the main ideas? -> - If I implemented one idea from this book right now, which one would it be? -> - How would I describe the book to someone else? - ---- -## Ideas and Thoughts - -> [!info]+ Inspiring Questions -> - Did you think about other concepts from other books? -> - Do the concepts fit to your past, to your memories? -> - Can you relive them and reflect them from a different angle? - - ---- -## Clippings - -> [!info] Import Clippings from Kindle -> Annotate Clippings with thoughts and cross references - - - ---- -```query -Who Geoff Smart --file: "Who by Geoff Smart.md" -``` diff --git a/Temporary/Untitled 8.md b/Temporary/Untitled 8.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled 9.md b/Temporary/Untitled 9.md deleted file mode 100644 index e69de29..0000000 diff --git a/Temporary/Untitled.md b/Temporary/Untitled.md deleted file mode 100644 index e69de29..0000000