Files
十七 ebef6a8694 feat: complete assembly mesh relay control path
- synchronize STM8 application and external flash layout updates\n- add assembly bootloader and assembly application test projects\n- add UART1 interrupt receive ring buffer\n- parse JDY-28M Mesh outer frames and source addresses\n- add CRC-16/MODBUS validation\n- implement relay control command 0x01 and response 0x81\n- support unicast and broadcast relay control frames\n- update host protocol, OTA documents, and serial tools
2026-11-05 16:12:51 +08:00

40 lines
1.9 KiB
Markdown
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.
# STM8 汇编 Bootloader(并行验证工程)
本目录是独立的汇编 Bootloader 实验工程,不修改现有 `STM8_Bootloader` C 版本。
当前阶段已经实现固定中断向量、应用程序跳转、SPI1初始化、W25Q80BV JEDEC ID
读取、OTA元数据处理、OTA固件搬运、升级成功结果写回、应用损坏自动恢复,以及
上电长按后的出厂镜像恢复流程:先分段计算CRC16/MODBUS,校验通过后擦除内部
应用区,再逐字节写入并回读比较,成功后跳转到应用程序。固件读取采用小步处理,
不把整包镜像装入RAM。
OTA元数据使用:镜像地址0x003000、元数据地址0x005000;校验成功搬运后将
0x005010写为成功结果码,并清除0x00500F升级请求。若OTA校验、擦除、写入或
回读失败,Bootloader直接跳转主程序。若应用首字节不是0x82,则自动检查并尝试
恢复出厂镜像;本汇编Bootloader不启用看门狗,也不依赖看门狗复位。
该流程已经完成编译和链接验证,但仍需要连接实际W25Q80BV验证JEDEC读取、外部
Flash数据读取、内部Flash擦写时序以及恢复失败时的现场行为。
如果外部Flash检测失败,当前策略仍是允许内部主程序继续运行;这是为了避免外部
Flash故障导致设备完全无法工作。实际量产策略还需要在搬运功能完成后再补充应用
有效性判断和故障兜底。
## 地址规划
- Bootloader:`0x8000~0x84FF`
- Application:`0x8500~0x9FFF`
- `0x8500` 为应用中断向量表起始地址,复位入口地址从 `0x8501` 动态读取
- TIM4 使用通用转发:`0x8064 -> 0x8564`
- TIM4 IRQ23:固定向量 `0x8064`,转发目标 `0x8564`
- UART1 RX IRQ18:固定向量 `0x8050`,转发目标 `0x8550`
## 构建
```sh
make
```
输出文件为 `build/stm8_bootloader_asm.hex`。当前工程与 C Bootloader 并行存在,
未验证前不要烧录到量产设备。