HOWTO: Program data flash (DFLASH) in S32 Design Studio for Power

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

HOWTO: Program data flash (DFLASH) in S32 Design Studio for Power

HOWTO: Program data flash (DFLASH) in S32 Design Studio for Power

This document describes how to generate an executable file that includes data flash content and how to program it into DFLASH using PEMicro GDB debugger.

The default project generated by the project wizard builds an executable with code flash sections only. 

Note:

It is demonstrated on MPC5744P project but with some small adjustments it's applicable to any other MPC56xx/57xx derivative supported by S32 Design Studio for Power.

Let's first explain how to build an executable that contains DFLASH section:

  •  Check the memory map of the target device in the reference manual to figure out where DFLASH is mapped into. Add DFLASH memory segment/section into the linker file  (MPC57xx_flash.ld).

 pastedImage_5.png

MEMORY
{
    flash_rchw : org = 0x00FA0000,   len = 0x4
    cpu0_reset_vec : org = 0x00FA0004,   len = 0x4
       
    m_text :        org = 0x1000000, len = 2048K   
    m_data :        org = 0x40000000,   len = 384K   
    int_dram  : org = 0x50800000,   len = 64K       
   
    m_dflash :  org = 0x800000, len = 96K    /* data flash memory segment */
} 
SECTIONS
{
  …
  .dflash : { KEEP (*(.dflash)) } > m_dflash  /* place .dflash section into dflsah memory*/
  …
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

  • Select the data you want to place into the DFLASH section in the source code and associate it with the memory section you created in previous step (".dflash").

    __attribute__((section(".dflash"))) const unsigned int dflash_int = 0xFEEDCAFE;
    __attribute__((section(".dflash"))) const char dflash_char[]= "Hello World form DFLASH!";‍‍‍‍‍‍

  • Build the project and check the generated .map file.  The custom".dflash" section should contain the selected data objects.

    .dflash         0x00800000       0x1d
     *(.dflash)
     .dflash        0x00800000       0x1d ./src/main.o
                    0x00800000                dflash_int
                    0x00800004                dflash_char‍‍‍‍‍‍‍‍‍‍

Let's now adjust the project debug configuration to be able to program DFLASH. 

First  make sure you installed the latest version of PEMicro Eclipse Plugin. See the post below - it's about ARM version of S32DS but the update process for S32DS for Power is exactly the same. You just need is to select e200 component instead of ARM:

error while dubbing: "ERROR loading to the device" 

If you need to control DFLASH programming separately from code flash you would need a separate debug configuration for DFLASH.

  • You can use "Duplicate" feature on an existing Debug configuration. This creates a new configuration with pre-populated fields so you don't have to enter them all manually.pastedImage_6.png

  • Change the debug configuration name and press "Apply"
    pastedImage_8.png

  • Switch to the Debugger tab -> Advanced Options and tick "Use Alternative Algorithm" option. Open Browse dialog and go to the folder below where all flash programming algorithms are located (*.pcp) and  select the appropriate DFLASH programming algorithm e.g. for this example: freescale_mpc5744p_1x32x20k_dflash_cut2.pcp

         "<S32_Power_v1.x>\eclipse\plugins\com.pemicro.debug.gdbjtag.ppc_1.5.6.201703011834\win32\gdi\P&E"
 
Note:
Folder name "com.pemicro.debug.gdbjtag.ppc_1.5.6.201703011834" may differ depending on the latest version of Pemicro GDB plugin version installed on your machine.
It's recommended to enter the latest version folder if there are multiple plugin versions available.

pastedImage_671.png

 

If you want to program DFLASH and code flash at once you can just adjust the existing debug configuration. In this case you should select combined cflash+dflash flash algorithm such as e.g. freescale_mpc5744p_cflash_dflash_cut2.pcp 

pastedImage_702.png

  • Click on debug button and as soon as the debug session is established check the DFLASH memory space in the Memory ViewpastedImage_706.png
ラベル(1)
評価なし
バージョン履歴
最終更新日:
‎09-10-2020 01:52 AM
更新者: