完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
stm32片上flash数据结构 const struct fal_flash_dev stm32f2_onchip_flash ={ |
|
相关推荐
6个回答
|
|
看你具体擦除的地方块大小是多少,就是起始地址那里到size结束,block是多少就是多少。
|
|
|
|
意思是说整片片上flash的大小吗,但是这个名字是blocksize,是每个块的大小啊,按理说每块大小应该是2048或者4096字节才合理,一般spiflash才有block的参数,片上flash按芯片参考手册上都是按page和bank来划分区域,没有block这个参数。
|
|
|
|
学会融会贯通,每家芯片叫法可能不一样,一般是page大小。
|
|
|
|
主要是stm32片上flash没有block这个概念,只有page的概念,这儿就按页大小填写?
|
|
|
|
rtt驱动是这样分块定义的
#if defined(RT_USING_FAL) static int fal_flash_read_16k(long offset, rt_uint8_t *buf, size_t size); static int fal_flash_read_64k(long offset, rt_uint8_t *buf, size_t size); static int fal_flash_read_128k(long offset, rt_uint8_t *buf, size_t size); static int fal_flash_write_16k(long offset, const rt_uint8_t *buf, size_t size); static int fal_flash_write_64k(long offset, const rt_uint8_t *buf, size_t size); static int fal_flash_write_128k(long offset, const rt_uint8_t *buf, size_t size); static int fal_flash_erase_16k(long offset, size_t size); static int fal_flash_erase_64k(long offset, size_t size); static int fal_flash_erase_128k(long offset, size_t size); const struct fal_flash_dev stm32_onchip_flash_16k = { "onchip_flash_16k", STM32_FLASH_START_ADRESS_16K, FLASH_SIZE_GRANULARITY_16K, (16 * 1024), {NULL, fal_flash_read_16k, fal_flash_write_16k, fal_flash_erase_16k} }; const struct fal_flash_dev stm32_onchip_flash_64k = { "onchip_flash_64k", STM32_FLASH_START_ADRESS_64K, FLASH_SIZE_GRANULARITY_64K, (64 * 1024), {NULL, fal_flash_read_64k, fal_flash_write_64k, fal_flash_erase_64k} }; const struct fal_flash_dev stm32_onchip_flash_128k = { "onchip_flash_128k", STM32_FLASH_START_ADRESS_128K, FLASH_SIZE_GRANULARITY_128K, (128 * 1024), {NULL, fal_flash_read_128k, fal_flash_write_128k, fal_flash_erase_128k} }; static int fal_flash_read_16k(long offset, rt_uint8_t *buf, size_t size) { return stm32_flash_read(stm32_onchip_flash_16k.addr + offset, buf, size); } static int fal_flash_read_64k(long offset, rt_uint8_t *buf, size_t size) { return stm32_flash_read(stm32_onchip_flash_64k.addr + offset, buf, size); } static int fal_flash_read_128k(long offset, rt_uint8_t *buf, size_t size) { return stm32_flash_read(stm32_onchip_flash_128k.addr + offset, buf, size); } static int fal_flash_write_16k(long offset, const rt_uint8_t *buf, size_t size) { return stm32_flash_write(stm32_onchip_flash_16k.addr + offset, buf, size); } static int fal_flash_write_64k(long offset, const rt_uint8_t *buf, size_t size) { return stm32_flash_write(stm32_onchip_flash_64k.addr + offset, buf, size); } static int fal_flash_write_128k(long offset, const rt_uint8_t *buf, size_t size) { return stm32_flash_write(stm32_onchip_flash_128k.addr + offset, buf, size); } static int fal_flash_erase_16k(long offset, size_t size) { return stm32_flash_erase(stm32_onchip_flash_16k.addr + offset, size); } static int fal_flash_erase_64k(long offset, size_t size) { return stm32_flash_erase(stm32_onchip_flash_64k.addr + offset, size); } static int fal_flash_erase_128k(long offset, size_t size) { return stm32_flash_erase(stm32_onchip_flash_128k.addr + offset, size); } #endif #endif /* BSP_USING_ON_CHIP_FLASH */ |
|
|
|
fal_rtt.c中,对blk_size的处理如下:
blk_dev->fal_part = fal_part; blk_dev->geometry.bytes_per_sector = fal_flash->blk_size; blk_dev->geometry.block_size = fal_flash->blk_size; blk_dev->geometry.sector_count = fal_part->len / fal_flash->blk_size; 内部按字节来计算的。有些Blog说填128,应该是说错了。 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
AI模型部署边缘设备的奇妙之旅:如何在边缘端部署OpenCV
1209 浏览 0 评论
tms320280021 adc采样波形,为什么adc采样频率上来波形就不好了?
1058 浏览 0 评论
1444 浏览 0 评论
1371 浏览 0 评论
1023 浏览 0 评论
74584 浏览 21 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-18 13:39 , Processed in 0.739580 second(s), Total 80, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号