Nuvoton M2351 erase flash because not working anymore

0

I have a Nuvoton M2351 board at home and was experimenting with the XOM feature. The last program I flashed configured the XOMR0 region starting at address 0x70000 with a size of 255 pages. Since then I am unable to flash anything else and I was wondering if I can force a flash erase via gdb or openocd.

I am using:

  • OpenOCD: Open On-Chip Debugger 0.10.0-dev-g7a28f97d-dirty (2020-05-19-11:19)
  • GCC: gcc-arm-none-eabi-9-2019-q4-major
  • Board: Nuvoton M2351

My current error message:

$ openocd -f /interface/nulink.cfg -f /target/numicroM23.cfg -c "program main.elf reset exit"

Open On-Chip Debugger 0.10.0-dev-g7a28f97d-dirty (2020-05-19-11:19)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : NULINK is Nu-Link1
Info : NULINK firmware_version(6773), product_id(0x40012009)
Info : IDCODE: 0x0BF11477
Info : NuMicro.cpu: hardware has 23 breakpoints, 0 watchpoints
Error: timed out while waiting for target halted
TARGET: NuMicro.cpu - Not halted
in procedure 'program' 
in procedure 'reset' called at file "embedded:startup.tcl", line 478
in procedure 'ocd_bouncer'

embedded:startup.tcl:454: Error: ** Unable to reset target **
in procedure 'program' 
in procedure 'program_error' called at file "embedded:startup.tcl", line 479
at file "embedded:startup.tcl", line 454
make: *** [Makefile:65: flash] Error 1


I tried flashing a totally different program, that just lets some LEDs blink. I tried plugging it out and in again. Now I have no more ideas how I can fix that problem.

Has anyone a tipp how I could flash something new or how I could erase the flash? I think that the problem could be with the 255 page size of the XOM region configuration, but don't know how to fix that.

Normally it looks like this:

$ openocd -f /interface/nulink.cfg -f /target/numicroM23.cfg -c "program main.elf reset exit"

Open On-Chip Debugger 0.10.0-dev-g7a28f97d-dirty (2020-05-19-11:19)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : NULINK is Nu-Link1
Info : NULINK firmware_version(6773), product_id(0x40012009)
Info : IDCODE: 0x0BF11477
Info : NuMicro.cpu: hardware has 4 breakpoints, 4 watchpoints
NuMicro.cpu: target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0000041c msp: 0x20018000
** Programming Started **
auto erase enabled
Info : Device ID: 0x00235100
Info : Device Name: M2351KIAAE
Info : bank base = 0x00000000, size = 0x10080000
Info : Nuvoton NuMicro: Sector Erase ... (0 to 25)
Info : Nuvoton NuMicro: Flash Write ...
Info : Have written 7%
Info : Have written 14%
Info : Have written 21%
Info : Have written 28%
Info : Have written 35%
Info : Have written 42%
Info : Have written 49%
Info : Have written 57%
Info : Have written 64%
Info : Have written 71%
Info : Have written 78%
Info : Have written 85%
Info : Have written 92%
Info : Have written 99%
Info : Have written 100%
Warn : Adding extra erase range, 0x0000c800 to 0x0000ca6f
Info : Nuvoton NuMicro: Sector Erase ... (25 to 26)
Info : Nuvoton NuMicro: Flash Write ...
Info : Have written 100%
Info : Nuvoton NuMicro: Sector Erase ... (224 to 224)
Info : Nuvoton NuMicro: Flash Write ...
Info : Have written 100%
wrote 58768 bytes from file main.elf in 37.629887s (1.525 KiB/s)
** Programming Finished **
** Resetting Target **
shutdown command invoked
microcontroller
openocd
nuvoton
asked on Stack Overflow Sep 3, 2020 by straumle • edited Sep 3, 2020 by straumle

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0