Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for MCUs
  4. Debuging M4 core of STM32MP1 in QtCreator
QtWS25 Last Chance

Debuging M4 core of STM32MP1 in QtCreator

Scheduled Pinned Locked Moved Unsolved Qt for MCUs
1 Posts 1 Posters 643 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Valeologiya
    wrote on last edited by
    #1

    Hi everyone!
    I'm trying to setup debug environment for debugging Cortex M4 core of STM32MP1 in QtCreator. ST have made an instruction and in console everything works fine. https://wiki.st.com/stm32mpu/wiki/GDB
    The results from OpenOCD console:

    sergey@sergey-laptop:~/projects/developUTC/sandbox/build/blink-MYIR-M4-Debug$ /opt/st/myir/3.1-snapshot/sysroots/x86_64-ostl_sdk-linux/usr/bin/openocd -f /opt/st/myir/3.1-snapshot/sysroots/x86_64-ostl_sdk-linux/usr/share/openocd/scripts/board/stm32mp15x_dk2.cfg
    Open On-Chip Debugger 0.10.0+dev-01131-gb5d2b1224-dirty (2021-04-05-09:49)
    Licensed under GNU GPL v2
    For bug reports, read
    	http://openocd.org/doc/doxygen/bugs.html
    srst_only srst_pulls_trst srst_gates_jtag srst_open_drain connect_deassert_srst
    
    Info : Listening on port 6666 for tcl connections
    Info : Listening on port 4444 for telnet connections
    Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
    Info : Target voltage: 4.406299
    Info : Unable to match requested speed 5000 kHz, using 4000 kHz
    Info : Unable to match requested speed 5000 kHz, using 4000 kHz
    Info : clock speed 4000 kHz
    Info : stlink_dap_op_connect(connect)
    Info : SWD DPIDR 0x6ba02477
    Info : stlink_dap_op_connect(connect)
    Info : SWD DPIDR 0x6ba02477
    Info : stm32mp15x.cm4: hardware has 6 breakpoints, 4 watchpoints
    Info : stm32mp15x.cpu0: hardware has 6 breakpoints, 4 watchpoints
    Info : stm32mp15x.cpu1: hardware has 6 breakpoints, 4 watchpoints
    Info : starting gdb server for stm32mp15x.cpu0 on 3333
    Info : Listening on port 3333 for gdb connections
    Info : starting gdb server for stm32mp15x.cm4 on 3334
    Info : Listening on port 3334 for gdb connections
    Info : stm32mp15x.cm4: external reset detected
    Info : accepting 'gdb' connection on tcp/3334
    Error: timed out while waiting for target halted
    Error executing event gdb-attach on target stm32mp15x.cm4:
    
    Info : New GDB Connection: 1, Target stm32mp15x.cm4, state: reset
    Info : Halt timed out, wake up GDB.
    Warn : target not halted
    Info : target stm32mp15x.cm4 was not halted when resume was requested
    

    The results from the GDB console:

    sergey@sergey-laptop:~/projects/developUTC/sandbox/build/blink-MYIR-M4-Debug$ $GDB ./blink.elf 
    GNU gdb (GDB) 9.1
    Copyright (C) 2020 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "--host=x86_64-ostl_sdk-linux --target=arm-ostl-linux-gnueabi".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
        <http://www.gnu.org/software/gdb/documentation/>.
    
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from ./blink.elf...
    (gdb) target extended-remote localhost:3334
    Remote debugging using localhost:3334
    0x00000000 in g_pfnVectors ()
    (gdb) load
    Loading section .isr_vector, size 0x298 lma 0x0
    Loading section .text, size 0x7c0 lma 0x10000000
    Loading section .startup_copro_fw.Reset_Handler, size 0x50 lma 0x100007c0
    Loading section .rodata, size 0x8 lma 0x10000810
    Loading section .init_array, size 0x8 lma 0x10000818
    Loading section .fini_array, size 0x4 lma 0x10000820
    Loading section .data, size 0x43c lma 0x10000824
    Start address 0x100007c0, load size 3832
    Transfer rate: 187 KB/sec, 547 bytes/write.
    (gdb) thbreak main
    Hardware assisted breakpoint 1 at 0x10000242: file /home/sergey/projects/developUTC/sandbox/blink/main.c, line 36.
    (gdb) continue
    Continuing.
    target not halted
    target stm32mp15x.cm4 was not halted when resume was requested
    
    Program received signal SIGINT, Interrupt.
    main () at /home/sergey/projects/developUTC/sandbox/blink/main.c:36
    36	    HAL_Init();
    

    Now, I'm trying to setup this in the Creator and have problems. I've made a bare metal device. Set up right openocd path, openocd config and gdb from the sysroot.
    21822fee-d30e-47fc-8dac-8ad16b3a160f-image.png
    It's just a test configuration whit no meaningful commands, but on this stage already I have problems. When I start debugging I have this:

    17:47:15: Starting /opt/st/myir/3.1-snapshot/sysroots/x86_64-ostl_sdk-linux/usr/bin/openocd -c 'gdb_port 3333' -f /opt/st/myir/3.1-snapshot/sysroots/x86_64-ostl_sdk-linux/usr/share/openocd/scripts/board/stm32mp15x_dk2.cfg...
    17:47:16: Debugging starts
    Open On-Chip Debugger 0.10.0+dev-01131-gb5d2b1224-dirty (2021-04-05-09:49)
    Licensed under GNU GPL v2
    For bug reports, read
    	http://openocd.org/doc/doxygen/bugs.html
    srst_only srst_pulls_trst srst_gates_jtag srst_open_drain connect_deassert_srst
    
    Info : Listening on port 6666 for tcl connections
    Info : Listening on port 4444 for telnet connections
    Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
    Info : Target voltage: 4.428347
    Info : Unable to match requested speed 5000 kHz, using 4000 kHz
    Info : Unable to match requested speed 5000 kHz, using 4000 kHz
    Info : clock speed 4000 kHz
    Info : stlink_dap_op_connect(connect)
    Info : SWD DPIDR 0x6ba02477
    Info : stlink_dap_op_connect(connect)
    Info : SWD DPIDR 0x6ba02477
    Info : stm32mp15x.cm4: hardware has 6 breakpoints, 4 watchpoints
    Info : stm32mp15x.cpu0: hardware has 6 breakpoints, 4 watchpoints
    Info : stm32mp15x.cpu1: hardware has 6 breakpoints, 4 watchpoints
    Info : starting gdb server for stm32mp15x.cpu0 on 3333
    Info : Listening on port 3333 for gdb connections
    Info : starting gdb server for stm32mp15x.cm4 on 3334
    Info : Listening on port 3334 for gdb connections
    Info : accepting 'gdb' connection on tcp/3333
    Info : stm32mp15x.cpu0 rev 5, partnum c07, arch f, variant 0, implementor 41
    Info : stm32mp15x.cpu0: MPIDR level2 0, cluster 0, core 0, multi core, no SMT
    Info : stm32mp15x.cpu1 rev 5, partnum c07, arch f, variant 0, implementor 41
    Info : stm32mp15x.cpu1: MPIDR level2 0, cluster 0, core 1, multi core, no SMT
    target halted in ARM state due to debug-request, current mode: Supervisor
    cpsr: 0x60000093 pc: 0xc011b748
    MMU: enabled, D-Cache: enabled, I-Cache: enabled
    target halted in ARM state due to debug-request, current mode: Supervisor
    cpsr: 0x60030093 pc: 0xc011b748
    MMU: enabled, D-Cache: enabled, I-Cache: enabled
    Info : New GDB Connection: 1, Target stm32mp15x.cpu0, state: halted
    Error: data abort at 0x00000000, dfsr = 0x00000017
    uploaded
    uploadedError: data abort at 0x00000000, dfsr = 0x00000017
    Error: data abort at 0x00000000, dfsr = 0x00000017
    

    The reasons of the problems:

    1. There are two cores in the chip, and QtCreator always try to attach to the first.. Cortex A7 is the main core, has the debug port 3333 and shouldn't have been attached. The second core is Cortex M4. It has the debug port 3334 and we want to attach to it.
    2. QtCreator in some magic unvisible way execute the halt command, but this command shouldn't be executed.

    My questions are:

    1. Is there a way to force QtCreator and/or gdb to show everything what they do?
    2. Is there a way to make QtCreator to connect to the second core on the port 3334? Don't suggest setting up the right port, it will have another meaning.
    3. Is there a way to make QtCreator not to do the halt command?
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved