HOWTO: Program multiple memory types in single debug session

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HOWTO: Program multiple memory types in single debug session

HOWTO: Program multiple memory types in single debug session

Project created by S32 Design Studio (S32DS) new project wizard typically contains the debugger configurations to load  and debug the project into the code memory (Flash/RAM). However there might be situations that require also to load a content/data (e.g. calibration values) into a special on-chip memory (such as shadow flash, data flash, utest flash...) or an external memory (QSPI).

This document describes how to program multiple memory types (using different programming algorithms) just by single click on the debug button. The decription applies to PEMICRO probes (Multilink Universal, Multilink FX or OpenSDA) anyway a similar approach might be applicable for other vendor probes.

The process can be splitted into two steps:

1. create a separate debugger configurations to program a specific memory modules(QSPI,  data flash,..)

2. associate the program and debug configurations into the single launch group  - this alows to execute multiple actions by invoking the single debug launch .

Let's demonstrate this on MPC5744P and program code and data flash memory using S32DS for Power v2.1 (similar approach can be applied also to other architectures/versions of S32DS).

•  Create a new empty project for MPC5744P. Such a project typically contains Debug/Debug_RAM debugger configuration. First we will add a dummy code  (see below) that creates a record to be stored into the data flash memory (different to code flash memory block).

• The project linker file (MPC57xx_flash.ld) should have the data flash memory block and a linker section associated with data flash (.dflash) defined:

MEMORY
{
dflash : org = 0x00800000, len = 0x1F /* not entire dflash - just for test*/
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

local_dmem : org = 0x50800000, len = 64K
}

SECTIONS
{
.dflash :
{
KEEP(*(.dflash))
} > dflash
Add a test code into main.c that results in creating a dummy data record in data flash memory (0x0800000)
__attribute__((section(".dflash")))
volatile char dflash_data[]="DTEST String"; // place the string into .dflash segment

int main(void)
{
volatile int counter = 0;
volatile char test_str[10];

test_str[0] = dflash_data[0]; // use DFLASH data (to avoid deadstripping)

/* Loop forever */
for(;;)
{
counter++;
}
}

Now if you build the project you can see the data that belong to dflash and code flash in the .map or srec file. If you debug the project using the default debug configuration data flash (DFLASH) memory is not programmed.

To program DFLASH you should create another debug configuration simply by duplicating the existing one and changing the programming algorithm to dflash one: nxp_mpc5744p_1x32x20k_dflash.pcp.

Note:

There are many flash programming algorithms available in PEMICRO eclipse plugin folder typically located here (version of plugin may vary):

"C:\NXP\S32DS_Power_v2.1\eclipse\plugins\com.pemicro.debug.gdbjtag.ppc_2.0.2.202005132054\win32\gdi\P&E\"

S32DS: Duplicate  Debug ConfigurationS32DS: Duplicate Debug ConfigurationS32DS: Load parametersS32DS: Load parametersS32DS: Choose alternative programming algorithmS32DS: Choose alternative programming algorithmNow the new debug configuration (MPC5744P_code_dflash_Debug_DFLASH) is able to program data flash memory.

The final step is to create a launch group configuration and associate it with all the programming/debugging configurations that should be executed once debug is started.

S32DS_Debug_Data_Flash_Launch.png

Add the debug configuration used just for programming purpose as flash type and code debug configuration as debug type. In order to avoid interference between programming of various memories select post launch action -> "Wait until terminated"

S32DS_Debug_Data_Flash_Launch2.pngS32DS_Debug_Data_Flash_Launch3.pngS32DS_Debug_Data_Flash_Launch4.pngFinally as soon as the debug session is established by launching the launch group created above - all the memories are programmed and you can debug the code.

S32DS_Debug_Data_Flash_Final.png
Note:

There is an information about executed flash configurations in the debug context view. Since the programming has alredy finished the thread is terminated and could be cleared by double cross icon.

Enjoy single click programming&debugging in S32 Design Studio!

No ratings
Version history
Last update:
‎01-05-2021 05:35 AM
Updated by: