g1m paramtest payload works, max4619 doesn't fsr

This commit is contained in:
Triss 2022-04-26 03:38:50 +02:00
parent 7b40542c20
commit d45c4a95a9
4 changed files with 49 additions and 36 deletions

View File

@ -150,15 +150,16 @@ static uint8_t G1M_payload_2[] = {
};
static uint8_t G1M_paramtest[] = {
0x71, 0x7b, 0xfa, 0x51, 0x61, 0xfc, 0xdc, 0xff, 0x0e, 0xcf, 0x77, 0x00,
0x00, 0xce, 0x00, 0x00, 0xcf, 0x30, 0x00, 0x00, 0xcf, 0x50, 0x00, 0x00,
0xcf, 0x60, 0x00, 0x7f, 0xcf, 0x20, 0xff, 0x00, 0xcf, 0xf0, 0x00, 0xe5,
0xcf, 0xf3, 0x00, 0x10, 0xce, 0x00, 0xff, 0x30, 0xe0, 0xfa, 0x16, 0x52,
0x00, 0x53, 0xff, 0x51, 0xff, 0x81, 0x93, 0xdf, 0xfc, 0x61, 0xf9, 0x92,
0xdf, 0xf3, 0xce, 0x00, 0x00, 0x52, 0x18, 0x53, 0xff, 0x93, 0xdf, 0xfd,
0x92, 0xdf, 0xf8, 0x51, 0x48, 0xfc, 0xdc, 0xff, 0x0e, 0x51, 0x69, 0xfc,
0xdc, 0xff, 0x0e, 0x50, 0xaa, 0x52, 0x00, 0x92, 0x61, 0xe9, 0x61, 0x78,
0xfc, 0xdc, 0xff, 0x0e, 0xd2, 0xdf, 0xf4, 0xef, 0xbf, 0xd7
0x71, 0x7b, 0xfa, 0x51, 0x61, 0xfc, 0xdc, 0xff, 0x0e, 0xcf, 0x77, 0x00, 0x00,
0xce, 0x00, 0x00, 0xcf, 0x30, 0x00, 0x00, 0xcf, 0x50, 0x00, 0x00, 0xcf, 0x60,
0x00, 0x7f, 0xcf, 0x20, 0xff, 0x00, 0xcf, 0xf0, 0x00, 0xe5, 0xcf, 0xf3, 0x00,
0x10, 0xce, 0x00, 0xff, 0x30, 0xe0, 0xfc, 0x16, 0x52, 0x40, 0x53, 0xff, 0x51,
0x00, 0x81, 0x93, 0xdf, 0xfc, 0x92, 0x61, 0xf9, 0xd2, 0xdf, 0xf2, 0xce, 0x00,
0x00, 0x52, 0x18, 0x53, 0xff, 0x93, 0xdf, 0xfd, 0x92, 0xdf, 0xf8, 0x51, 0x48,
0xfc, 0xdc, 0xff, 0x0e, 0x51, 0x69, 0xfc, 0xdc, 0xff, 0x0e, 0x50, 0xaa, 0x52,
0x40, 0x92, 0x61, 0xe9, 0x61, 0x78, 0xfc, 0xdc, 0xff, 0x0e, 0xd2, 0xdf, 0xf4,
0xef, 0xbe, 0xd7
};
@ -661,24 +662,33 @@ restart:
// wait for completion
rr = hw->recv(2, checkbuf, 120*1000);
rr = hw->recv(2, checkbuf, 150*1000);
if (rr != 2) {
printf("exec code hdr: no response :/ (%d)\n", rr);
goto deinit_bad;
}
if (checkbuf[0] == 0xff) {
checkbuf[0] = checkbuf[1];
rr = hw->recv(1, &checkbuf[1], 120*1000);
if (rr != 1) {
printf("exec code hdr: no response :/ (%d)\n", rr);
goto deinit_bad;
}
}
if (checkbuf[0] != 'H' && checkbuf[1] != 'i') {
printf("bad hdr response: %02x %02x\n", checkbuf[0], checkbuf[1]);
goto deinit_bad;
}
rr = hw->recv(256, checkbuf, 120*1000);
if (rr != 256) {
const int lenlen = 0x40;
rr = hw->recv(lenlen, checkbuf, 120*1000);
if (rr != lenlen) {
printf("exec code: no data sendback (%d)\n", rr);
goto deinit_bad;
}
for (size_t i = 0; i < 256; ++i) {
for (size_t i = 0; i < lenlen; ++i) {
if (checkbuf[i] != (0xff^0xaa)) {
printf("bad value at index %zu: %02x\n", i, checkbuf[i]^0xaa);
goto deinit_bad;
@ -689,11 +699,13 @@ restart:
while (true) {
//glitch_arm();
rr = hw->recv(2, checkbuf, 120*1000);
rr = hw->recv(2, checkbuf, 150*1000);
//printf("rr=%d cb=%02x %02x\n", rr, checkbuf[0], checkbuf[1]);
//glitch_disarm();
if (rr == 2 && (checkbuf[0] != 'H' || checkbuf[1] != 'i')) rr = 0;
if (rr == 2) {
rr = hw->recv(256, checkbuf, 120*1000);
rr = hw->recv(lenlen, checkbuf, 150*1000);
//printf("recv data rr=%d\n", rr);
}
if (rr <= 0) {

View File

@ -372,7 +372,7 @@ bool CORE0_FUNC(glitch_ready)(const struct glitch_params* params) {
: GPIO_OVERRIDE_NORMAL) << IO_BANK0_GPIO0_CTRL_OUTOVER_LSB)
, IO_BANK0_GPIO0_CTRL_FUNCSEL_BITS | IO_BANK0_GPIO0_CTRL_OUTOVER_BITS
);
printf("glitch out init: func %d on pin %d\n", func, param_cur.glitch_out_pin);
//printf("glitch out init: func %d on pin %d\n", func, param_cur.glitch_out_pin);
multicore_launch_core1(glitch_core1_thread);

View File

@ -1328,8 +1328,8 @@ int tool78_ocd_write(struct tool78_hw* hw, uint16_t addr, uint8_t len,
// command echoed back
rr = hw->recv(4, hdr, 1000);
printf("wr p1: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
hdr[1], hdr[2], hdr[3]);
//printf("wr p1: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
// hdr[1], hdr[2], hdr[3]);
if (rr != 4) return -2;
if (hdr[0] == 0xff) { // frame error bullshit
hdr[0] = hdr[1];
@ -1338,18 +1338,18 @@ int tool78_ocd_write(struct tool78_hw* hw, uint16_t addr, uint8_t len,
rr = hw->recv(1, &hdr[3], 1000);
if (rr != 1) return -2;
}
printf("wr p1: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
hdr[1], hdr[2], hdr[3]);
//printf("wr p1: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
// hdr[1], hdr[2], hdr[3]);
// status
rr = hw->recv(1, hdr, 1000);
printf("wr p2: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
hdr[1], hdr[2], hdr[3]);
//printf("wr p2: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
// hdr[1], hdr[2], hdr[3]);
if (rr != 1) return -1;
if (hdr[0] == len) {
rr = hw->recv(1, hdr, 1000);
printf("wr p2: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
hdr[1], hdr[2], hdr[3]);
//printf("wr p2: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
// hdr[1], hdr[2], hdr[3]);
if (rr != 1) return -1;
}
if (hdr[0] != 0x00) return -3;
@ -1360,8 +1360,8 @@ int tool78_ocd_write(struct tool78_hw* hw, uint16_t addr, uint8_t len,
rr = hw->send(1, hdr, -1);
if (rr != 1) return -1;
rr = hw->recv(1, hdr, 1000); // sigh
printf("wr p3: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
hdr[1], hdr[2], hdr[3]);
//printf("wr p3: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
// hdr[1], hdr[2], hdr[3]);
if (rr != 1) return -1;
for (int i = 0; i < len; i += 8) {
@ -1372,15 +1372,15 @@ int tool78_ocd_write(struct tool78_hw* hw, uint16_t addr, uint8_t len,
rr = hw->send(todo, &data[i], -1);
if (rr != todo) return -1;
rr = hw->recv(todo, NULL, 1000*todo); // sigh
printf("wr p4: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
hdr[1], hdr[2], hdr[3]);
//printf("wr p4: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
// hdr[1], hdr[2], hdr[3]);
if (rr != todo) return -1;
}
rr = hw->recv(1, hdr, 1000);
printf("wr p5: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
hdr[1], hdr[2], hdr[3]);
printf("recv %d: %02x %02x\n", rr, hdr[0], hdr[1]);
//printf("wr p5: rr=%d %02x %02x %02x %02x\n", rr, hdr[0],
// hdr[1], hdr[2], hdr[3]);
//printf("recv %d: %02x %02x\n", rr, hdr[0], hdr[1]);
if (rr != 1) return -1;
return (hdr[0] == 0) ? 0 : -2;
@ -1416,7 +1416,7 @@ int tool78_ocd_exec(struct tool78_hw* hw) {
// G13 sends status before exec, G10 sends it after
rr = hw->recv(is_g10 ? 1 : 2, hdr, 1000);
if (rr != 1 && rr != 2) return -1;
printf("exec r=%d: h[0]=0x%02x, h[1]=0x%02x\n", rr, hdr[0], hdr[1]);
//printf("exec r=%d: h[0]=0x%02x, h[1]=0x%02x\n", rr, hdr[0], hdr[1]);
return 0;//(hdr[0] == cmd) ? 0 : -2;
}

View File

@ -21,13 +21,13 @@ _start:
looper:
mov P0, #0xff
movw ax, #0xfae0
movw ax, #0xfce0
movw hl, ax
mov c, #0
mov c, #0x40
1: mov b, #0xff
mov a, #0xff
mov a, #0
2: inc a
dec b
@ -35,6 +35,7 @@ looper:
dec c
mov [hl+c], a
cmp0 c
bnz $1b
mov P0, #0
@ -52,7 +53,7 @@ looper:
call !!tool_tx
mov x, #0xaa
mov c, #0
mov c, #0x40
5: dec c
mov a, [hl+c]