sl-mechanical a2c554c232 cleanup: remove all Mamba/F722S/STM32F722 refs — replace with ESP32-S3 BALANCE/IO
- docs/: rewrite AGENTS.md, wiring-diagram.md (SAUL-TEE arch); update
  SALTYLAB.md, FACE_LCD_ANIMATION.md, board-viz.html, SALTYLAB-DETAILED refs
- cad/: dimensions.scad FC params → ESP32-S3 BALANCE params
- chassis/: ASSEMBLY.md, BOM.md, ip54_BOM.md, *.scad — FC_MOUNT_SPACING/
  FC_PITCH → TBD ESP32-S3; Drone FC → MCU mount throughout
- CLAUDE.md, TEAM.md: project desc → SAUL-TEE; hardware table → ESP32-S3/VESC
- USB_CDC_BUG.md: marked ARCHIVED (legacy STM32 era)
- AUTONOMOUS_ARMING.md: USB CDC → inter-board UART (ESP32-S3 BALANCE)
- projects/saltybot/SLAM-SETUP-PLAN.md: FC/STM32F722 → BALANCE/CAN
- jetson/docs/pinout.md, power-budget.md, README.md: STM32 bridge → CAN bridge
- jetson/config/RECOVERY_BEHAVIORS.md: FC+Hoverboard → BALANCE+VESC
- jetson/ros2_ws: stm32_protocol.py → esp32_protocol.py,
  stm32_cmd_node.py → esp32_cmd_node.py,
  mamba_protocol.py → balance_protocol.py; can_bridge_node imports updated
- scripts/flash_firmware.py: DFU/STM32 → pio run -t upload
- src/ include/: ARCHIVED headers added (legacy code preserved)
- test/: ARCHIVED notices; STM32F722 comments marked LEGACY
- ui/diagnostics_panel.html: Board/STM32 → ESP32-S3

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 09:06:09 -04:00

65 lines
2.2 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* ARCHIVED: Legacy STM32F722/Mamba F722S era code. NOT used in current hardware. */
#ifndef OTA_H
#define OTA_H
#include <stdint.h>
#include <stdbool.h>
/*
* OTA firmware update — Issue #124
*
* DFU entry triggered by JLINK_CMD_DFU_ENTER (0x06) or USB CDC 'R' command.
* Uses RTC backup register OTA_DFU_BKP_IDX to pass magic across the soft reset.
*
* RTC BKP register map:
* BKP0RBKP5R : BNO055 calibration offsets (PR #150)
* BKP6R : BNO055 magic (0xB055CA10, PR #150)
* BKP7RBKP14R : Reserved
* BKP15R : OTA DFU magic (this module)
*
* Using BKP15R avoids collision with BNO055 (BKP06) and the old BKP0R
* that the original request_bootloader() used before this module.
*
* Dual-bank note: STM32F722 has single-bank flash (512 KB). Hardware A/B
* rollback is not supported without a custom bootloader. DFU via the ST
* system bootloader at 0x1FF00000 is the supported update path. Rollback
* is handled by the host-side flash_firmware.py script, which keeps a
* backup of the previous binary.
*/
/* RTC backup register index used for DFU magic — avoids BNO055 BKP06 */
#define OTA_DFU_BKP_IDX 15u
/* Magic value written before reset to trigger DFU entry on next boot */
#define OTA_DFU_MAGIC 0xDEADBEEFu
/* STM32F722 internal flash: 512 KB starting at 0x08000000 */
#define OTA_FLASH_BASE 0x08000000u
#define OTA_FLASH_SIZE 0x00080000u /* 512 KB */
/*
* ota_enter_dfu(is_armed)
*
* Request entry to USB DFU mode (ST system bootloader at 0x1FF00000).
* Returns false without side effects if is_armed is true.
* Otherwise: enables backup domain, writes OTA_DFU_MAGIC to BKP15R,
* disables IRQs, calls NVIC_SystemReset(). Never returns on success.
*
* Call from the main loop only (not from ISR context).
*/
bool ota_enter_dfu(bool is_armed);
/*
* ota_fw_crc32()
*
* Compute a CRC-32/MPEG-2 checksum of the full flash region using the
* STM32 hardware CRC peripheral (poly 0x04C11DB7, init 0xFFFFFFFF,
* 32-bit words, no reflection). Covers OTA_FLASH_SIZE bytes from
* OTA_FLASH_BASE including erased padding.
*
* Takes ~0.5 ms at 216 MHz. Call only while disarmed.
*/
uint32_t ota_fw_crc32(void);
#endif /* OTA_H */