From ec22d5dcf5153cefc08d495ecf339edf3d799cba Mon Sep 17 00:00:00 2001 From: yincheng.zhong <634916154@qq.com> Date: 星期二, 02 四月 2024 15:58:16 +0800 Subject: [PATCH] Merge branch '免布线URT-LORA-L071' of http://47.108.70.204:60062/r/XRange_Tag into 免布线URT-LORA-L071 --- Src/OnChipDevices/Flash.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Src/OnChipDevices/Flash.c b/Src/OnChipDevices/Flash.c index 57dbc87..279997b 100644 --- a/Src/OnChipDevices/Flash.c +++ b/Src/OnChipDevices/Flash.c @@ -5,6 +5,10 @@ * @param Size: The image size,the units of Size is Byte * @retval The number of pages or error */ + unsigned short int STMFLASH_ReadHalfWord(unsigned int faddr) +{ + return *(volatile unsigned short int*)faddr; +} uint32_t FLASH_Pages_Calculate(uint32_t Size) { uint32_t Flash_Page_Number = 0; @@ -30,7 +34,7 @@ * @retval 0:error; 1:success */ - +extern uint16_t testflag; uint32_t FLASH_Prepare(uint32_t Address, uint32_t Len) //起始地址和字长 {uint32_t PageError = 0; FLASH_EraseInitTypeDef EraseInitStruct; @@ -41,9 +45,11 @@ // HAL_FLASH_Lock(); if (HAL_FLASHEx_Erase(&EraseInitStruct, &PageError) != HAL_OK) { + testflag=1; HAL_FLASH_Lock(); return 0; }else{ + testflag=0; HAL_FLASH_Lock(); return 1; } @@ -95,6 +101,7 @@ * @retval 0:error ; 1:success */ #define DATA_32 ((uint32_t)0x12345678) +uint16_t test111; uint32_t FLASH_Write( uint32_t Address, const uint8_t* pData, uint32_t Len) { uint32_t WriteCount = 0,temp; @@ -107,7 +114,7 @@ for( ; WriteCount < Len; WriteCount+=4) {temp=*(uint32_t*)FlashSource; FLASHStatus = HAL_FLASH_Program(FLASH_TYPEPROGRAMDATA_WORD, FlashDestination, temp); - + test111=FLASHStatus; if( FLASHStatus != HAL_OK) { break; -- Gitblit v1.9.3