save rl78 stuff

This commit is contained in:
Triss 2022-03-11 15:46:39 +01:00
parent c36edac371
commit 5075908de2
4 changed files with 26 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
build*/ build*/
dat/ dat/
src/cli/wfum-flash.h

View File

@ -321,9 +321,9 @@ do_reset_stuff:
void cli_tool78_glitch_ocd_dump(void) { void cli_tool78_glitch_ocd_dump(void) {
glitch_init_core1_stuff(false); glitch_init_core1_stuff(false);
//gpio_set_function(2, GPIO_FUNC_SIO); gpio_set_function(2, GPIO_FUNC_SIO);
//gpio_set_dir(2, GPIO_OUT); gpio_set_dir(2, GPIO_OUT);
//gpio_put(2, false); gpio_put(2, false);
//gpio_set_function(3, GPIO_FUNC_SIO); //gpio_set_function(3, GPIO_FUNC_SIO);
//gpio_set_dir(3, GPIO_OUT); //gpio_set_dir(3, GPIO_OUT);
@ -338,7 +338,7 @@ void cli_tool78_glitch_ocd_dump(void) {
restart: restart:
//trl78_uart1_set_exclusive(true); //trl78_uart1_set_exclusive(true);
//tool78_hw_rl78_uart1.rx_set_stop_bit(false); //tool78_hw_rl78_uart1.rx_set_stop_bit(false);
//gpio_put(2, false); gpio_put(2, false);
/*glitch_disarm(); /*glitch_disarm();
busy_wait_ms(40);*/ busy_wait_ms(40);*/
@ -385,7 +385,7 @@ restart:
rr = tool78_hw_rl78_uart1.recv(1, checkbuf, 12*1000); rr = tool78_hw_rl78_uart1.recv(1, checkbuf, 12*1000);
if (rr != 1) { if (rr != 1) {
busy_wait_ms(1); // leave time to recharge busy_wait_ms(1); // leave time to recharge
//printf("."); printf(".");
continue; continue;
} }
@ -410,7 +410,7 @@ do_reset_stuff:
goto restart; goto restart;
success:; success:;
//gpio_put(2, true); gpio_put(2, true);
//busy_wait_ms(5); //busy_wait_ms(5);
// (02): read from above (checkbuf) code // (02): read from above (checkbuf) code
// 03 06 18 00 df 03 // 03 06 18 00 df 03
@ -433,8 +433,8 @@ success:;
} }
printf("got ver! %04x\n", ver); printf("got ver! %04x\n", ver);
printf("len: %lu\n", *(volatile uint32_t*)&glitch_param_cur.length_cur); printf("glitch len: %lu us\n", *(volatile uint32_t*)&glitch_param_cur.length_cur);
goto do_reset_stuff; /*goto do_reset_stuff;*/
st = tool78_ocd_connect(&tool78_hw_rl78_uart1, passwd); st = tool78_ocd_connect(&tool78_hw_rl78_uart1, passwd);
if (st != 0xf0 && st != 0xf2) { if (st != 0xf0 && st != 0xf2) {

View File

@ -5,6 +5,8 @@
#include "tool78_hw.h" #include "tool78_hw.h"
#include "tool78_cmds.h" #include "tool78_cmds.h"
/*#include "wfum-flash.h"*/
void cli_tool78_testtest(void); void cli_tool78_testtest(void);
void cli_tool78_prototest(void); void cli_tool78_prototest(void);
void cli_tool78_ocdtest(void); void cli_tool78_ocdtest(void);
@ -74,6 +76,12 @@ result: 0x06. sig:
secget: 0x06 secget: 0x06
sec: flg=fe bot=03 fsws=0000 fswe=000f sec: flg=fe bot=03 fsws=0000 fswe=000f
blank check: 0x06 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; 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); st = tool78_do_verify(hw, 0, 0x3ff, datatoflash);
printf("verify: 0x%02x\n", st);*/ 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(); tool78_hw_rl78_uart1.deinit();
} }

View File

@ -131,13 +131,14 @@ int tool78_hw_help_recv(const struct tool78_pio_vars* vars,
end: end:
irq = PINOUT_TOOL78_PIO->irq; irq = PINOUT_TOOL78_PIO->irq;
PINOUT_TOOL78_PIO->irq = irq; PINOUT_TOOL78_PIO->irq = irq;
if (irq) { /*if (irq) {
gpio_put(3, true);
printf("irq: 0x%02x\n", irq); printf("irq: 0x%02x\n", irq);
} } else gpio_put(3, false);
irq = PINOUT_TOOL78_PIO->intr; irq = PINOUT_TOOL78_PIO->intr;
if (irq&0xf00) { if (irq&0xf00) {
printf("intr: 0x%02x\n", irq); printf("intr: 0x%02x\n", irq);
} }*/
return overrun ? (!i ? (int)0x08000000 : -i) : i; return overrun ? (!i ? (int)0x08000000 : -i) : i;
} }