本帖最后由 adamdo001 于 2015-6-18 10:51 编辑
学习官方例程flexmem_demo,使用K20DX256VLL7处理器过程中,用IAR开发程序,遇到问题。
__ramfunc INT32U FlexEE_partition_flash(INT32U eeprom_size, INT32U dflash_size)
{
Test to make sure the device is not already partitioned. If it
* is already partitioned, then return with no action performed.
*/
if ((SIM_FCFG1 & SIM_FCFG1_DEPART(0xF)) != 0x00000F00)
{
return PARTED_FAIL;
}
/* Write the FCCOB registers */
FTFL_FCCOB0 = FTFL_FCCOB0_CCOBn(0x80); // Selects the PGMPART command
FTFL_FCCOB1 = 0x00;
FTFL_FCCOB2 = 0x00;
FTFL_FCCOB3 = 0x00;
/* FCCOB4 is written with the code for the subsystem sizes (eeprom_size define) */
FTFL_FCCOB4 = eeprom_size;
/* FFCOB5 is written with the code for the Dflash size (dflash_size define) */
FTFL_FCCOB5 = dflash_size;
/* All required FCCOBx registers are written, so launch the command */
FTFL_FSTAT = FTFL_FSTAT_CCIF_MASK;
/* Wait for the command to complete */
while(!(FTFL_FSTAT & FTFL_FSTAT_CCIF_MASK));
return 1;
}
在上面的程序里,上电复位后,经常停在标红的那一行。
在IAR里看到程序一直等待在 while(!(FTFL_FSTAT & FTFL_FSTAT_CCIF_MASK));
在IAR用Jlink调试,单步运行,走过这一行,再向下就正常了。
FlexEE_partition_flash这个函数是不是要放在RAM里运行?
多次遇到上面的这个情况。到底是什么原因?怎样解决? |