2.3.1 Executing the first Write operation from RAM After an MCU reset, the Flash module is ready and the CPU can start fetching code from it. However, the built-in Flash Erase/Program procedures are not initialized during the MCU reset phase, this is only done when the first Flash Erase/Program instruction is executed. The Erase/Program procedures are stored in a reserved area of bank 0. While they are being initialized Flash bank 0 is not accessible for the user. The first Flash Erase/Program operation is started when the WMS bit is set. After setting this bit, Bank 0 is no longer accessible. For this reason the code to be executed after setting the WMS bit (Polling the bits LOCK, BSYA0 and BSYA0) must be fetched from RAM. Also, due to this initialization, the first Erase/Program operation will take more time than other subsequent Erase/Program operations. 上面的意思好像说有一段初始化flash代码在bank0中,复位后的首次擦除写flash操作会用到这段代码,因此必须在ram中运行。那么如果程序想放在flash中运行,是不是开机后要先定位到ram中运行随便写个数据到flash,让它初始化一下,然后再定位到flash中运行。 我的理解对不对,要用个flash有那么复杂吗? |