S32 Design Studio Knowledge Base

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

S32 Design Studio Knowledge Base

Discussions

Sort by:
There are situations that require debugging multiple executable files within one debug session. Typical example is debugging the bootloader + application together where each one is a separate executable elf file or S32DS eclipse project. S32DS project loads the debug information of the generated executable file by default. Anyway GDB supports command to add additional elf files debug information into same debug session. If the executable source files are present on the same machine then the source level debugging of all the elf files is possible. Let's assume there are two elf files (bootloader and application) and both are built with debug information enabled - build configuration is named "Debug". Generation of the debug information for GCC compiler could be set in the Project Properties -> C/C++ Build -> Settings -> Standard  S32DS C Compiler -> Debug Level  Each debug configuration in S32 Design Studio supports loading or ignoring debug information. "Load symbols" loads just the debug information whereas "Load executable" basically loads program/code/data sections into MCU memory without debug information. Both options are enabled by default. Before starting the debugger it's necessary to load both executable files into your MCU memory. This could be easily achieved in S32DS (GDB) debug configuration where you specify to add the additional object files. In this specific case we need just 1 additional file - bootloader elf. The bootloader project in this example is actually another project in the same workspace (workspace relative path to elf file entered). After starting debugger the Debugger Console view now shows the details about programming of two elf files instead of one including load address of each section. When loading is finished the debug information for bootloader is not yet available ("No source available..." message displayed in the source level debug view) In order to display source and symbols for the bootloader elf please enter "add-symbol-file"  GDB command into Debugger Console View: add-symbol-file "C:/Users/NXA21306/workspaceS32DS.ARM.2018.R1/s32K144_Bootloader/Debug/s32K144_Bootloader.elf" 0x0000000‍‍‍‍‍ The GDB client command could be executed automatically when launching a debug session: The first argument is path to the elf file and the second argument (0x00000000) is the load address of the elf file (see the first bootloader load address ). Finally the debug session needs to be refreshed in order to display changes from just added symbol file. The refresh can be forced by performing a single step or issuing the target reset from the debugger.
View full article
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).   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. Change the debug configuration name and press "Apply" 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.   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  Click on debug button and as soon as the debug session is established check the DFLASH memory space in the Memory View
View full article
Condition:  I am trying FreeRTOS using S32K118 EVB and run in DEBUG mode. When I set the break point in vTaskDelay and press Resume for the first time, there is a smooth stop at the break point. The second time I press Resume, the debugger should enter the same break point again, but there is no response. Then I press Suspend and can't press Resume again, at this point I can only leave. However, I am free to run this project with no problem, what's wrong? Analysis: This is due to an access of DDR memory region which is not initialized by default project settings. Solution: To resolve it, a macro initializing the DDR memory should be selected to run at the beginning of a debug session. A user should go to Advanced Options dialog and check "Enable initialization script". Our DDR init macros can be found at the following location within S32DS3.2 layout: eclipse\plugins\com.pemicro.debug.gdbjtag.pne_4.2.8.201909091700\win32\gdi\P&E\supportFiles_ARM\NXP\S32Vxxx\S32V234M100_DDR3_EVB29288.mac. Please note that the type of the macro might depend on the revision of the board and S32V23x device one is working with. I am also attaching a picture of debug configuration and Advanced Options dialog with all the settings in place.
View full article
Condition: Enable Stopindebug bit for PIT and STM module. Counter could be stop when debug project, but when i set debug mode on, counter not count, project can't be run. Analysis: In order for PIT timer to count when a FRZ bit is enabled, all cores on S32V23x devices need to be running. The reason why it does not work out of the box with current plugin configuration, is because we halt all device cores, which is especially necessary for RAM based projects. Solution: We created a start-up macro to keep all cores running when S32V232M80 or S32V234M100 debug sessions are launched. In order to use it, please go to the following directory without your S32DS3.2 IDE: eclipse\plugins\com.pemicro.debug.gdbjtag.pne_4.2.8.201909091700\win32\gdi\P&E\supportFiles_ARM\NXP\S32Vxxx. Please rename S32V234M100_All_Cores_Running.mac or S32V232M80_All_Cores_Running.mac to default macro names, saving existing default macros in renamed form, or a separate location: S32V234M100.mac or S32V232M80.mac.separate location: S32V234M100.mac or S32V232M80.mac.
View full article
The following article describes how to add FreeRTOS thread aware debugging to the Eclipse Debug view using SEGGER J-Link: Show FreeRTOS Threads in Eclipse Debug View with SEGGER J-Link and NXP S32 Design Studio | MCU on Eclipse  I hope this is useful, Erich
View full article
PE Micro is not able erase unused FLASH block - typically if your application resist in Large block and Low/Mid block is used for data storage. As a workaround you can flash empty s-record into desired area.  Create new empty project for MPC5777C for flashing custom .srecord Copy empty s-record (in attachment) into project folder. If you need different address range or s-record values - feel free modify attached python script and generate your own s-record.  Open debug configuration and modify C/C++ Application to empty s-record Add custom flash algorithm nxp_mpc5777c_1x32x64k_eeprom_highspeed.pcp via Debug -> Advanced Options. Scripts are lcated in [S32DS_INSTALL_DIR]\eclipse\plugins\com.pemicro.debug.gdbjtag.ppc_1.7.3.201803261737\win32\gdi\P&E\ Start debug session. You can check if memory is rewritten properly (in this case I write zeroes to Low/Mid block): 
View full article
The ability to reset target MCU via debugger (also known as "in-target reset") is one of the essential feature when it comes to e.g. debugging of a code that is getting into an Exception/Fault Handler or situations like "...why my code works fine in the debugger, but fails without debug..." S32 Design Studio offers this feature for all Pemicro debug interfaces (Multilink Universal/FX, OpenSDA) and it is available in all S32 Design studio flavors (S32DS ARM, S32DS Power, S32DS Vision) Reset button icon is active only in the active debug session (debug perspective) and in the root debug context only.  By default the reset icon is inactive during project debugging: To activate the reset icon change the Debug view context to the root one. After reset is completed the execution stops at the application reset vector and the information about reset that has just occurred is displayed in GDB server console. It is also possible to execute initialization script (.mac) which is triggered by the reset action. The reset script can be selected in the  Debug Configuration (Debugger Tab -> Advanced Options -> Enable Initialization Script) For more information about initialization scripting capabilities please contact www.pemicro.com
View full article
Perhaps you are just using the S32DS for Power for the first time, and maybe you've seen the provided examples and want to learn a bit more about how they were created. Here are the steps to create a simple application for the MCP5748G MCU which toggles a pin causing one of the user LEDs to blink. This example includes use of the S32 SDK for Power Architecture. Please note: There are options in the steps below to cover the case of either the DEV-KIT(DEVKIT-MPC5748G) or Motherboard(X-MPC574XG-MB) with Daughtercard(X-MPC574XG-324DS) hardware EVBs. 1) Launch S32DS for Power 2) Select File -> New -> New S32DS Project 3) Enter a name for the project, such as 'BlinkingLED' 4) Locate, from the list of processors, Family MPC574xG -> MPC5748G, and select it. 5) Click Next 6) Uncheck the boxes for cores e200z4 and e200z2, leaving just e200z4 (boot) checked. This is because the application will run on the boot core and will not use either of the other two cores. 7) Click on the '…' button next to SDKs, in the column for BlinkingLED_Z4_0. 😎 Check the box next to MPC5748G_SDK_Z4_0_GCC to include support for the SDK within the new project and for the core we have selected. 9) Click OK 10) Click Finish to close the New Project wizard window and start the project generation. 11) Wait a minute or two for the project generation script to complete. 12) Go to the 'Components Library' view then locate and double-click on 'pit' component to add it to the project.  Alternatively, right-click and select Add to project. You can verify it was added by inspecting the 'Components - <project_name>' view. 13) With 'pit' selected in the 'Components - BlinkingLED_Z4_0' view, go to the 'Component Inspector' view to see the configurations for the PIT component. Locate the section for 'Configuration 0'. You may have to scroll down to see it. Change the 'Time period' setting to 500000 microsec(0.5 sec). Note that we are editing the settings for Clock configuration 'clockMan_InitConfig0', you will need the name of this configuration later. 14) Back in the 'Components' view, select 'pin_mux' component and return to the 'Component Inspector' view 15) From the 'Routing' tab, select the 'SIUL2' sub-tab and scroll down the Signals list until 'GPIO_0' (DEV-KIT) or 'GPIO_99' (Motherboard) is shown. 16) Change to the following settings: a. Pin/Signal Selection: PA[0] (DEV-KIT) / PG[3] (Motherboard) b. Direction: Output Pin PA0/PG3 is connected to user LED 2 on the evaluation board. 17) All configuration settings are now complete. Click Generate Processor Expert code button in the 'Components' view or use the menu bar Project-> Generate Processor Expert Code. 18) Wait for the code generation to complete. 19) Now, from the 'Project Explorer' view, the generated code is visible in the folder 'Generated_Code' of the project 'BlinkingLED_Z4_0'. 20) If not already open, in 'Project Explorer' open the file 'BlinkngLED_Z4_0\Sources\main.c' by double-click. This will open the file in the editor view. 21) Scroll down until the following comments are shown: /* Write your code here */ /* For example: for(;;) { } */ We need to add some code here to initialize the clocks, timers and pins. Then we will setup a timer interrupt handler to toggle the pin. 22) First we need to initialize the clocks. From the 'Components' view, expand 'clock_manager' and then drag & drop CLOCK_DRV_Init function into main() of main.c, just after the comments identified in the previous step within the text editor view. 23) Add to the function CLOCK_DRV_Init(), the parameter &clockMan1_InitConfig0 to give it the address of the user configuration structure generated by ProcessorExpert in '.../Generated_Code/clockMan1.c'. This is the clock configuration for which we edited the timer period in an earlier step. 24) Next we need to initialize the pins. Back in the 'Components' view, expand the 'pin_mux' then drag and drop the function PINS_DRV_Init after the clock initialization. 25) Again from the 'Components' view, expand 'interrupt_manager', then drag & drop INT_SYS_InstallHandler in 'main()'. This installs the PIT channel 0 interrupt handler. 26) Enter the parameters: PIT_Ch0_IRQn, &pitCh0Handler, NULL 27) In the User includes section at the start of main.c, add the implementation of the handler a. Create a function called pitCh0Handler b. In the function body: clear the interrupt flag and toggle LED   /* IRQ handler for PIT ch0 interrupt */   void pitCh0Handler(void)   { /* Clear PIT channel 0 interrupt flag */ PIT_DRV_ClearStatusFlags(INST_PIT1, 0U); /* Toggle LED (GPIO 0 connected to user LED 2) */ SIUL2->GPDO[0] ^= SIUL2_GPDO_PDO_4n_MASK; // DEV-KIT /* SIUL2->GPDO[99/4] ^=SIUL2_GPDO_PDO_4n3_MASK;*/ // Motherboard   } Note: Get PIT_DRV_ClearStatusFlags by drag & drop from the 'pit' component. 28) In 'Components' view, expand 'pit' component and then drag & drop PIT_DRV_Init, PIT_DRV_InitChannel & PID_DRV_StartChannel in main() after INT_SYS_InstallHandler(). 29) Fill in the second parameter of the last function(channel number): 0U 30) Build the code. Click the down arrow next to the 'Build' button and select Debug_RAM. Check that there are no build errors. 31) Enter the 'Debug Configurations' menu: a. From the menu bar, Run -> Debug Configurations... b. From the toolbar, down arrow next to Debug button -> Debug Configurations... 32) The Debug Configurations window appears. Select the configuration BlinkingLED_Z4_0_Debug_RAM from within the GDB PEMicro Interface Debugging group. 33) Select the 'Debugger' tab to setup the connection to the debugger hardware device. 34) Select the PEMicro Interface which corresponds to your setup: a. If using the motherboard, you will likely use the USB Multilink, which is connected to your PC via USB cable (type A on one end, type B on the other) and is connected to the motherboard via the 14-pin JTAG cable. b. If using the DEV-KIT board, you will likely choose the OpenSDA, which is integrated into the DEV-KIT board and is connected with just a USB cable (type A on one end, type micro on the other). 35) Click Debug To launch the debugging session. This will also open the Debug perspective. 36) In the Debug perspective, once the debugging session has fully launched, the code will be executed to the start of main(), where a breakpoint was automatically set for you. Press Resume button in the toolbar, Run -> Resume in the menu bar, or F8 on your keyboard to run the application. 37) You should now see the User LED2 on the board blink every 0.5 seconds. 38) To see the value of the output register bit for the output pin connected to the LED: a. Set a breakpoint on a line within pitCh0Handler() b. Go to the EmbSys Registers view, expand the SIUL2 module and scroll down to the GPDO register index which is accessed in the code. Double-click it to read the value. Expand it to see the individual bits. c. Press Resume a few times to see the register value change
View full article
NOTICE: This may NOT work with the newer versions of PEmicro eclipse plugin (e.g. with S32DS for Power 2017.R1). Please use an alternative way described here: https://community.nxp.com/thread/486662?commentID=1068206#comment-1068206 This document describes how to program DCF record into UTEST flash with S32DS for Power v1.1+ using PEMICRO Probe (OpenSDA, USB Multilink, USB Multilink FX...) In  S32 Design Studio for Power v1.2+  the Pemicro plugin update step is not required since it's already included so you can skip  Step 1) Step 1) Update Pemicro 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" Step 2) Download and extract Flash programming algorithms for MPC5xxx directly from PEMICRO website into your computer. http://www.pemicro.com/downloads/download_file.cfm?download_id=422 Step 3) Create or reuse an existing S32DS project to connect to the board and inspect the existing content of UTEST/DCF user area memory section. See e.g. MPC5644P example below. Next available address for DCF record of this specific chip is 0x0040_0220 .. 0x0040_0227   Step 3a)  You can export this 64bit free region into a srecord file e.g. MyNewDCF.srec Step 3b)  Adjust Srecord file created to match with DCF record you intend to write. Don't forget to re-calculate Srec checksum. e.g. NOP 0x00000000 00000000   S3 0D 004002200 0000 0000 0000 0000 90 Step 4) Create/clone an existing debugger configuration that will load DCF into UTEST and adjust its parameters. Step 4a) Change the debugger configuration Name and enter the srecord path + file name adjusted in step 3b) as a C/C++ application. Step 4b) Debugger Tab -> Advanced Options - select Use Alternative Algorithm and browse the location where you extracted flash algorithms at step 2)  E.g. Freescale_MPC5744P_1x32x4k_UTest.pcp Step 4c)  Adjust Startup options - Disable Load Symbols and Run on Reset since this configuration is only for programming DCF record and not for debugging. Step 5) Now press Debug button and it should program your DCF record into UTEST flash memory. After debug session is established you can check if the DCF has been programmed correctly into DCF user area in Memory View. Note: The device will process these DCF records during the system reset sequence before the CPU leaves reset.
View full article
This document contains the instructions how to download separate elf/srec/hex file to the microcontroller using S32 Design Studio and USB PE Micro Universal Multilink/OpenSDA debug probes. This could be used in case you get an executable/binary image file only without any project or source code. There are basically three ways: flash programming support in IDE. This is only useful for programming the device. (it is available in S32DS ARM v1.3+, S32DS Power v1.2+) Create a new configuration, adjust its name and browse for elf/srec/hex file: Select MCU and specific core you are targeting: Select where the Flash Configuration should be saved into - workspace metadata (local file) or as a specific file e.g. part of an existing project (shared file). This way the config could be e.g.transferred with this project. Click on "Flash" button to proceed to programming. As soon as the device is programmed it's disconnected. 2. Executable file importer. Go to menu File -> Import -> Select "Executable File Importer"  this starts the wizard. This is for programming and debugging an executable elf object file only. Select the MCU/core you are targeting and browse for the .elf file Adjust the project name and create a debug/launch configuration (PEMicro GDB server example). If the .elf file is built on another machine and the source files are available but located in a different folder the source path could be adjusted. Source-level debugging is then possible. Finish the wizard and new "container" project for your elf is created. Its debug configuration opens automatically. "Debug" button starts the load/debug of the selected elf file. 3. reuse an existing project debug configuration or create a new dummy project for loading .elf/srec/hex Create new project which will provide basic debug settings Compile the project Copy the required .elf file to the created project Debug folder Open new project Debug configuration Choose correct project and set the correct .elf/srec/hex you want to download Click Apply button and then Debug button. The debug window with correct .elf file will be opened. Program is downloaded and you are able to debug or run it.
View full article