Trace with SWO or buffer and STM32MP257F (Cortex M33) using J-trace

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Trace with SWO or buffer and STM32MP257F (Cortex M33) using J-trace

      I have an STM32Mp257F board with a MIPI 10 connector for debug. If I attach this to my J-Trace by using the left half of the MIPI 20 cable, I am able to debug with Ozone successfully. :thumbup:

      The hope for this setup is to be able to do any sort of instruction tracing. I have tried many combinations of trace settings, both with the J-Trace connected as JTAG and SWD, yet nothing seems to work. I do not expect "trace pins" to be a viable option due to their not being present on the MIPI 10 connector. Would that configuration be expected to work if I had a MIPI 20 on an STM32MP257F board?

      The M33 is running at 400 MHz. Is there some sort of enable that needs to happen in a script or in the firmware? What is expected to work?

      Hoping for any tips! ?(
    • Hello,

      Thank you for your inquiry.

      For buffer tracing the MIPI10 connector is typically sufficient.
      However your target device has to meet certain requirements for buffer tracing to work:
      kb.segger.com/Arm_trace_techni…Required_trace_components

      If your target device meets these requirements it is typically sufficient to set the trace source in Ozone to "Trace Buffer".

      With some multi core target devices it may be additionally needed to set the base addresses for the Coresight components that the J-Trace Pro could not autodetect:
      kb.segger.com/Arm_trace_techni…f_trace_components_failed

      Regarding SWO. On more complex devices is it usually required to init the device/board specific SWO pin via a .JLinkScript.
      kb.segger.com/SWO

      In Ozone currently only SWO/ITM printf via stimulus ports is available.
      Instruction tracing via SWO pin is on our wish list but without a fix timeschedule.

      Best regards,
      Nino
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • New

      Thank you for your response. I am trying to specify the location of the ETF using your link here:

      Nino wrote:

      With some multi core target devices it may be additionally needed to set the base addresses for the Coresight components that the J-Trace Pro could not autodetect:
      kb.segger.com/Arm_trace_techni…f_trace_components_failed
      Once I include the init script, the M33 core is no longer detected.



      init script wrote:

      /*********************************************************************
      *
      * Global functions
      *
      **********************************************************************
      */

      /*********************************************************************
      *
      * ConfigTargetSettings()
      *
      * Function description
      * Called before InitTarget(). Mainly used to set some global DLL variables to customize the normal connect procedure.
      * For ARM CoreSight devices this may be specifying the base address of some CoreSight components (ETM, ...)
      * that cannot be automatically detected by J-Link due to erroneous ROM tables etc.
      * May also be used to specify the device name in case debugger does not pass it to the DLL.
      *
      * Return value
      * >= 0 O.K.
      * < 0 Error
      *
      * Notes
      * (1) May not, under absolutely NO circumstances, call any API functions that perform target communication.
      * (2) Should only set some global DLL variables
      */
      int ConfigTargetSettings(void) {
      //
      // Device has a broken ROM table so Coresight modules can not be identified by the DLL
      // That is why they are added through exec commands below.
      //
      // For a full list of all addable coresight components, please refer to [2].
      //
      JLINK_SYS_Report("Adding CORESIGHT components missing from ROM table");
      JLINK_ExecCommand("CORESIGHT_SetETBBaseAddr = 0x5A030000");
      //
      // Examples:
      // 1) ETB missing in ROM Table, but present at address 0x5401B000:
      // JLINK_ExecCommand("CORESIGHT_SetETBBaseAddr = 0x5401B000");
      // 2) ETM missing in ROM Table, but present at address 0x54010000:
      // JLINK_ExecCommand("CORESIGHT_SetETMBaseAddr = 0x54010000");
      //
      return 0;
      }
      /*************************** end of file ****************************/

      Ozone Log wrote:

      Disabled output of control characters
      SEGGER Ozone - The J-Link Debugger V3.38g
      J-Link software found at: /opt/SEGGER/Ozone_V338g/Lib/libjlinkarm.so
      File.NewProject();
      Tools.JLinkSettings();
      J-Link settings were written to the project file.
      Target core support plugin loaded.: /opt/SEGGER/Ozone_V338g/Plugins/Core/CorePluginARM.so
      Project.SetDevice ("STM32MP257F_M33");
      Debug.SetConnectMode (CM_ATTACH);
      Debug.Start();
      Executed J-Link command "SetSkipInitECCRAMOnConnect=1"
      Executed J-Link command "ForceAttachTarget=1"
      Device "STM32MP257F_M33" selected.
      ConfigTargetSettings() start
      ConfigTargetSettings() end - Took 8us
      TotalIRLen = 9, IRPrint = 0x0011
      JTAG chain detection found 2 devices:
      #0 Id: 0x6BA00477, IRLen: 04, CoreSight JTAG-DP
      #1 Id: 0x26505041, IRLen: 05, Unknown device
      DPv0 detected
      AP map detection skipped. Manually configured AP map found.
      AP[0]: APB-AP (IDR: Not set, ADDR: 0x00000000)
      AP[1]: AHB-AP (IDR: Not set, ADDR: 0x00000000)
      AP[2]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
      AP[3]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
      AP[4]: AXI-AP (IDR: Not set, ADDR: 0x00000000)
      AP[5]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
      AP[6]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
      AP[7]: MEM-AP (IDR: Not set, ADDR: 0x00000000)
      AP[8]: AHB-AP (IDR: Not set, ADDR: 0x00000000)
      AP[8]: Core found
      AP[8]: AHB-AP ROM base: 0xE00FE000
      CPUID register: 0x411FD210. Implementer code: 0x41 (ARM)
      Feature set: Mainline
      Cache: No cache
      Found Cortex-M33 r1p0, Little endian.
      Cortex-M: The connected J-Link (S/N 752000965) uses an old firmware module: V2 (current is 3)
      Cortex-M (ARMv8-M and later): The connected J-Link (S/N 752000965) uses an old firmware module that does not handle I/D-cache correctly. Proper debugging functionality cannot be guaranteed if cache is enabled
      FPUnit: 8 code (BP) slots and 0 literal slots
      Security extension: not implemented
      CoreSight components:
      ROMTbl[0] @ E00FE000
      [0][0]: E00FF000 CID B105100D PID 000BB4C9 ROM Table
      ROMTbl[1] @ E00FF000
      [1][0]: E000E000 CID B105900D PID 000BBD21 DEVARCH 47702A04 DEVTYPE 00 Cortex-M33
      [1][1]: E0001000 CID B105900D PID 000BBD21 DEVARCH 47701A02 DEVTYPE 00 DWT
      [1][2]: E0002000 CID B105900D PID 000BBD21 DEVARCH 47701A03 DEVTYPE 00 FPB
      [1][3]: E0000000 CID B105900D PID 000BBD21 DEVARCH 47701A01 DEVTYPE 43 ITM
      [1][5]: E0041000 CID B105900D PID 002BBD21 DEVARCH 47724A13 DEVTYPE 13 ETM
      [1][6]: E0042000 CID B105900D PID 000BBD21 DEVARCH 47701A14 DEVTYPE 14 CSS600-CTI
      Connected to target device.
      J-Link/J-Trace serial number: 752000965
      File.Open: completed in 269 ms
      Program segments:
      Address Size Code RO Data RW Data ZI Data Flg
      --------- --------- --------- --------- --------- --------- ---
      80100000 1 344 0 1 344 0 0 R
      80100580 2 776 2 776 0 0 0 R E
      10101058 609 340 609 028 312 0 0 R E
      80A00000 427 824 0 0 148 384 279 440 RW
      81200000 140 0 0 140 0 RW
      80A1C298 0 0 0 0 0 R
      --------- --------- --------- --------- --------- --------- ---
      Total: 1 041 424 611 804 1 656 148 524 279 440
      --------- --------- --------- --------- --------- --------- ---
      For further information on ELF file data sections, execute command Elf.PrintSectionInfo(0).
      Debug.ReadIntoInstCache: updated instruction information within 2 code ranges (0x10101058-0x80101058)
      RTT active
      File.Open ("/home/swgroup/ES1/lab/ats-epoch-coprocessor/ats-epoch-coprocessor/output/cortex-m33-tuxmobile-debug/Epoch/Epoch");
      158 source files not found
      Executed J-Link command "SetRTTAddr 0x80a601f0"
      Debug.Halt();
      Startup complete (PC=0x1012C998)
      Debug.Continue();
      Memory map 'after startup completion point' is active
      Tools.JLinkSettings();
      Debug.Stop();
      Disconnected from target device.


      [disconnected, specified script and reconnected]


      Debug.Start();
      Executed J-Link command "ScriptFile=/home/swgroup/VM_SHARE/Template_AddCompMissingInROMTable.JLinkScript"
      Executed J-Link command "SetSkipInitECCRAMOnConnect=1"
      Executed J-Link command "ForceAttachTarget=1"
      Device "STM32MP257F_M33" selected.
      ConfigTargetSettings() start
      Adding CORESIGHT components missing from ROM table
      ConfigTargetSettings() end - Took 37us
      TotalIRLen = 9, IRPrint = 0x0011
      JTAG chain detection found 2 devices:
      #0 Id: 0x6BA00477, IRLen: 04, CoreSight JTAG-DP
      #1 Id: 0x26505041, IRLen: 05, Unknown device
      DPv0 detected
      Scanning AP map to find all available APs
      AP[2]: Stopped AP scan as end of AP map seems to be reached
      AP[0]: APB-AP (IDR: 0x54770002, ADDR: 0x00000000)
      AP[1]: AHB-AP (IDR: 0x84770001, ADDR: 0x01000000)
      Iterating through AP map to find AHB-AP to use
      AP[0]: Skipped. Not an AHB-AP
      AP[1]: Skipped. No ROM table (AHB-AP ROM base: 0x00000002)
      Attach to CPU failed. Executing connect under reset.
      DPv0 detected
      Scanning AP map to find all available APs
      AP[0]: Stopped AP scan as end of AP map seems to be reached
      Iterating through AP map to find AHB-AP to use
      Could not find core in Coresight setup
      Connect failed. Resetting via Reset pin and trying again.
      ConfigTargetSettings() start
      Adding CORESIGHT components missing from ROM table
      ConfigTargetSettings() end - Took 15us
      TotalIRLen = 9, IRPrint = 0x0011
      JTAG chain detection found 2 devices:
      #0 Id: 0x6BA00477, IRLen: 04, CoreSight JTAG-DP
      #1 Id: 0x26505041, IRLen: 05, Unknown device
      DPv0 detected
      Scanning AP map to find all available APs
      AP[2]: Stopped AP scan as end of AP map seems to be reached
      AP[0]: APB-AP (IDR: 0x54770002, ADDR: 0x00000000)
      AP[1]: AHB-AP (IDR: 0x84770001, ADDR: 0x01000000)
      Iterating through AP map to find AHB-AP to use
      AP[0]: Skipped. Not an AHB-AP
      AP[1]: Skipped. No ROM table (AHB-AP ROM base: 0x00000002)
      Attach to CPU failed. Executing connect under reset.
      Failed to power up DAP
      ConfigTargetSettings() start
      Adding CORESIGHT components missing from ROM table
      ConfigTargetSettings() end - Took 27us
      TotalIRLen = 9, IRPrint = 0x0011
      JTAG chain detection found 2 devices:
      #0 Id: 0x6BA00477, IRLen: 04, CoreSight JTAG-DP
      #1 Id: 0x26505041, IRLen: 05, Unknown device
      DPv0 detected
      Scanning AP map to find all available APs
      AP[2]: Stopped AP scan as end of AP map seems to be reached
      AP[0]: APB-AP (IDR: 0x54770002, ADDR: 0x00000000)
      AP[1]: AHB-AP (IDR: 0x84770001, ADDR: 0x01000000)
      Iterating through AP map to find AHB-AP to use
      AP[0]: Skipped. Not an AHB-AP
      AP[1]: Skipped. No ROM table (AHB-AP ROM base: 0x00000002)
      Attach to CPU failed. Executing connect under reset.
      Failed to power up DAP
      Connect failed. Resetting via Reset pin and trying again.
      ConfigTargetSettings() start
      Adding CORESIGHT components missing from ROM table
      ConfigTargetSettings() end - Took 21us
      TotalIRLen = 9, IRPrint = 0x0011
      JTAG chain detection found 2 devices:
      #0 Id: 0x6BA00477, IRLen: 04, CoreSight JTAG-DP
      #1 Id: 0x26505041, IRLen: 05, Unknown device
      DPv0 detected
      Scanning AP map to find all available APs
      AP[2]: Stopped AP scan as end of AP map seems to be reached
      AP[0]: APB-AP (IDR: 0x54770002, ADDR: 0x00000000)
      AP[1]: AHB-AP (IDR: 0x84770001, ADDR: 0x01000000)
      Iterating through AP map to find AHB-AP to use
      AP[0]: Skipped. Not an AHB-AP
      AP[1]: Skipped. No ROM table (AHB-AP ROM base: 0x00000002)
      Attach to CPU failed. Executing connect under reset.
      Failed to power up DAP
      Connection failed.