Hi,
I’m using Mbed Studio 1.3.1 on Windows 10 with the NUCLEO-L476RG. This target is not natively supported by the debugger.
In 1.3.0, in order to make it work, I had to :
- Manually download
Keil.STM32L4xx_DFP.2.5.0.pack
andKeil.STM32NUCLEO_BSP.1.7.0.pack
(Keil.STM32L4xx_DFP.2.3.0
coming with Mbed Studio does not work). - Fix the IRAM definitions in
Keil.STM32L4xx_DFP.2.5.0.pack
to avoid this error:
warning: Overlapping regions in memory map: ignoring
"0012839:ERROR:gdbserver:Unhandled exception in handle_message: individual memory accesses must not cross memory region boundaries"
- Create a custom target with the following options:
--target STM32L476RGTx --erase=chip --frequency 1800000 --pack Keil.STM32L4xx_DFP.2.5.0.pack --pack Keil.STM32NUCLEO_BSP.1.7.0.pack -O connect_mode=under-reset
- Work around the 49999 vs. 50000 port issue.
After upgrading to 1.3.1, the update of the internal tools was broken, so I had to uninstall, clean, and reinstall Mbed Studio.
In 1.3.1, the port issue is fixed, but:
- With
Keil.STM32L4xx_DFP.2.3.0
, I get:
Selected port 50000 for debugging
0000736:CRITICAL:__main__:Target type 'stm32l476rgtx' not recognized. Use 'pyocd list --targets' to see currently available target types. See for how to install additional target support.
Traceback (most recent call last):
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\board\board.py", line 61, in __init__
self.target = TARGET[self._target_type](session)
KeyError: 'stm32l476rgtx'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\__main__.py", line 362, in run
self._COMMANDS[self._args.cmd](self)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\__main__.py", line 676, in do_gdbserver
options=sessionOptions)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\helpers.py", line 242, in session_with_chosen_probe
return Session(probe, auto_open=auto_open, options=options, **kwargs)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\session.py", line 178, in __init__
self._board = probe.create_associated_board() \
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink_probe.py", line 111, in create_associated_board
return MbedBoard(self.session, board_id=self._board_id)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\board\mbed_board.py", line 67, in __init__
super(MbedBoard, self).__init__(session, target)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\board\board.py", line 67, in __init__
"for how to install additional target support." % self._target_type), exc)
File "", line 3, in raise_from
pyocd.core.exceptions.TargetSupportError: Target type 'stm32l476rgtx' not recognized. Use 'pyocd list --targets' to see currently available target types. See for how to install additional target support.
"GDB server stopped unexpectedly with exit code 1"
- With
Keil.STM32L4xx_DFP.2.5.0.pack
(patched or unpatched) andKeil.STM32NUCLEO_BSP.1.7.0.pack
with-O connect_mode=under-reset
or-O connect_mode=pre-reset
, I get:
Selected port 50000 for debugging
0000593:INFO:board:Target type is stm32l476rgtx
0000665:INFO:coresight_target:Asserting reset prior to connect
0000719:INFO:dap:DP IDR = 0x2ba01477 (v1 rev2)
0000797:INFO:ap:AHB-AP#0 IDR = 0x24770011 (AHB-AP var1 rev2)
0000802:INFO:rom_table:AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=020 part=415)
0000804:INFO:rom_table:[0]
0000806:INFO:rom_table:[1]
0000807:INFO:rom_table:[2]
0000808:INFO:rom_table:[3]
0000810:INFO:rom_table:[4]
0000811:INFO:rom_table:[5]
0000812:INFO:cortex_m:CPU core #0 is Cortex-M4 r0p1
0000816:INFO:dwt:4 hardware watchpoints
0000819:INFO:fpb:6 hardware breakpoints, 4 literal comparators
0000828:INFO:coresight_target:Deasserting reset post connect
0000837:INFO:server:Semihost server started on port 4444 (core 0)
0000838:INFO:gdbserver:GDB server started on port 50000 (core 0)
Exception in thread gdb-server-core0:
Traceback (most recent call last):
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 272, in run
self.target.halt()
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 683, in halt
self.write_memory(CortexM.DHCSR, CortexM.DBGKEY | CortexM.C_DEBUGEN | CortexM.C_HALT)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 640, in write_memory
self.ap.write_memory(addr, value, transfer_size)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink_probe.py", line 241, in write_memory
self._link.write_mem32(addr, conversion.u32le_list_to_byte_list([data]), self._apsel)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py", line 391, in write_mem32
self._write_mem(addr, data, Commands.JTAG_WRITEMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py", line 381, in _write_mem
raise self._ERROR_CLASSES[status](error_message)
pyocd.core.exceptions.TransferTimeoutError: STLink error (20): DP wait
0000848:ERROR:board:link exception during target disconnect:
Traceback (most recent call last):
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\board\board.py", line 98, in uninit
self.target.disconnect(resume)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\coresight_target.py", line 305, in disconnect
core.disconnect(resume)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 506, in disconnect
self.write32(CortexM.DEMCR, 0)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\memory_interface.py", line 44, in write32
self.write_memory(addr, value, 32)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 640, in write_memory
self.ap.write_memory(addr, value, transfer_size)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink_probe.py", line 241, in write_memory
self._link.write_mem32(addr, conversion.u32le_list_to_byte_list([data]), self._apsel)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py", line 391, in write_mem32
self._write_mem(addr, data, Commands.JTAG_WRITEMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py", line 379, in _write_mem
raise exc
pyocd.core.exceptions.TransferFaultError: SWD/JTAG Transfer Fault @ 0xe000edfc-0xe000ee03
- With the unpatched
Keil.STM32L4xx_DFP.2.5.0.pack
andKeil.STM32NUCLEO_BSP.1.7.0.pack
with-O connect_mode=halt
or-O connect_mode=attach
, the debugger starts, but then, after stepping, I get:
pyocd.cache.memory.MemoryAccessError: individual memory accesses must not cross memory region boundaries
"0017170:ERROR:gdbserver:Unhandled exception in handle_message: individual memory accesses must not cross memory region boundaries"
- With my patched
Keil.STM32L4xx_DFP.2.5.0.pack
andKeil.STM32NUCLEO_BSP.1.7.0.pack
with-O connect_mode=halt
or-O connect_mode=attach
, the debugger starts, but then, after stepping, I get:
warning: Remote failure reply: E01
0018711:ERROR:gdbserver:Unhandled exception in handle_message: SWD/JTAG Transfer Fault @ 0xe000ed30-0xe000ed37
Traceback (most recent call last):
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 558, in resume
if self.target.get_state() == Target.State.HALTED:
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 982, in get_state
dhcsr = self.read_memory(CortexM.DHCSR)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 646, in read_memory
result = self.ap.read_memory(addr, transfer_size, now)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink_probe.py", line 255, in read_memory
result = conversion.byte_list_to_u32le_list(self._link.read_mem32(addr, 4, self._apsel))[0]
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py", line 387, in read_mem32
return self._read_mem(addr, size, Commands.JTAG_READMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py", line 347, in _read_mem
raise self._ERROR_CLASSES[status](error_message)
pyocd.core.exceptions.TransferTimeoutError: STLink error (20): DP wait
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 383, in handle_message
reply = handler(msg[msgStart:])
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 610, in v_command
return self.v_cont(cmd)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 661, in v_cont
return self.resume(None)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 577, in resume
val = ('S%02x' % self.target_facade.get_signal_value()).encode()
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\context_facade.py", line 146, in get_signal_value
if self._context.core.is_debug_trap():
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 1331, in is_debug_trap
debugEvents = self.read_memory(CortexM.DFSR) & (CortexM.DFSR_DWTTRAP | CortexM.DFSR_BKPT | CortexM.DFSR_HALTED)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 646, in read_memory
result = self.ap.read_memory(addr, transfer_size, now)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink_probe.py", line 255, in read_memory
result = conversion.byte_list_to_u32le_list(self._link.read_mem32(addr, 4, self._apsel))[0]
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py", line 387, in read_mem32
return self._read_mem(addr, size, Commands.JTAG_READMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py", line 345, in _read_mem
raise exc
pyocd.core.exceptions.TransferFaultError: SWD/JTAG Transfer Fault @ 0xe000ed30-0xe000ed37
0018744:ERROR:gdbserver:Unhandled exception in handle_message: SWD/JTAG Transfer Fault @ 0xe000edf0-0xe000edf7
Traceback (most recent call last):
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 381, in handle_message
reply = handler()
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 817, in get_registers
return self.create_rsp_packet(self.target_facade.get_register_context())
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\context_facade.py", line 69, in get_register_context
vals = self._context.read_core_registers_raw(reg_num_list)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\rtos\rtx5.py", line 195, in read_core_registers_raw
reg_vals.append(self._parent.read_core_register_raw(reg))
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\debug\context.py", line 104, in read_core_register_raw
vals = self.read_core_registers_raw([reg])
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\debug\cache.py", line 48, in read_core_registers_raw
return self._regcache.read_core_registers_raw(reg_list)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\cache\register.py", line 100, in read_core_registers_raw
self._check_cache()
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\cache\register.py", line 77, in _check_cache
if self._core.is_running():
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 1013, in is_running
return self.get_state() == Target.State.RUNNING
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 982, in get_state
dhcsr = self.read_memory(CortexM.DHCSR)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\coresight\cortex_m.py", line 646, in read_memory
result = self.ap.read_memory(addr, transfer_size, now)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink_probe.py", line 255, in read_memory
result = conversion.byte_list_to_u32le_list(self._link.read_mem32(addr, 4, self._apsel))[0]
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py", line 387, in read_mem32
return self._read_mem(addr, size, Commands.JTAG_READMEM_32BIT, self.MAXIMUM_TRANSFER_SIZE, apsel)
File "c:\ProgramData\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\probe\stlink\stlink.py", line 345, in _read_mem
raise exc
pyocd.core.exceptions.TransferFaultError: SWD/JTAG Transfer Fault @ 0xe000edf0-0xe000edf7
"0018711:ERROR:gdbserver:Unhandled exception in handle_message: SWD/JTAG Transfer Fault @ 0xe000ed30-0xe000ed37"
Remote failure reply: E01
And, in case you wonder, I’m using the latest ST-LINK/V2 driver and firmware from ST’s website.
This IDE is an absolute nightmare and a huge waste of time. Please fix it. In the meantime, I will have to downgrade to 1.3.0.