Hi all,

I'm attempting to get Zephyr working on the M4 core of an STM32H755. I'm using 
an ST-Link v3set on Windows 11 with OpenOCD v. 0.12.0.

I am able to flash a compiled binary via OpenOCD, but I have so far been unable 
to get to a place where I can debug the second core. I started based on the 
example OpenOCD configs for the STM32H745 and H747 and attempted to build a 
configuration file (see below). I've also included my OpenOCD invocation and a 
clip from my logs. Has anyone been able to debug the M4 core (CPU1) on a 
dual-core STM32H7?

source [find interface/stlink-dap.cfg]

transport select "dapdirect_swd"

set DUAL_CORE 1

source [find target/stm32h7x_dual_bank.cfg]

targets stm32h7x.cpu1

# Use connect_assert_srst here to be able to program
# even when core is in sleep mode
reset_config srst_only srst_nogate connect_assert_srst

$_CHIPNAME.cpu0 configure -event gdb-attach {
        echo "Debugger attaching: halting execution"
        gdb_breakpoint_override hard
}

$_CHIPNAME.cpu1 configure -event gdb-attach {
        echo "Debugger attaching: halting execution"
        gdb_breakpoint_override hard
}

$_CHIPNAME.cpu0 configure -event gdb-detach {
        echo "Debugger detaching: resuming execution"
        resume
}

$_CHIPNAME.cpu1 configure -event gdb-detach {
        echo "Debugger detaching: resuming execution"
        resume
}

# Due to the use of connect_assert_srst, running gdb requires
# to reset halt just after openocd init.
rename init old_init
proc init {} {
        old_init
        reset halt
}


I then invoke OpenOCD with: -s  ${project_loc}\..\boards\arm\stm32h755\support 
-f openocd.cfg -d

The end of my logs look like:
Debug: 523 827 cortex_m.c:589 cortex_m_endreset_event(): [stm32h7x.cpu0] 
DCB_DEMCR = 0x01000501
Debug: 524 827 stlink_usb.c:4338 stlink_usb_misc_rw_segment(): Queue: 2 
commands in 4 items
Debug: 525 828 target.c:2720 target_write_u32(): address: 0xe0002000, value: 
0x00000003
Debug: 526 828 stlink_usb.c:4338 stlink_usb_misc_rw_segment(): Queue: 2 
commands in 5 items
Debug: 527 832 target.c:2632 target_read_u32(): address: 0xe0002000, value: 
0x10000081
Debug: 528 832 target.c:2720 target_write_u32(): address: 0xe0002008, value: 
0x00000000
Debug: 529 833 target.c:2720 target_write_u32(): address: 0xe000200c, value: 
0x00000000
Debug: 530 834 target.c:2720 target_write_u32(): address: 0xe0002010, value: 
0x00000000
Debug: 531 837 target.c:2720 target_write_u32(): address: 0xe0002014, value: 
0x00000000
Debug: 532 837 target.c:2720 target_write_u32(): address: 0xe0002018, value: 
0x00000000
Debug: 533 838 target.c:2720 target_write_u32(): address: 0xe000201c, value: 
0x00000000
Debug: 534 839 target.c:2720 target_write_u32(): address: 0xe0002020, value: 
0x00000000
Debug: 535 840 target.c:2720 target_write_u32(): address: 0xe0002024, value: 
0x00000000
Debug: 536 841 target.c:2720 target_write_u32(): address: 0xe0001020, value: 
0x00000000
Debug: 537 842 target.c:2720 target_write_u32(): address: 0xe0001024, value: 
0x00000000
Debug: 538 845 target.c:2720 target_write_u32(): address: 0xe0001028, value: 
0x00000000
Debug: 539 846 target.c:2720 target_write_u32(): address: 0xe0001030, value: 
0x00000000
Debug: 540 846 target.c:2720 target_write_u32(): address: 0xe0001034, value: 
0x00000000
Debug: 541 848 target.c:2720 target_write_u32(): address: 0xe0001038, value: 
0x00000000
Debug: 542 850 target.c:2720 target_write_u32(): address: 0xe0001040, value: 
0x00000000
Debug: 543 853 target.c:2720 target_write_u32(): address: 0xe0001044, value: 
0x00000000
Debug: 544 856 target.c:2720 target_write_u32(): address: 0xe0001048, value: 
0x00000000
Debug: 545 857 target.c:2720 target_write_u32(): address: 0xe0001050, value: 
0x00000000
Debug: 546 859 target.c:2720 target_write_u32(): address: 0xe0001054, value: 
0x00000000
Debug: 547 859 target.c:2720 target_write_u32(): address: 0xe0001058, value: 
0x00000000
Debug: 548 863 target.c:3290 target_wait_state(): waiting for target halted...
Error: 549 1864 target.c:3298 target_wait_state(): timed out while waiting for 
target halted
Debug: 550 1864 command.c:155 script_debug(): command - stm32h7x.cpu0 curstate
Debug: 551 1865 command.c:544 run_command(): Command 'reset' failed with error 
code -4
User : 552 1865 command.c:608 command_run_line(): TARGET: stm32h7x.cpu0 - Not 
halted
in procedure 'init'
Debug: 553 1865 mem_ap.c:71 mem_ap_deinit_target(): mem_ap_deinit_target
Debug: 554 1865 arm_adi_v5.c:1120 dap_put_ap(): refcount AP#0x2 put 0
Debug: 555 1865 target.c:2203 target_free_all_working_areas_restore(): freeing 
all working areas
Debug: 556 1865 arm_adi_v5.c:1120 dap_put_ap(): refcount AP#0x0 put 0
Debug: 557 1865 target.c:2203 target_free_all_working_areas_restore(): freeing 
all working areas
Debug: 558 1866 arm_adi_v5.c:1120 dap_put_ap(): refcount AP#0x3 put 0
Debug: 559 1866 target.c:2203 target_free_all_working_areas_restore(): freeing 
all working areas
Debug: 560 1867 stlink_usb.c:5116 stlink_dap_quit(): stlink_dap_quit()
Debug: 561 1868 stlink_usb.c:1659 stlink_usb_exit_mode(): MODE: 0x02
________________________________
NOTICE OF CONFIDENTIALITY:
This message may contain information that is considered confidential and which 
may be prohibited from disclosure under applicable law or by contractual 
agreement. The information is intended solely for the use of the individual or 
entity named above. If you are not the intended recipient, you are hereby 
notified that any disclosure, copying, distribution or use of the information 
contained in or attached to this message is strictly prohibited. If you have 
received this email transmission in error, please notify the sender by replying 
to this email and then delete it from your system.


Reply via email to