连续签到天数:2天 | 签到总天数:21天 | 签到总奖励:183金币 |
|
马上注册,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
×
目前可以从 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[0] = 0xA1;
ptr[1] = 0xA2;
ptr[2] = 0xA3;
ptr[3] = 0xA4;
ptr[4] = 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[7];
flash_source = PartitionGetRawSerialSource(PARTITION_SERIAL_FLASH, PARTITION_NUM);
PanicNull(flash_source);
bytes = SourceSize(flash_source);
ptr = SourceMap(flash_source);
b[0] = ptr[0];
b[1] = ptr[1];
b[2] = ptr[2];
b[3] = ptr[3];
b[4] = ptr[4];
SourceClose(flash_source);
在步骤 5 中, PartitionGetRawSerialSource() 都无法传回 source, 有人有此方面的经验吗? 谢谢!
|
|