Browse Source

添加设备ID获取方法

master
zhaohe 1 year ago
parent
commit
5ae77f0687
  1. 1
      iflytop_xsync.h
  2. 17
      xs_device_info.c
  3. 39
      xs_device_info.h
  4. 10
      xs_flash.h

1
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

17
xs_device_info.c

@ -0,0 +1,17 @@
#include "xs_device_info.h"
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#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;
}

39
xs_device_info.h

@ -0,0 +1,39 @@
#pragma once
#include <stdbool.h>
#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. 使70x08060000~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();

10
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

Loading…
Cancel
Save