Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

search inside this forum
Multi-core debugging with a single elf
Kfir B. Jun 29, 2016 at 01:07 AM (01:07 hours)
Staff: Takao Y.

  • Hi,

    I'm trying to use S32 to debug my code which runs on two cores of NXP MPC5748G,
    But I cannot seem to run the code on both cores. I use a single elf file
    in order to flash the CPU and would expect the probe to separate between the two after setting the core to be Z4_1 for a second configuration and running a group.


    What am I missing?




    Comments

  • Greetings,

    First, try creating a new project for the MPC5748G within S32 and make sure to have a project created for each core. Without making any changes to code, attempt to flash program and debug the default project. Once you get that working, I think you will have a better idea how to get your single ELF file working.


    Takao Yamada

    • Thanks Takao,

      When doing this type of example project I have a group that is working with 3 debuggers, one for each elf of each example project.

      In my case, I have a single elf file!

  • Greetings,

    So running 3 separate ELF files work, so why don't you now modify the 3 projects to load your single ELF file. Make the changes in the debug configurations to get it working.


    Takao Yamada

  • The single elf file contains 2 cores and the bootloader checks the core it runs on and jumps to the relevant main loop of that core.

    When running the example with my elf file, I see that 1st core runs as expected, the second core does not, the 2nd core does not reach any breakpoint, and I cannot pause its run.

    The console in S32 for Z4_1 gives me the following:
    monitor preserve0 0
    monitor preserve1 0
    monitor preserve2 0
    No source file named \\mpc5748g\\src\\main.c.
    **
    NOTE that main.c is not the source I want to reach!
    **
    Continuing.
    continue

    Programming.
    Processing Object File Data ...

    Error during programming.
    Error Programming flash of device

    Error occured during Flash programming.

    Reset script file not found(C:\Freescale\S32_Power_v1.0\eclipse\plugins\com.pemicro.debug.gdbjtag.ppc_1.1.6.201511041643\win32\gdi\P&E\).

    PE-ERROR: Error downloading to the device.
    Preset breakpoint encountered.


    Connection from "127.0.0.1" via 127.0.0.1
    PE-ERROR: CAN'T READ REGISTERS. TARGET IS RUNNING
    Interrupt command received. Halting execution.

  • Greetings,

    One more thing you should change is within the "startup" tab in debug configurations, you should uncheck "load executable" on the second core, since the flash is already being programmed when it loads the first core. This should prevent double programming and not have that programming error you are seeing.


    Takao Yamada

  • Even with the correction of the load executable the second core still fails:

    Type "apropos word" to search for commands related to "word".
    monitor preserve0 0
    monitor preserve1 0
    monitor preserve2 0
    No source file named \\mpc5748g\\src\\main.c.
    continue
    Continuing.
    Note: automatically using hardware breakpoints for read-only addresses.
    Quit (expect signal SIGINT when the program is resumed)
    Quit (expect signal SIGINT when the program is resumed)



    while in the first core it runs well:

    Type "apropos word" to search for commands related to "word".
    monitor preserve0 0
    load C:\\projects\\ips-wrappers\\GatewayApp\\bin\\outputs\\GatewayApp-0.0.1.0.elf
    Loading section .rcw, size 0x18 lma 0xfc0000
    Loading section .sdata2, size 0x14 lma 0xfd0000
    Loading section .isrvectbl, size 0xbc8 lma 0xff0000
    Loading section .ctors, size 0x10 lma 0xff0bc8
    Loading section .dtors, size 0x8 lma 0xff0bd8
    Loading section .init, size 0x24 lma 0xff0be0
    Loading section .fini, size 0x24 lma 0xff0c04
    Loading section .hwio_text, size 0x198 lma 0xff0c28
    Loading section .text_vle, size 0x11050 lma 0xff0dc0
    Loading section .xcptn_core_0, size 0x100 lma 0x1001f00
    Loading section .xcptn_core_1, size 0x100 lma 0x1002000
    Loading section .xcptn_core_2, size 0xf4 lma 0x1002100
    Loading section .data, size 0x820 lma 0x10021f8
    Loading section .sdata, size 0x90 lma 0x1002a18
    Start address 0xff0c28, load size 76256
    Transfer rate: 141 KB/sec, 953 bytes/write.
    load \\App-0.0.1.0.elf
    Loading section .rcw, size 0x18 lma 0xfc0000
    Loading section .sdata2, size 0x14 lma 0xfd0000
    Loading section .isrvectbl, size 0xbc8 lma 0xff0000
    Loading section .ctors, size 0x10 lma 0xff0bc8
    Loading section .dtors, size 0x8 lma 0xff0bd8
    Loading section .init, size 0x24 lma 0xff0be0
    Loading section .fini, size 0x24 lma 0xff0c04
    Loading section .hwio_text, size 0x198 lma 0xff0c28
    Loading section .text_vle, size 0x11050 lma 0xff0dc0
    Loading section .xcptn_core_0, size 0x100 lma 0x1001f00
    Loading section .xcptn_core_1, size 0x100 lma 0x1002000
    Loading section .xcptn_core_2, size 0xf4 lma 0x1002100
    Loading section .data, size 0x820 lma 0x10021f8
    Loading section .sdata, size 0x90 lma 0x1002a18
    Start address 0xff0c28, load size 76256
    Transfer rate: 133 KB/sec, 953 bytes/write.
    monitor endmultiload
    Ignoring packet error, continuing...
    Ignoring packet error, continuing...
    Ignoring packet error, continuing...
    Ignoring packet error, continuing...
    monitor selectcore 0
    No source file named \\mpc5748g\\src\\main.c.
    continue
    Continuing.
    Note: automatically using hardware breakpoints for read-only addresses.

  • I cannot read the dissassmbly of the second core, it tells that the second core is suspended on user request and changed to Running on  user request, without me doing a thing.

  • Greetings,

    As you may know, the secondary cores need to be enabled by the primary core. So the problem may be that by the time the primary core reaches main, the secondary core has not been enabled yet and starting a debug session on it will cause failure.

    In the default project, you will find that within startup and before main is reached, the second core is enabled.

    Another thing you could try is first debug the first core and run past all initializations, then start a debug session on the second core. Make sure within debug configurations -> startup tab that the secondary cores should have "attach to running target" set. That way it does not try to erase and program again.


    Takao Yamada

  • Greetings,

    Any update on this?


    Takao Yamada

  • Greetings Takao,

    I have managed to load SW to the second core and start working with it.
    Thanks very much for the help.

    Kfir.

Add comment


   Want to comment? Please login or create a new PEMicro account.







© 2017 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement