pyocd / pyocd/pyOCD

stm32l4r5zitx - Loadable section "RW_IRAM1" outside of ELF segments

Open
#895 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

Hi

I'm using mbed studio and when trying to debug on a stm32l4r5zitx with a STLink.

I'm getting the following log when trying to debug:


Selected port 50000 for debugging
0000297:INFO:board:Target type is stm32l4s5vitx
0000428:INFO:coresight_target:Asserting reset prior to connect
0000581:INFO:dap:DP IDR = 0x2ba01477 (v1 rev2)
0000640:INFO:ap:AP#0 IDR = 0x24770011 (AHB-AP var1 rev2)
0000643:INFO:rom_table:AP#0 ROM table #0 @ 0xe00ff000 (designer=020 part=470)
0000645:INFO:rom_table:[0]
0000646:INFO:rom_table:[1]
0000647:INFO:rom_table:[2]
0000648:INFO:rom_table:[3]
0000649:INFO:rom_table:[4]
0000651:INFO:rom_table:[5]
0000652:INFO:cortex_m:CPU core #0 is Cortex-M4 r0p1
0000657:INFO:dwt:4 hardware watchpoints
0000660:INFO:fpb:6 hardware breakpoints, 4 literal comparators
0000668:INFO:coresight_target:Deasserting reset post connect
0000674:INFO:server:Semihost server started on port 4444
0000675:INFO:gdbserver:GDB server started on port 50000
Reading symbols from c:\Users\User\source\repos\arm-mbed\BUILD\MY_BOARD\ARMC6\arm-mbed.elf...
warning: 
**Loadable section "RW_IRAM1" outside of ELF segments**
done.
0000789:INFO:gdbserver:One client connected!
**warning: Loadable section "RW_IRAM1" outside of ELF segments
warning: Overlapping regions in memory map: ignoring**
0x080003d4 in Reset_Handler ()
0000812:INFO:gdbserver:Attempting to load Argon
0000812:INFO:gdbserver:Attempting to load FreeRTOS
0000812:INFO:gdbserver:Attempting to load Zephyr
0000813:INFO:gdbserver:Attempting to load RTX5
0000813:INFO:gdbserver:RTX5 loaded successfully
Attached to debugger on port 50000
Image loaded: c:\Users\User\source\repos\arm-mbed\BUILD\MY_BOARD\ARMC6\arm-mbed.elf
0001809:ERROR:gdbserver:Unhandled exception in handle_message: individual memory accesses must not cross memory region boundaries
Traceback (most recent call last):
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 549, in handle_message
    reply = handler(msg[msgStart:])
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 776, in v_command
    return self.v_cont(cmd)
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 791, in v_cont
    if self.is_threading_enabled():
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\gdbserver\gdbserver.py", line 1320, in is_threading_enabled
    return (self.thread_provider is not None) and self.thread_provider.is_enabled \
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\rtos\rtx5.py", line 408, in is_enabled
    return self.get_kernel_state() != 0 and not self._target.in_thread_mode_on_main_stack()
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\rtos\rtx5.py", line 446, in get_kernel_state
    return self._target_context.read8(self._os_rtx_info + RTX5ThreadProvider.KERNEL_STATE_OFFSET)
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\core\memory_interface.py", line 64, in read8
    return self.read_memory(addr, 8, now)
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\debug\cache.py", line 516, in read_memory
    return self._memcache.read_memory(addr, transfer_size, now)
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\debug\cache.py", line 422, in read_memory
    data = self.read_memory_block8(addr, 1)[0]
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\debug\cache.py", line 442, in read_memory_block8
    if not self._check_regions(addr, size):
  File "c:\Users\User\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\pyocd\debug\cache.py", line 414, in _check_regions
    raise MemoryAccessError("individual memory accesses must not cross memory region boundaries")
pyocd.debug.cache.MemoryAccessError: individual memory accesses must not cross memory region boundaries
**"0001809:ERROR:gdbserver:Unhandled exception in handle_message: individual memory accesses must not cross memory region boundaries"
warning: Remote failure reply: E01**
0001809:ERROR:gdbserver:Unhandled exception in handle_message: individual memory accesses must not cross memory region boundaries

Key lines in there are:

warning: **Loadable section "RW_IRAM1" outside of ELF segments** done.         
0000789:INFO:gdbserver:One client connected! **warning: Loadable section "RW_IRAM1" outside of ELF segments warning:

In the map file, the RAM looks ok:

Execution Region RW_IRAM1 (Base: 0x200001c0, Size: 0x00002cc8, Max: 0x0009fa40, ABSOLUTE)
Execution Region ARM_LIB_STACK (Base: 0x2009fc00, Size: 0x00000400, Max: 0x00000400, ABSOLUTE)

Processor datasheets say:

The STM32L4S5xx, STM32L4S7xx and STM32L4S9xx devices feature 640 Kbytes of
embedded SRAM. This SRAM is split into three blocks:
• 192 Kbytes mapped at address 0x2000 0000 (SRAM1).
• 64 Kbytes located at address 0x1000 0000 with hardware parity check (SRAM2).
This memory is also mapped at address 0x2003 0000 offering a contiguous address
space with the SRAM1.
This block is accessed through the ICode/DCode buses for maximum performance.
These 64 Kbytes SRAM can also be retained in Standby mode.
The SRAM2 can be write-protected with 1 Kbyte granularity.
• 384 Kbytes mapped at address 0x2004 0000 - (SRAM3).

So it does sound like memory is 0x2000 0000 - 0x200A 0000 which matches the map file's use of IRAM. So why does pyOCD say the ELF file is wrong?

Thank you.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ELF-loading warning and memory-region checks in pyocd/gdbserver/gdbserver.py and pyocd/debug/cache.py, then inspect the RTX5 access path in pyocd/rtos/rtx5.py. Reproduce with the reported STM32L4 ELF and determine why RW_IRAM1 is outside the recognized segments; done means debugging proceeds without the ELF or memory-boundary errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.