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•Add a test code into main.c that results in creating a dummy data record in data flash memory (0x0800000)
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
} > dflash
volatile char dflash_data="DTEST String"; // place the string into .dflash segment
volatile int counter = 0;
volatile char test_str;
test_str = dflash_data; // use DFLASH data (to avoid deadstripping)
/* Loop forever */
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.
There are many flash programming algorithms available in PEMICRO eclipse plugin folder typically located here (version of plugin may vary):
Now 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.
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"
Finally 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.
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!