This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

FlashAPI是否必须在RAM执行?



在FlashAPI的文档及各种论坛上讲,在调用FlashAPI操作时必须在RAM执行。但经实际验证,使用F28377D,不搬移API函数到RAM,直接在Flash中执行,依然可以正常执行初始化-擦除-编程等操作,写入Flash的数据也没有问题,当然操作的flash区块是程序区之外的sector.

那么,问题是,在操作程序本身sector之外的flash sector时,是否一定需要将调用的FlashAPI搬移到RAM中执行?

比如,程序区为FlashA和FlashB,将FlashC作为参数存储区(可读可写),在28377D中验证,数据操作、写入都没有问题.

  • 如之前回复的,FLASH-API函数理论上都需要在ram运行。之前提到的函数B可以不在ram运行,只要它所在flash没有被操作。下面是文档中的解释:
    Flash API execution is interruptible; however, there should not be any read or fetch access from the Flash bank/OTP when an erase or program operation is in progress. Therefore, the Flash API functions, the user application functions that call the Flash API functions, and any ISRs (Interrupt service routines,) must be executed from RAM. For example, the entire code snippet shown below should be executed from RAM and not just the Flash API functions. The reason for this is because the Fapi_issueAsyncCommandWithAddress() function issues the erase command to the FSM, but it does not wait until the erase operation is over. As long as the FSM is busy with the current operation, there should not be a Flash access.
  • Green Deng 说:
    Flash API execution is interruptible; however, there should not be any read or fetch access from the Flash bank/OTP when an erase or program operation is in progress. 

    我验证的是,在FlashAPI在Flash_SectorA中执行,来操作(擦除、写入)Flash_SectorB,这样是可行的。

    而上面的解释中,用了Flash bank,指的是整个flash空间吗,还是指sector?如果是整个Flash空间,那上面做的验证应该会是失败的,因为flashAPI所在的Flash_SectorA和要操作的Flash_SectorB都属于这个Flash的Bank,在擦除操作Flash_SectorB的时候,Flash_SectorA中也在执行程序(包含定时中断、FlashAPI等),但是与我的验证不符啊。