Skip to content

Commit 616119c

Browse files
author
liuyucai
committed
更改FLASH_PAGE_SIZE拼写错误
1 parent df12f66 commit 616119c

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

components/fal/samples/porting/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,13 @@ static int write_sector( long offset, const uint8_t* buf, size_t size )
273273
uint32_t addr = FLASH_START_ADDR + offset;
274274

275275
// 计算地址的页对齐上边界和下边界(按FLASH_PAGE_SIZE对齐)
276-
uint32_t addr_up = FAL_ALIGN_UP( addr, FALSH_PAGE_SIZE );
277-
uint32_t addr_down = FAL_ALIGN_DOWN( addr, FALSH_PAGE_SIZE );
276+
uint32_t addr_up = FAL_ALIGN_UP( addr, FLASH_PAGE_SIZE );
277+
uint32_t addr_down = FAL_ALIGN_DOWN( addr, FLASH_PAGE_SIZE );
278278

279279
// 计算写入结束地址及其页对齐边界
280280
uint32_t addr_end = addr + size;
281-
uint32_t addr_end_up = FAL_ALIGN_UP( addr_end, FALSH_PAGE_SIZE );
282-
uint32_t addr_end_down = FAL_ALIGN_DOWN( addr_end, FALSH_PAGE_SIZE );
281+
uint32_t addr_end_up = FAL_ALIGN_UP( addr_end, FLASH_PAGE_SIZE );
282+
uint32_t addr_end_down = FAL_ALIGN_DOWN( addr_end, FLASH_PAGE_SIZE );
283283

284284
// 初始化当前处理地址和长度变量
285285
uint32_t cur_addr = addr_down; // 从页对齐起始地址开始处理
@@ -302,7 +302,7 @@ static int write_sector( long offset, const uint8_t* buf, size_t size )
302302
// 处理结束未对齐部分(跨页结束边界)
303303
else if ( cur_addr == addr_end_down ) {
304304
// 单页最大写入长度
305-
max_write_len = FALSH_PAGE_SIZE;
305+
max_write_len = FLASH_PAGE_SIZE;
306306
// 计算实际需要写入的长度(结束地址 - 当前页起始地址)
307307
write_len = addr_end - cur_addr;
308308
// 确保不超过页最大长度
@@ -314,12 +314,12 @@ static int write_sector( long offset, const uint8_t* buf, size_t size )
314314
// 处理完整页写入
315315
else {
316316
// 整页写入(FLASH_PAGE_SIZE长度)
317-
norflash_write_page( buf, cur_addr, FALSH_PAGE_SIZE );
318-
buf += FALSH_PAGE_SIZE; // 移动数据指针整页长度
317+
norflash_write_page( buf, cur_addr, FLASH_PAGE_SIZE );
318+
buf += FLASH_PAGE_SIZE; // 移动数据指针整页长度
319319
}
320320

321321
// 移动到下一页起始地址
322-
cur_addr += FALSH_PAGE_SIZE;
322+
cur_addr += FLASH_PAGE_SIZE;
323323
}
324324
return size; // 返回成功写入的总字节数
325325
}

components/fal/samples/porting/fal_norflash_port.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#define FLASH_END_ADDR 0x01000000U // 16*1024*1024
77

88
#define FLASH_PROGRAM_MIN_SIZE 256 // 256 bytes
9-
//每次对falsh写入时 底层可以写入的最大字节数为 FALSH_PAGE_SIZE
10-
#define FALSH_PAGE_SIZE FLASH_PROGRAM_MIN_SIZE // 256 bytes
9+
//每次对falsh写入时 底层可以写入的最大字节数为 FLASH_PAGE_SIZE
10+
#define FLASH_PAGE_SIZE FLASH_PROGRAM_MIN_SIZE // 256 bytes
1111

1212
/**
1313
* @brief 需要实现以下函数
@@ -71,12 +71,12 @@ static uint32_t judge_whether_erase( uint8_t* sector_buf, uint16_t len )
7171
static int write_sector( long offset, const uint8_t* buf, size_t size )
7272
{
7373
uint32_t addr = FLASH_START_ADDR + offset;
74-
uint32_t addr_up = FAL_ALIGN_UP( addr, FALSH_PAGE_SIZE );
75-
uint32_t addr_down = FAL_ALIGN_DOWN( addr, FALSH_PAGE_SIZE );
74+
uint32_t addr_up = FAL_ALIGN_UP( addr, FLASH_PAGE_SIZE );
75+
uint32_t addr_down = FAL_ALIGN_DOWN( addr, FLASH_PAGE_SIZE );
7676

7777
uint32_t addr_end = addr + size;
78-
uint32_t addr_end_up = FAL_ALIGN_UP( addr_end, FALSH_PAGE_SIZE );
79-
uint32_t addr_end_down = FAL_ALIGN_DOWN( addr_end, FALSH_PAGE_SIZE );
78+
uint32_t addr_end_up = FAL_ALIGN_UP( addr_end, FLASH_PAGE_SIZE );
79+
uint32_t addr_end_down = FAL_ALIGN_DOWN( addr_end, FLASH_PAGE_SIZE );
8080

8181
uint32_t cur_addr = addr_down;
8282
uint32_t max_write_len = 0;
@@ -89,17 +89,17 @@ static int write_sector( long offset, const uint8_t* buf, size_t size )
8989
buf += write_len;
9090
}
9191
else if ( cur_addr == addr_end_down ) {
92-
max_write_len = FALSH_PAGE_SIZE;
92+
max_write_len = FLASH_PAGE_SIZE;
9393
write_len = addr_end - cur_addr;
9494
write_len = write_len >= max_write_len ? max_write_len : write_len;
9595
norflash_write_page( buf, cur_addr, write_len );
9696
}
9797
else {
98-
norflash_write_page( buf, cur_addr, FALSH_PAGE_SIZE );
99-
buf += FALSH_PAGE_SIZE;
98+
norflash_write_page( buf, cur_addr, FLASH_PAGE_SIZE );
99+
buf += FLASH_PAGE_SIZE;
100100
}
101101

102-
cur_addr += FALSH_PAGE_SIZE;
102+
cur_addr += FLASH_PAGE_SIZE;
103103
}
104104
return size;
105105
}

0 commit comments

Comments
 (0)