Open flit opened 6 years ago
Hi @flit & all,
Had also issue with the same target while flashing. The exception I have is ZeroDivisionError! I try to flash an example from NXP's SDK, nothing fancy.
Here is a sample session (with verbose flag):
$ pyocd flash --format elf led_blinky.elf -v
0000181:INFO:board:Target type is mimxrt1050_hyperflash
0000294:INFO:dap:DP IDR = 0x0bd11477
0000338:INFO:dap:AP#0 IDR = 0x04770041
0000368:INFO:rom_table:AP#0 ROM table #0 @ 0xe00fd000 (designer=00e part=88c)
0000390:INFO:rom_table:[0]<e00fe000:ROM class=1 designer=43b part=4c8>
0000390:INFO:rom_table: AP#0 ROM table #1 @ 0xe00fe000 (designer=43b part=4c8)
0000413:INFO:rom_table: [0]<e00ff000:ROM class=1 designer=43b part=4c7>
0000413:INFO:rom_table: AP#0 ROM table #2 @ 0xe00ff000 (designer=43b part=4c7)
0000435:INFO:rom_table: [0]<e000e000:SCS-M4 class=14 designer=43b part=00c>
0000451:INFO:rom_table: [1]<e0001000:DWT class=14 designer=43b part=002>
0000466:INFO:rom_table: [2]<e0002000:FPB class=14 designer=43b part=00e>
0000482:INFO:rom_table: [3]<e0000000:ITM class=14 designer=43b part=001>
0000497:INFO:rom_table: [1]<e0041000:ETM-M7 class=9 designer=43b part=975 devtype=13 archid=4a13 devid=0:0:0>
0000513:INFO:rom_table: [2]<e0042000:CTI class=9 designer=43b part=906 devtype=14 archid=0000 devid=0:0:40800>
0000529:INFO:rom_table:[1]<e0040000:TPIU-M7 class=9 designer=43b part=9a9 devtype=11 archid=0000 devid=0:0:ca1>
0000544:INFO:rom_table:[2]<e0043000:TSGEN class=15 designer=43b part=101>
0000559:INFO:cortex_m:CPU core is Cortex-M7 r1p1
0000580:INFO:cortex_m:FPU present: FPv5-DP
0000597:INFO:dwt:4 hardware watchpoints
0000604:INFO:fpb:8 hardware breakpoints, 1 literal comparators
0000638:ERROR:__main__:uncaught exception: float division by zero
Traceback (most recent call last):
File "/home/antoine/web-git/pyOCD/pyocd-venv/lib/python3.6/site-packages/pyocd/__main__.py", line 309, in run
self._commands[self._args.cmd]()
File "/home/antoine/web-git/pyOCD/pyocd-venv/lib/python3.6/site-packages/pyocd/__main__.py", line 381, in do_flash
format=self._args.format)
File "/home/antoine/web-git/pyOCD/pyocd-venv/lib/python3.6/site-packages/pyocd/flash/loader.py", line 135, in program
self._loader.commit()
File "/home/antoine/web-git/pyOCD/pyocd-venv/lib/python3.6/site-packages/pyocd/flash/loader.py", line 473, in commit
((totalByteCount/1024) / totalProgramTime),
ZeroDivisionError: float division by zero
Version :
$ pyocd --version
0.14.3
@AntoineZen Thanks for the additional information!
When will you plan to fix this issue? We really hope we can use pyocd to debug NXP RT boards.
I'm working on it with NXP, but I'm afraid I don't have a date for you.
I have tried you fix from #513. The Zero-division error is gone but now I'have several other exception in cascade (as you could except from what I read above). I have attached my stack-trace, if it can be useful to you.
Thanks. Unfortunately there's nothing revealing in the exception log.
I can confirm the same failure as the posted log on an i.MXRT1021 EVK board. I am seeing a failure of CMSIS transfer acknowledgement as the immediate cause of the exception.
OpenSDA 254 is running on this EVK which provides CMSIS-DAPv2 support. PyOCD is 0.22.
I can confirm the same problem on an i.MXRT1020 EVK board. I am able to connect to the board and open a gdb session. When I try to "load" a FLASH resident program (led_blinky example) I have an output on pyocd terminal attesting the loading task (0019507:INFO:loader:Erased 16384 bytes (4 sectors), programmed 16384 bytes (4 pages), skipped 0 bytes (0 pages) at 8.26 kB/s). Nevertheless when I try to reset the board, the LED doesn't blink and I loose the connection to the board. To regain access I need to do a mass erase in Fuses boot mode and flash again through MCUXpressoIDE and in internal boot mode.
Any news from NXP @flit ? Thank you!
Nothing really worth reporting yet, sorry. Recently I did get the RT1052 flash algo source code from NXP (unfortunately I'm not allowed to distribute it to others), but haven't had time to debug it. I did also get a RT1021 EVK recently, and have asked for the source for the RT1021 flash algo.
Thank you for the quick feedback @flit ! I will keep track this issue to check any advances on this. If anyone has a Linux-based tool to flash the i.MXRT1020 EVK w/o depending on the MCUXpresso tools, please let me know.
@flit flash algo source codes are distributed with MCUXpresso in ide\Examples\Flashdrivers\NXP\iMXRT folder.
@MateuszKlatecki Holy cow! Thanks for pointing that out. 😀
It's not quite the same as what I was given. This project builds a .cfx file (used by the MCUX IDE), while the one I was given builds an .FLM. The latter format is used by CMSIS-Packs and pyOCD. However, from a quick review it looks like they mostly have wrapped the .FLM API with the LPCXFlashDriverLib API.
@flit , one last question.
Do you think that if I my binary is NOT FLASH resident, I could easily load the program to the board by using pyocd and a gdb a session?
You mean RAM resident? Yes, that should work.
Hi @flit , All NXP IMX-RT serires has same problem to load elf to flash. like EVK-MIMXRT1060, EVK-MIMXRT1015. It's good to see you get start on this issue.
Debugging a RAM-resident app on the NXP i.MX RT1050 MCU works successfully. However, programming flash and debugging an application residing in flash fails with various errors.