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.

F28M35 系统初始化部分程序的理解



您好!我在学习controlsuit中F28m35的Dual system Example的Blinky的例子。在M3中有下面两句程序:
#ifdef _FLASH                         
// Copy time critical code and Flash setup code to RAM
// This includes the following functions:  InitFlash();
// The  RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart
// symbols are created by the linker. Refer to the device .cmd file.
    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);     
// Call Flash Initialization to setup flash waitstates
// This function must reside in RAM
    FlashInit();    
我想请教下它用来干嘛的,是否是必须的(有些例子中并未使用这两条语句)?
  • 您好,

    (1)memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);    

    对于一些需要在 RAM 中执行的函数来说,在调用之前,需要先调用 memcpy() 来将其从 Flash 中搬移至 RAM;如果没有需要执行搬移操作的函数,那么则不需要调用 memcpy() ;

    (2)FlashInit();   

    FlashInit() 用于初始化一些 Flash 操作相关的寄存器,该函数必须在 RAM 中执行;

     

    这两个函数的详细定义应该在工程中能够找到,可以作为进一步的参考。