diff --git a/iflytop_xsync.h b/iflytop_xsync.h index 5f1f83e..624ce0c 100644 --- a/iflytop_xsync.h +++ b/iflytop_xsync.h @@ -10,6 +10,7 @@ extern "C" { #include "xs_gpio.h" #include "xs_log.h" #include "xs_id.h" +#include "xs_device_info.h" #ifdef __cplusplus } #endif \ No newline at end of file diff --git a/xs_device_info.c b/xs_device_info.c new file mode 100644 index 0000000..7eaafed --- /dev/null +++ b/xs_device_info.c @@ -0,0 +1,17 @@ +#include "xs_device_info.h" + +#include +#include +#include + +#include "xs_log.h" + + +/******************************************************************************* + * EXTERN * + *******************************************************************************/ + +xs_device_info_t* xs_device_info_get() { // + xs_device_info_t* info = (xs_device_info_t*)DEVICE_INFO_START_ADD; + return info; +} \ No newline at end of file diff --git a/xs_device_info.h b/xs_device_info.h new file mode 100644 index 0000000..6348b40 --- /dev/null +++ b/xs_device_info.h @@ -0,0 +1,39 @@ +#pragma once +#include + +#include "main.h" + +/** + * @brief + * STM32F407VETx 1024k + * + * index startAdd size + * 0 0x08000000 16k + * 1 0x08004000 16k + * 2 0x08008000 16k + * 3 0x0800C000 16k + * 4 0x08010000 64k + * 5 0x08020000 128k + * 6 0x08040000 128k + * 7 0x08060000 128k + * 8 0x08080000 128k + * 9 0x080A0000 128k + * 10 0x080C0000 128k + * 11 0x080E0000 128k + * + * + * @WARNING: + * 1. 我们使用第7个扇区,即0x08060000~0x0807FFFF + * 2. 程序最大不能超过75% + * 3. rawstartadd第一位必须是0xABCD,最后一位是校验和 + */ + +#define DEVICE_INFO_START_ADD 0x080E0000 // + +typedef struct { + uint32_t year; + uint32_t weak; + uint32_t index; +} xs_device_info_t; + +xs_device_info_t* xs_device_info_get(); diff --git a/xs_flash.h b/xs_flash.h index 44efdd3..e08af76 100644 --- a/xs_flash.h +++ b/xs_flash.h @@ -5,7 +5,7 @@ /** * @brief - * STM32F407VETx 512k + * STM32F407VETx 1024k * * index startAdd size * 0 0x08000000 16k @@ -16,6 +16,10 @@ * 5 0x08020000 128k * 6 0x08040000 128k * 7 0x08060000 128k + * 8 0x08080000 128k + * 9 0x080A0000 128k + * 10 0x080C0000 128k + * 11 0x080E0000 128k * * * @WARNING: @@ -25,8 +29,8 @@ */ #define FLASH_MASK_VAL 0xABCD -#define FLASH_START_ADD 0x08060000 // -#define FLASH_EARSE_SECTOR FLASH_SECTOR_7 +#define FLASH_START_ADD 0x080C0000 // +#define FLASH_EARSE_SECTOR FLASH_SECTOR_10 /** * @brief 初始化flash