Dobrica Pavlinušić's random unstructured stuff
IMAX B6: Revision 10
RC-Power_BC6_Charger.pdf Open source firmware
Flashinghttps://groups.google.com/forum/#!msg/cheali-charger/2Rz-dtwZ5Is/zUGr3PzX9bcJ pinout: CHARGER -------------DONGLE ICE_DATA <---------> SWDIO ICE_CLK <---------> SWCLK ICE_RST <---------> RST (GND on my dongle) GND <---------> GND VCC <---------> 5V dpavlin@x200:/rest/cvs/cheali-charger/utils/M0517_flash_tools/tcl$ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f target_MO517_linux.cfg -f M0517_flash.tcl -f M0517_unlock.tcl Open On-Chip Debugger 0.9.0 (2015-05-28-17:08) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 1000 kHz adapter_nsrst_delay: 100 FlashAprom EraseChip Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : clock speed 950 kHz Info : STLINK v2 JTAG v23 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.339130 Info : M0517.cpu: hardware has 4 breakpoints, 2 watchpoints Info : accepting 'telnet' connection on tcp/4444 Image: /rest/cvs/cheali-charger/./src/hardware/nuvoton-M0517/targets/imaxB6-clone/cheali-charger-imaxB6-clone_1.00-20150617_nuvoton-M0517.bin; Size=34840; Sectors:69; FlashProces:(34840;3584,9;2584,1) >>>> Load FlashPgm to SRAM: NU_M051x.bin => 0x20000000 target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc 276 bytes written at address 0x20000000 downloaded 276 bytes in 0.008215s (32.810 KiB/s) >>>> FlashInit: sp (/32): 0x20001000 pc (/32): 0x20000000 Error: timed out while waiting for target halted Flash is locked! Chip erase... . . . . . APROM: Erased!: (0x00000000):0xFFFFFFFF LDROM: Erased!: (0x00100000):0xFFFFFFFF Config: Erased!: (0x0030000):0xFFFFFFFF Image: /rest/cvs/cheali-charger/./src/hardware/nuvoton-M0517/targets/imaxB6-clone/cheali-charger-imaxB6-clone_1.00-20150617_nuvoton-M0517.bin; Size=34840; Sectors:69; FlashProces:(34840;3584,9;2584,1) >>>> Load FlashPgm to SRAM: NU_M051x.bin => 0x20000000 target state: halted target halted due to debug-request, current mode: Thread xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc 276 bytes written at address 0x20000000 downloaded 276 bytes in 0.008211s (32.826 KiB/s) >>>> FlashInit: sp (/32): 0x20001000 pc (/32): 0x20000000 target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x41000000 pc: 0x20000048 msp: 0x20001000 r0 (/32): 0x00000000 >>>> FlashInit stop: >>>> EreaseFlash: start FLASH sector addr: 0x00000000 sectors to erease: 0x00000045 r0 (/32): 0x00000000 r1 (/32): 0x00000045 sp (/32): 0x20001000 pc (/32): 0x20000058 target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x200000a2 msp: 0x20000fec r0 (/32): 0x00000000 >>>> FlashErease: stop >>>> FLASH image: /rest/cvs/cheali-charger/./src/hardware/nuvoton-M0517/targets/imaxB6-clone/cheali-charger-imaxB6-clone_1.00-20150617_nuvoton-M0517.bin to 0x00000000 >> Flash Sector: 0-6 => 0x00000000 (3584) SRAM load : tmp/fl.00 => 0x20000120 FLASH addr: reg r0 0x00000000 SIZE addr: reg r1 0x00000e00 BUFFR addr: reg r2 0x20000120 3584 bytes written at address 0x20000120 downloaded 3584 bytes in 0.069231s (50.555 KiB/s) r0 (/32): 0x00000000 r1 (/32): 0x00000E00 r2 (/32): 0x20000120 sp (/32): 0x20001000 pc (/32): 0x200000AE target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000010c msp: 0x20000ff4 r0 (/32): 0x00000000 >> Flash Sector: 7-13 => 0x00000e00 (3584) SRAM load : tmp/fl.01 => 0x20000120 FLASH addr: reg r0 0x00000e00 SIZE addr: reg r1 0x00000e00 BUFFR addr: reg r2 0x20000120 3584 bytes written at address 0x20000120 downloaded 3584 bytes in 0.068563s (51.048 KiB/s) r0 (/32): 0x00000E00 r1 (/32): 0x00000E00 r2 (/32): 0x20000120 sp (/32): 0x20001000 pc (/32): 0x200000AE target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000010c msp: 0x20000ff4 r0 (/32): 0x00000000 >> Flash Sector: 14-20 => 0x00001c00 (3584) SRAM load : tmp/fl.02 => 0x20000120 FLASH addr: reg r0 0x00001c00 SIZE addr: reg r1 0x00000e00 BUFFR addr: reg r2 0x20000120 3584 bytes written at address 0x20000120 downloaded 3584 bytes in 0.068231s (51.296 KiB/s) r0 (/32): 0x00001C00 r1 (/32): 0x00000E00 r2 (/32): 0x20000120 sp (/32): 0x20001000 pc (/32): 0x200000AE target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000010c msp: 0x20000ff4 r0 (/32): 0x00000000 >> Flash Sector: 21-27 => 0x00002a00 (3584) SRAM load : tmp/fl.03 => 0x20000120 FLASH addr: reg r0 0x00002a00 SIZE addr: reg r1 0x00000e00 BUFFR addr: reg r2 0x20000120 3584 bytes written at address 0x20000120 downloaded 3584 bytes in 0.069227s (50.558 KiB/s) r0 (/32): 0x00002A00 r1 (/32): 0x00000E00 r2 (/32): 0x20000120 sp (/32): 0x20001000 pc (/32): 0x200000AE target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000010c msp: 0x20000ff4 r0 (/32): 0x00000000 >> Flash Sector: 28-34 => 0x00003800 (3584) SRAM load : tmp/fl.04 => 0x20000120 FLASH addr: reg r0 0x00003800 SIZE addr: reg r1 0x00000e00 BUFFR addr: reg r2 0x20000120 3584 bytes written at address 0x20000120 downloaded 3584 bytes in 0.069238s (50.550 KiB/s) r0 (/32): 0x00003800 r1 (/32): 0x00000E00 r2 (/32): 0x20000120 sp (/32): 0x20001000 pc (/32): 0x200000AE target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000010c msp: 0x20000ff4 r0 (/32): 0x00000000 >> Flash Sector: 35-41 => 0x00004600 (3584) SRAM load : tmp/fl.05 => 0x20000120 FLASH addr: reg r0 0x00004600 SIZE addr: reg r1 0x00000e00 BUFFR addr: reg r2 0x20000120 3584 bytes written at address 0x20000120 downloaded 3584 bytes in 0.069181s (50.592 KiB/s) r0 (/32): 0x00004600 r1 (/32): 0x00000E00 r2 (/32): 0x20000120 sp (/32): 0x20001000 pc (/32): 0x200000AE target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000010c msp: 0x20000ff4 r0 (/32): 0x00000000 >> Flash Sector: 42-48 => 0x00005400 (3584) SRAM load : tmp/fl.06 => 0x20000120 FLASH addr: reg r0 0x00005400 SIZE addr: reg r1 0x00000e00 BUFFR addr: reg r2 0x20000120 3584 bytes written at address 0x20000120 downloaded 3584 bytes in 0.069107s (50.646 KiB/s) r0 (/32): 0x00005400 r1 (/32): 0x00000E00 r2 (/32): 0x20000120 sp (/32): 0x20001000 pc (/32): 0x200000AE target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000010c msp: 0x20000ff4 r0 (/32): 0x00000000 >> Flash Sector: 49-55 => 0x00006200 (3584) SRAM load : tmp/fl.07 => 0x20000120 FLASH addr: reg r0 0x00006200 SIZE addr: reg r1 0x00000e00 BUFFR addr: reg r2 0x20000120 3584 bytes written at address 0x20000120 downloaded 3584 bytes in 0.069117s (50.639 KiB/s) r0 (/32): 0x00006200 r1 (/32): 0x00000E00 r2 (/32): 0x20000120 sp (/32): 0x20001000 pc (/32): 0x200000AE target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000010c msp: 0x20000ff4 r0 (/32): 0x00000000 >> Flash Sector: 56-62 => 0x00007000 (3584) SRAM load : tmp/fl.08 => 0x20000120 FLASH addr: reg r0 0x00007000 SIZE addr: reg r1 0x00000e00 BUFFR addr: reg r2 0x20000120 3584 bytes written at address 0x20000120 downloaded 3584 bytes in 0.068143s (51.363 KiB/s) r0 (/32): 0x00007000 r1 (/32): 0x00000E00 r2 (/32): 0x20000120 sp (/32): 0x20001000 pc (/32): 0x200000AE target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000010c msp: 0x20000ff4 r0 (/32): 0x00000000 >> Flash Sector: 63-68 => 0x00007e00 (2584) SRAM load : tmp/fl.09 => 0x20000120 FLASH addr: reg r0 0x00007e00 SIZE addr: reg r1 0x00000c00 BUFFR addr: reg r2 0x20000120 2584 bytes written at address 0x20000120 downloaded 2584 bytes in 0.050122s (50.346 KiB/s) r0 (/32): 0x00007E00 r1 (/32): 0x00000C00 r2 (/32): 0x20000120 sp (/32): 0x20001000 pc (/32): 0x200000AE target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000010c msp: 0x20000ff4 r0 (/32): 0x00000000 >>>> FLASH image: stop >>>> Verify: verify_image /rest/cvs/cheali-charger/./src/hardware/nuvoton-M0517/targets/imaxB6-clone/cheali-charger-imaxB6-clone_1.00-20150617_nuvoton-M0517.bin 0 target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000002e msp: 0x20000ff4 verified 34840 bytes in 0.226838s (149.990 KiB/s) Trajanje init: 0 sec Trajanje brisi: 2 sec Trajanje pisi: 2 sec Trajanje ukupno: 4 sec OBSOLETE OR WRONG Connect ST-Link to usb and start openocd dpavlin@x200:/rest/cvs/cheali-charger/src/hardware/nuvoton-M0517/targets/imaxB6-clone$ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/m051.cfg Open On-Chip Debugger 0.9.0 (2015-05-28-17:08) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 1000 kHz adapter_nsrst_delay: 100 Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : clock speed 950 kHz Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.432000 Error: init mode failed (unable to connect to the target) in procedure 'init' in procedure 'ocd_bouncer' Your chip is protected. Disconnect GND pin and start openocd again. dpavlin@x200:/rest/cvs/openocd$ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/m051.cfg Open On-Chip Debugger 0.9.0 (2015-05-28-17:08) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 1000 kHz adapter_nsrst_delay: 100 Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : Unable to match requested speed 1000 kHz, using 950 kHz Info : clock speed 950 kHz Info : STLINK v2 JTAG v23 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.339130 Info : m051.cpu: hardware has 4 breakpoints, 2 watchpoints In another terminal, connect to openocd and make backup: dpavlin@x200:~$ telnet localhost 4444 Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Open On-Chip Debugger > init > dump_image aprom.bin 0x0 0x10000 dumped 65536 bytes in 1.152825s (55.516 KiB/s) > dump_image flash_data.bin 0x1f000 0x1000 dumped 4096 bytes in 0.071758s (55.743 KiB/s) > dump_image ldrom.bin 0x100000 0x1000 > shutdown shutdown command invoked Connection closed by foreign host. Serial port |