kyrandia 发表于 2015-7-18 10:10:08

讀 external SPI flash 失敗


目前可以从 VM 写资料至 external SPI flash 中, 但读不出来.

步骤如下:

1. 先编辑一个描述 partition table 的档案, 如下:
档名: part.ptn
内容:
0, 1K, RO, (none)

2. 使用 ADK 工具 nvscmd.exe 烧写 partition table:
nvscmd.exe burn part.ptn ALL

3. 在 VM 中随便写资料至 partition #0 中:
#define PARTITION_NUM 0
#define DATA_SIZE 64

    Sink flash_sink;
    uint16 bytes;
    uint8 *ptr;

    PanicNull(flash_sink = StreamPartitionOverwriteSink(PARTITION_SERIAL_FLASH, PARTITION_NUM));
    PartitionSetMessageDigest(flash_sink, PARTITION_MESSAGE_DIGEST_SKIP, NULL, 0);
    bytes = SinkClaim(flash_sink, DATA_SIZE);
    ptr = SinkMap(flash_sink);
    ptr = 0xA1;
    ptr = 0xA2;
    ptr = 0xA3;
    ptr = 0xA4;
    ptr = 0xA5;
    PanicZero(SinkFlush(flash_sink, 5));
    SinkClose(flash_sink);

4. 使用 ADK 工具 nvscmd.exe 确认资料有写入:
nvscmd.exe dump test.ptn
执行完后会产生 test_partition0.xuv, 打开此档案确认资料已写入.

5. 在 VM 中, 从 partition #0 读资料:
#define PARTITION_NUM 0

    Source flash_source;
    uint16 bytes;
    const uint8 *ptr;
    uint8 b;   

    flash_source = PartitionGetRawSerialSource(PARTITION_SERIAL_FLASH, PARTITION_NUM);
    PanicNull(flash_source);
    bytes = SourceSize(flash_source);
    ptr = SourceMap(flash_source);
    b = ptr;
    b = ptr;
    b = ptr;
    b = ptr;
    b = ptr;
    SourceClose(flash_source);


在步骤 5 中, PartitionGetRawSerialSource() 都无法传回 source,有人有此方面的经验吗? 谢谢!



honghua152 发表于 2015-7-18 10:11:44

什么情况??????????????????

kyrandia 发表于 2015-7-18 12:13:35

honghua152 发表于 2015-7-18 10:11
什么情况??????????????????

要从 VM 写资料到 external SPI flash, 写进去 partition 是可以, 但读出来不行. 有办法吗?

寒江雪 发表于 2015-7-20 10:11:44

灌水赚金币,赚积分

勇敢向前走 发表于 2015-8-24 10:55:00

楼主怎么擦除外部Flash的?能否说下。感谢!!

tzc986858997 发表于 2015-8-24 17:02:22

学习路过 ....

勇敢向前走 发表于 2015-8-25 16:32:42

楼主怎么解决此问题的,能否赐教下,感谢!!
页: [1]
查看完整版本: 讀 external SPI flash 失敗