0
Mike Yan

如何再將便是存入Flash,供下次開機使用?

下面的 code 每次都是 -1, 哪裡錯了?

//起始位置為0xFF000,大小為0x1000
#define FLASH_AP_SETTING_SECTOR 0x00009000 //0x000FD000
flash_t flash;
u32 read_data;
device_mutex_lock(RT_DEV_LOCK_FLASH);
flash_read_word(&flash, FLASH_AP_SETTING_SECTOR ,&myAPmode);
read_data++;
flash_erase_sector(&flash, FLASH_AP_SETTING_SECTOR);
flash_write_word(&flash, FLASH_AP_SETTING_SECTOR ,myAPmode);
device_mutex_unlock(RT_DEV_LOCK_FLASH);
printf("\n === myAPmode=%d\n", myAPmode);

sean 回答了