SFLASH的擦写范围

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
CaLi_4592466
Level 4
Level 4
25 replies posted 10 replies posted 5 replies posted

你好,关于FLASH的wiced_hal_sflash_write 和 wiced_hal_sflash_erase 的函数的写,擦是不能对active sections操作的是吧?只能针对upgrade_ds_location 进行擦除操作吧?

0 点赞
1 解答
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

从这段描述看, 输入的大小不能超过memory size, 所以写入之前要先设定wiced_hal_sflash_set_size,

第二段描述:

active sections (boot sectors) and sections

/// required for the proper function of the Bluetooth subsystem

表明这个api是有保护的。

///////////////////////////////////////////////////////////////////////////////

/// Write data from memory to a certain location on the serial flash module.

///

/// Please ensure that the address and (address + length) of data to be

/// written does not go beyond the size of the memory module. If they do,

/// the write operation will "wrap around" and start corrupting the starting

/// address of the memory (boot sector), rendering the device inoperable.

///

/// Note that this function will not allow corruption of certain memory

/// locations, such as currently active sections (boot sectors) and sections

/// required for the proper function of the Bluetooth subsystem.

///   

/// \param addr - The starting destination address on the serial flash.

/// \param len  - The number of bytes to write.

/// \param buf  - Pointer to source data buffer.

///

/// \return The number of bytes written.

/// Note: Please set serial flash size using wiced_hal_sflash_set_size API before

///       using this API. Otherwise write fails.

///////////////////////////////////////////////////////////////////////////////

uint32_t wiced_hal_sflash_write(uint32_t addr, uint32_t len, uint8_t *buf);

在原帖中查看解决方案

0 点赞
6 回复数
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

hello:

  which evb are you using now for the flash operation?

0 点赞

CYBT343026 ,是否有enable/disable  对 active sections 写保护?

0 点赞
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

从这段描述看, 输入的大小不能超过memory size, 所以写入之前要先设定wiced_hal_sflash_set_size,

第二段描述:

active sections (boot sectors) and sections

/// required for the proper function of the Bluetooth subsystem

表明这个api是有保护的。

///////////////////////////////////////////////////////////////////////////////

/// Write data from memory to a certain location on the serial flash module.

///

/// Please ensure that the address and (address + length) of data to be

/// written does not go beyond the size of the memory module. If they do,

/// the write operation will "wrap around" and start corrupting the starting

/// address of the memory (boot sector), rendering the device inoperable.

///

/// Note that this function will not allow corruption of certain memory

/// locations, such as currently active sections (boot sectors) and sections

/// required for the proper function of the Bluetooth subsystem.

///   

/// \param addr - The starting destination address on the serial flash.

/// \param len  - The number of bytes to write.

/// \param buf  - Pointer to source data buffer.

///

/// \return The number of bytes written.

/// Note: Please set serial flash size using wiced_hal_sflash_set_size API before

///       using this API. Otherwise write fails.

///////////////////////////////////////////////////////////////////////////////

uint32_t wiced_hal_sflash_write(uint32_t addr, uint32_t len, uint8_t *buf);

0 点赞

谢谢及时的回复,是否有对这个写保护的 enbale/disbale 的函数?

0 点赞
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

从提供的api 来看没有disable和enable的接口。

0 点赞

好的,谢谢!

0 点赞