diff --git a/.gitignore b/.gitignore index 81cbbf6..e9befa4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ build*/ dat/ +src/cli/wfum-flash.h diff --git a/src/cli/rl78-glitch.c b/src/cli/rl78-glitch.c index b291682..54f2b1b 100644 --- a/src/cli/rl78-glitch.c +++ b/src/cli/rl78-glitch.c @@ -321,9 +321,9 @@ do_reset_stuff: void cli_tool78_glitch_ocd_dump(void) { glitch_init_core1_stuff(false); - //gpio_set_function(2, GPIO_FUNC_SIO); - //gpio_set_dir(2, GPIO_OUT); - //gpio_put(2, false); + gpio_set_function(2, GPIO_FUNC_SIO); + gpio_set_dir(2, GPIO_OUT); + gpio_put(2, false); //gpio_set_function(3, GPIO_FUNC_SIO); //gpio_set_dir(3, GPIO_OUT); @@ -338,7 +338,7 @@ void cli_tool78_glitch_ocd_dump(void) { restart: //trl78_uart1_set_exclusive(true); //tool78_hw_rl78_uart1.rx_set_stop_bit(false); - //gpio_put(2, false); + gpio_put(2, false); /*glitch_disarm(); busy_wait_ms(40);*/ @@ -385,7 +385,7 @@ restart: rr = tool78_hw_rl78_uart1.recv(1, checkbuf, 12*1000); if (rr != 1) { busy_wait_ms(1); // leave time to recharge - //printf("."); + printf("."); continue; } @@ -410,7 +410,7 @@ do_reset_stuff: goto restart; success:; - //gpio_put(2, true); + gpio_put(2, true); //busy_wait_ms(5); // (02): read from above (checkbuf) code // 03 06 18 00 df 03 @@ -433,8 +433,8 @@ success:; } printf("got ver! %04x\n", ver); - printf("len: %lu\n", *(volatile uint32_t*)&glitch_param_cur.length_cur); - goto do_reset_stuff; + printf("glitch len: %lu us\n", *(volatile uint32_t*)&glitch_param_cur.length_cur); + /*goto do_reset_stuff;*/ st = tool78_ocd_connect(&tool78_hw_rl78_uart1, passwd); if (st != 0xf0 && st != 0xf2) { diff --git a/src/cli/rl78.c b/src/cli/rl78.c index e15c526..29fee02 100644 --- a/src/cli/rl78.c +++ b/src/cli/rl78.c @@ -5,6 +5,8 @@ #include "tool78_hw.h" #include "tool78_cmds.h" +/*#include "wfum-flash.h"*/ + void cli_tool78_testtest(void); void cli_tool78_prototest(void); void cli_tool78_ocdtest(void); @@ -74,6 +76,12 @@ result: 0x06. sig: secget: 0x06 sec: flg=fe bot=03 fsws=0000 fswe=000f blank check: 0x06 + +result: 0x06. sig: +0x10 0x00 0x06 0x52 0x35 0x46 0x31 0x30 0x31 0x45 0x45 0x20 0x20 0xff 0xff 0x00 0x00 0x00 0x00 0x03 0x00 0x03 +secget: 0x06 +sec: flg=fe bot=03 fsws=0000 fswe=003f + */ uint8_t* datatoflash = true ? DATA_main_nodbg : DATA_main_dbgpad; @@ -98,6 +106,11 @@ blank check: 0x06 st = tool78_do_verify(hw, 0, 0x3ff, datatoflash); printf("verify: 0x%02x\n", st);*/ + /*for (size_t iii = 0; iii < 65536; iii += 0x400) { + st = tool78_do_verify(hw, iii+0, iii+0x3ff, &DATA_wfum_flash[iii]); + printf("verify 0x%04zx: 0x%02x\n", iii, st); + }*/ + tool78_hw_rl78_uart1.deinit(); } diff --git a/src/tool78/tool78_hw_helpers.c b/src/tool78/tool78_hw_helpers.c index f09b774..ce801c5 100644 --- a/src/tool78/tool78_hw_helpers.c +++ b/src/tool78/tool78_hw_helpers.c @@ -131,13 +131,14 @@ int tool78_hw_help_recv(const struct tool78_pio_vars* vars, end: irq = PINOUT_TOOL78_PIO->irq; PINOUT_TOOL78_PIO->irq = irq; - if (irq) { + /*if (irq) { + gpio_put(3, true); printf("irq: 0x%02x\n", irq); - } + } else gpio_put(3, false); irq = PINOUT_TOOL78_PIO->intr; if (irq&0xf00) { printf("intr: 0x%02x\n", irq); - } + }*/ return overrun ? (!i ? (int)0x08000000 : -i) : i; }