添加普冉 PY32F040 OTA 双工程代码生成模板
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#ifndef __FLASH_H
|
||||
#define __FLASH_H
|
||||
|
||||
#include "boot_main.h"
|
||||
#include "ota_config.h"
|
||||
|
||||
/* ════════════════════════════════════════════════════════════════
|
||||
* Flash 布局与 OTA 状态机 — 统一由 ota_config.h 配置(唯一入口)
|
||||
* (布局宏 OTA_RUN_ADDR_BASE / OTA_BAK_ADDR_BASE / OTA_SLOT_MAX_SIZE
|
||||
* 及状态结构 ota_param_t / OTA_STATE_* 均在 ota_config.h 中定义)
|
||||
* ════════════════════════════════════════════════════════════════ */
|
||||
#define SYS_BOOTLOADER_ADDR_BASE 0x08000000UL /* Bootloader,17KB */
|
||||
#define FLASH_END_ADDR 0x08020000UL /* 128KB 边界 */
|
||||
|
||||
#define RAM_BASE_ADDR 0x20000000UL
|
||||
#define RAM_END_ADDR 0x20004000UL /* 16KB RAM */
|
||||
|
||||
/* ════════════════════════════════════════════════════════════════
|
||||
* Flash 操作 API
|
||||
* ════════════════════════════════════════════════════════════════ */
|
||||
void APP_FlashWrite(uint32_t PageAddress, uint8_t *Data, uint32_t DataSize);
|
||||
void APP_FlashRead(uint32_t PageAddress, uint8_t *Data, uint32_t DataSize);
|
||||
void APP_FlashEraseWithCheck(uint32_t PageAddress, uint32_t DataSize);
|
||||
|
||||
/* OTA 状态区读写(AB:4 页轮换磨损均衡;SINGLE:固定页 0 直写) */
|
||||
void ota_param_load(ota_param_t *p);
|
||||
void ota_param_store(const ota_param_t *p);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user