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.

[参考译文] UCD3138A:有两种不同的方法将"zero_out_integration_word_quot 复制到 RAM、哪种方法更好?

Guru**** 2494635 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/721038/ucd3138a-there-are-two-different-ways-to-copy-zero_out_integrity_word-to-ram-which-one-is-better

器件型号:UCD3138A

您好!

我发现有两种不同的方法可以从 pflash 复制"zero_out_integrity"代码到 RAM、然后执行它来清除 pflash 校验和、如下所示。 哪种方法更好?

 LLC 演示代码中的一种方法:


        寄存器 uint32 * program_index =(uint32 *) 0x19000;//存储程序的目标地址
        寄存器 uint32 * source_index =(uint32 *) zero_out_integration_word;//设置 pflash 的源地址;

        寄存器 uint32计数器;

        for (counter=0;counter < 32;counter++)//将程序从 pflash 复制到 RAM
        {
         *(program_index++)=*(source_index++);
        }
       }
       {
        寄存器 FUNC_PTR func_ptr;
        func_ptr =(FUNC_ptr) 0x19000;    //将函数设置为0x19000
        func_ptr ();
        DecRegs.MFBALR1.bit.RONLY = 1;//将其恢复为只读
        DecRegs.MFBALR17.bit.RONLY = 1;//将其恢复为只读
        SysRegs.SYSECR.bit.reset= 2;//重置设备
       }

       返回;

PFC 演示代码中的另一种方法是:

   寄存器 uint32 * program_index =(uint32 *) program_area;//存储程序的目标地址
   寄存器 uint32 * source_index =(uint32 *) zero_out_integration_word_start;//用于 pflash 的源地址;
   寄存器 uint32计数器;

   for (counter=0;counter < 32;counter++)//将程序从 pflash 复制到 RAM
   {
    *(program_index++)=*(source_index++);
   }

   zero_out_integration_word ();
           返回;

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我们很快会回来。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    第二种方法可能更好、但在代码上有许多其他更改、以使其成为可能。

    除非您使用动态代码版本切换执行多图像代码、否则旧版本正常。 在动态切换中、您必须能够在 RAM 中运行代码而不会破坏变量、并且能够从代码跳转到其他位置。

    在普通代码中、每当清除校验和时、都会重置、因此销毁 RAM 变量无关紧要。

    对于第二个版本、您必须更改 cyclone.cmd 文件以在 RAM 中创建一个特殊的程序区域、在该区域中编译代码以执行、但将其存储在程序闪存中。

      union:run = RAM
     {
      .ram_for_program_area
      .zero_out_integration_word_0:load = pflash、start (_zero_out_integration_word_start){zero_out_integration_word.obj}
      clear_program_flash:load = pflash、start (_clear_program_flash_start){clear_program_flash.obj}
     }

    还有一些其他更改。  我不记得所有这些内容、但如果您搜索 clear_program_flash_start 等内容、您会发现其中一些。