这是最新(主)开发分支的文档。如果您正在查找以前版本的文档,使用左侧的下拉菜单选择所需的版本。

flash示例

功能概述

此应用程序启动后执行下面2个操作:

  1. 初始化flash

  2. 调用flash接口读写数据

环境要求

如需操作外部flash,需提前接入外部flash

编译和烧录

示例位置:wm_iot_sdk/examples/peripheral/flash

编译、烧录等操作请参考:快速入门

运行结果

成功运行将输出如下日志

D/dt              [0.002] add device iflash
D/ptb             [0.002] partition table base 0xe000
D/ft              [0.002] ft_0 base 0, ft_1 base 1000
D/ft              [0.004] ft init too
D/ft              [0.004] ft init 1
D/main            [0.004] boot reason 0
D/main            [0.004] heap size 273160(266.76KB)
D/main            [0.004] flash size 0x200000(2MB)
start example write and read internal flash


********start write without erase example*********
write data is: abcdefghijklmnopqrst
read data is: abcdefghijklmnopqrst
write without erase example pass


*************start write with erase example*************
write data is: zyxwvutsrqponmlkjihg
read data is: zyxwvutsrqponmlkjihg
write with erase example pass
start example write and read external flash
D/dt              [0.148] add device flash_w25q
D/dt              [0.148] add device spi
D/eflash          [0.150] [wm_spi_flash_get_unique_id 312]