pyOCD fails to flash imxrt1061 when flexRAM configuration changed
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 560
- Avg merge
- 1h 41m
- Merged PRs (30d)
- 3
Description
Hi,
I've been using pyOCD to flash and debug my imxRT1061 based board.
now i would like to change the FlexRAM configuration.
Default is 128k ITCM, 128k DTCM, 256k OCRAM
I have changed this to 0k ITCM, 256k DTCM, 256k OCRAM with few lines of code in the startup file.
Everything seems to work but now there is no way i can flash my board anymore !
The only solution i have found is to use NXP's mcuxpresso once to flash a dummy hello world project, it puts the FlexRAM to it's default config again and then pyOCD is back to normal .
FYI with the modified FlexRAM config, loading the NXP Flashloader with USB works but when sending the command to start the flashloader the MCU resets. No way to erase flash with this tool.
Thanks for your great work.
Francois
Here is the pyocd log:
pyocd flash my_app.elf --target mimxrt1061dvl6a
0000952 W CMSIS-Pack device MIMXRT1061DVL6A has no identifiable boot memory [cmsis_pack]
0001677 I Loading /home/francois/blabla/my_app.elf [load_cmd]
0001852 C Memory transfer fault @ 0xe000edf0-0xe000edf3 [__main__]
Traceback (most recent call last):
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/probe/cmsis_dap_probe.py", line 502, in read_ap_result_callback
value = result()
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1060, in read_reg_cb
res = transfer.get_result()
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 154, in get_result
self.daplink._read_packet()
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
return func(self, *args, **kwargs)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 1146, in _read_packet
decoded_data = cmd.decode_data(raw_data)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 480, in decode_data
data = self._decode_transfer_data(data)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 386, in _decode_transfer_data
self._check_response(data[2])
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py", line 364, in _check_response
raise DAPAccessIntf.TransferFaultError()
pyocd.probe.pydapaccess.dap_access_api.DAPAccessIntf.TransferFaultError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/__main__.py", line 161, in run
status = cmd.invoke()
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/subcommands/load_cmd.py", line 125, in invoke
programmer.program(filename,
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/flash/file_programmer.py", line 170, in program
self._loader.commit()
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/flash/loader.py", line 289, in commit
perf = builder.program(chip_erase=chipErase,
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/flash/builder.py", line 490, in program
sector_erase_count, page_program_time = self._compute_sector_erase_pages_and_weight(fast_verify)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/flash/builder.py", line 669, in _compute_sector_erase_pages_and_weight
self._analyze_pages_with_partial_read()
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/flash/builder.py", line 604, in _analyze_pages_with_partial_read
self._enable_read_access()
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/flash/builder.py", line 259, in _enable_read_access
self.flash.init(self.flash.Operation.VERIFY)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/flash/flash.py", line 252, in init
result = self._call_function_and_wait(self.flash_algo['pc_init'],
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/flash/flash.py", line 653, in _call_function_and_wait
self._call_function(pc, r0, r1, r2, r3, init)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/flash/flash.py", line 555, in _call_function
self.target.write_core_registers_raw(reg_list, data_list)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/core/soc_target.py", line 235, in write_core_registers_raw
self.selected_core_or_raise.write_core_registers_raw(reg_list, data_list)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/coresight/cortex_m.py", line 1175, in write_core_registers_raw
self._base_write_core_registers_raw(reg_list, data_list)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/coresight/cortex_m.py", line 1188, in _base_write_core_registers_raw
if not self.is_halted():
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/coresight/cortex_m.py", line 942, in is_halted
return self.get_state() == Target.State.HALTED
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/coresight/cortex_m.py", line 908, in get_state
dhcsr = self.read_memory(CortexM.DHCSR)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/coresight/cortex_m.py", line 478, in read_memory
result = self.ap.read_memory(addr, transfer_size, now)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/utility/concurrency.py", line 29, in _locking
return func(self, *args, **kwargs)
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/coresight/ap.py", line 1084, in _read_memory
result = read_mem_cb()
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/coresight/ap.py", line 1062, in read_mem_cb
res = result_cb()
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/coresight/dap.py", line 877, in read_ap_cb
result = result_cb()
File "/home/francois/.local/lib/python3.8/site-packages/pyocd/probe/cmsis_dap_probe.py", line 507, in read_ap_result_callback
raise self._convert_exception(error) from error
pyocd.core.exceptions.TransferFaultError: Memory transfer fault @ 0xe000edf0-0xe000edf3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing pyocd flash my_app.elf --target mimxrt1061dvl6a with the changed FlexRAM configuration. Read the stack-trace paths pyocd/flash/builder.py and pyocd/coresight/cortex_m.py, especially the flash initialization and DHCSR access, then compare behavior with the default configuration. Done means the target can be flashed without the reported memory transfer fault.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100