diff --git a/README.adoc b/README.adoc index a6bd5caf0..5372f1f02 100644 --- a/README.adoc +++ b/README.adoc @@ -21,10 +21,7 @@ Finally there is **Y**et **A**nother **Picoprobe** around, the YAPicoprobe. NOTE: Pico2 / RP2350 can also be used as probe hardware. This is an experimental feature. -WARNING: Pico2 / RP2350 targets are currently not supported. - -WARNING: Pico2 target is only working at <= 300kHz reliably. + - ``time /home/hardy/.pico-sdk/openocd/0.12.0+dev/openocd.exe -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /home/hardy/.pico-sdk/openocd/0.12.0+dev/scripts -f /home/hardy/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 349" -c "program {pio_blink.elf} verify reset; shutdown;"`` +WARNING: Pico2 / RP2350 targets are under development and experimental. ## Features @@ -125,6 +122,7 @@ NOTE: For best RP2040 support, OpenOCD bundled with PlatformIO is recommended. See <> +[[dap-optimization]] #### Parameter Optimization YAPicoprobe tries to identify the connecting tool and sets some internal parameters for best performance. @@ -157,6 +155,8 @@ DAP_PACKET_SIZE=64 DAP_PACKET_SIZE=64 |=== +Both parameters are also user settable, see <>. + #### SWD Adapter Speed The tools above allow specification of the adapter speed. This is the clock frequency between probe and target device. @@ -339,6 +339,7 @@ The Pico Debug Probe has four additional LEDs. Assignment is as follows: ## Configuration +[[runtime-configuration]] ### Runtime Configuration of Probe Parameters Several parameters can be configured via the Debug CDC of the probe. These parameters include @@ -351,26 +352,40 @@ Following procedure applies: * connect with a terminal program to the Debug CDC of the probe * unlock configuration thru hitting , this works as long there is no `pwd` * commands: `` -** `lock` - lock the configuration parameters -** `killall` - kill all current configuration parameters -** `reset` - restart the probe -** `show` - shows the current configuration (initially empty) ++ +[%autowidth] +|==== +| `help` | show available variables/cmds +| `lock` | lock the configuration parameters +| `killall` | kill all current configuration parameters +| `reset` | restart the probe +| `show` | show the current configuration (initially empty) +|==== * variables: `=` -** `f_cpu` - set CPU frequency in MHz -** `f_swd` - set SWD frequency in kHz -** `net` - set the net of the probes IP address `192.168..1` -** `nick` - set nickname of the probe. Use this with care because it also changes - the USB serial number (which might be intended) -** `pwd` - set a password for locking the configuration. Unlocking is done subsequently - with `pwd:` -** `r_start` / `r_end` - RAM start/end for generic target to override default 0x20000000..0x20040000. -** `rtt` - enable/disable RTT access, default is RTT enabled (0: disable, 1:enable). ++ +[%autowidth] +|==== +| `f_cpu` | set CPU frequency in MHz +| `f_swd` | set SWD frequency in kHz +| `net` | set the net of the probes IP address `192.168..1`, defaults to "14" +| `nick` | set nickname of the probe. Use this with care because it also changes + the USB serial number (which might be intended) +| `pwd` | set a password for locking the configuration. Unlocking is done subsequently with `pwd:` +| `ram_start` + + `ram_end` | RAM start/end for generic target to override default 0x20000000..0x20040000. This is mainly for + RTT detection +| `rtt` | enable/disable RTT access, default is RTT enabled (0: disable, 1:enable) +| `dap_psize` + + `dap_pcnt`| set `DAP_PACKET_SIZE` and `DAP_PACKET_COUNT`, see <>. If only one of those values + is set, the other goes to a default (64/1) +|==== * special characters: ** CR/LF - end the line ** BS - backspace one character -* unknown commands / variables are ignored +* unknown commands / variables are ignored and lock configuration * if configuration is locked, all commands are ignored (except `pwd:`) + [NOTE] ==== * the interface is far from perfect diff --git a/include/picoprobe_config.h b/include/picoprobe_config.h index 0484b5946..5d2e6d003 100755 --- a/include/picoprobe_config.h +++ b/include/picoprobe_config.h @@ -93,18 +93,19 @@ // // minIni definitions // -#define MININI_VAR_NET "net" -#define MININI_VAR_NICK "nick" -#define MININI_VAR_FCPU "f_cpu" -#define MININI_VAR_FSWD "f_swd" -#define MININI_VAR_RSTART "r_start" -#define MININI_VAR_REND "r_end" -#define MININI_VAR_PWD "pwd" -#define MININI_VAR_RTT "rtt" -#define MININI_VAR_DPSIZE "d_psize" +#define MININI_VAR_NET "net" +#define MININI_VAR_NICK "nick" +#define MININI_VAR_FCPU "f_cpu" +#define MININI_VAR_FSWD "f_swd" +#define MININI_VAR_RSTART "ram_start" +#define MININI_VAR_REND "ram_end" +#define MININI_VAR_PWD "pwd" +#define MININI_VAR_RTT "rtt" +#define MININI_VAR_DAP_PSIZE "dap_psize" +#define MININI_VAR_DAP_PCNT "dap_pcnt" #define MININI_VAR_NAMES MININI_VAR_NET, MININI_VAR_NICK, MININI_VAR_FCPU, MININI_VAR_FSWD, \ MININI_VAR_RSTART, MININI_VAR_REND, MININI_VAR_PWD, MININI_VAR_RTT, \ - MININI_VAR_DPSIZE + MININI_VAR_DAP_PSIZE, MININI_VAR_DAP_PCNT #endif diff --git a/src/cdc/cdc_debug.c b/src/cdc/cdc_debug.c index 757f55cd0..59e31f80a 100644 --- a/src/cdc/cdc_debug.c +++ b/src/cdc/cdc_debug.c @@ -216,10 +216,10 @@ static void cdc_debug_command_if(uint8_t ch) } } else if (unlocked) { + static const char *minini_varnames[] = {MININI_VAR_NAMES, NULL}; + p = strchr(cmd, '='); if (p != NULL) { - static const char *minini_varnames[] = {MININI_VAR_NAMES, NULL}; - *p = '\0'; ++p; @@ -245,7 +245,8 @@ static void cdc_debug_command_if(uint8_t ch) } } else { - picoprobe_error("unknown var: '%s'\n", cmd); + picoprobe_error("unknown var: '%s' -> locked\n", cmd); + unlocked = false; } } else if (strcmp(cmd, "lock") == 0) { @@ -268,8 +269,23 @@ static void cdc_debug_command_if(uint8_t ch) for (;;) { } } + else if (strcmp(cmd, "help") == 0) { + printf("------------- commands\n"); + printf(" help - show available variables/cmds\n"); + printf(" lock - lock the configuration parameters\n"); + printf(" killall - kill all current configuration parameters\n"); + printf(" reset - restart the probe\n"); + printf(" show - show the current configuration (initially empty)\n"); + printf(" = set a variable to \n (probe resets after every change)\n"); + printf("------------- ini variables\n"); + for (uint32_t ndx = 0; minini_varnames[ndx] != NULL; ++ndx) { + printf(" %s\n", minini_varnames[ndx]); + } + printf("-------------\n"); + } else { - picoprobe_error("unknown cmd: '%s'\n", cmd); + picoprobe_error("unknown cmd: '%s' (use 'help') -> locked\n", cmd); + unlocked = false; } } else { diff --git a/src/cmsis-dap/dap_server.c b/src/cmsis-dap/dap_server.c index fc6ffa5fb..910f807c5 100755 --- a/src/cmsis-dap/dap_server.c +++ b/src/cmsis-dap/dap_server.c @@ -179,12 +179,19 @@ void dap_task(void *ptr) // if (tool == E_DAPTOOL_UNKNOWN) { uint32_t psize; + uint32_t pcnt; - psize = ini_getl(MININI_SECTION, MININI_VAR_DPSIZE, 0, MININI_FILENAME); - if (psize != 0) + psize = ini_getl(MININI_SECTION, MININI_VAR_DAP_PSIZE, 0, MININI_FILENAME); + pcnt = ini_getl(MININI_SECTION, MININI_VAR_DAP_PCNT, 0, MININI_FILENAME); + if (psize != 0 || pcnt != 0) { - dap_packet_count = 1; - dap_packet_size = psize; + dap_packet_count = (pcnt != 0) ? pcnt : _DAP_PACKET_COUNT_UNKNOWN; + dap_packet_size = (psize != 0) ? psize : _DAP_PACKET_SIZE_UNKNOWN; + dap_packet_size = MIN(dap_packet_size, PACKET_MAXSIZE); + if (dap_packet_count * dap_packet_size > BUFFER_MAXSIZE) { + dap_packet_size = MIN(dap_packet_size, BUFFER_MAXSIZE); + dap_packet_count = BUFFER_MAXSIZE / dap_packet_size; + } tool = E_DAPTOOL_USER; } else @@ -215,7 +222,7 @@ void dap_task(void *ptr) (tool == E_DAPTOOL_OPENOCD) ? "OpenOCD" : (tool == E_DAPTOOL_PYOCD) ? "pyOCD" : (tool == E_DAPTOOL_PROBERS) ? "probe-rs" : - (tool == E_DAPTOOL_USER) ? "user" : "UNKNOWN", dap_packet_count, dap_packet_size); + (tool == E_DAPTOOL_USER) ? "user-set" : "UNKNOWN", dap_packet_count, dap_packet_size); led_state(LS_DAPV2_CONNECTED); } } diff --git a/src/lib/minIni/minGlue-Flash.c b/src/lib/minIni/minGlue-Flash.c index 973401bab..4b05fed06 100755 --- a/src/lib/minIni/minGlue-Flash.c +++ b/src/lib/minIni/minGlue-Flash.c @@ -372,13 +372,13 @@ int ini_init(void) static void PrintDataStatus(MinIniFlashFileHeader *hp, const unsigned char *dataName) { - picoprobe_info("magic 0x%08x\n", hp->magicNumber); + printf("magic 0x%08x\n", hp->magicNumber); if (hp->magicNumber == MININI_FLASH_MAGIC_DATA_NUMBER_ID) { - picoprobe_info(" name: %s\n", hp->dataName); - picoprobe_info(" size: %d\n", hp->dataSize); + printf(" name: %s\n", hp->dataName); + printf(" size: %d\n", hp->dataSize); } else { - picoprobe_info(" \n"); + printf(" \n"); } } // PrintDataStatus @@ -389,9 +389,10 @@ void ini_print_all(void) MinIniFlashFileHeader *hp; const unsigned char *p; + printf("------------- ini status\n"); hp = (MinIniFlashFileHeader*)MININI_CONFIG_FLASH_NVM_ADDR_START; PrintDataStatus(hp, (const unsigned char*)MININI_FILENAME); - picoprobe_info("------------- device configuration\n"); + printf("------------- device configuration\n"); if (hp->magicNumber == MININI_FLASH_MAGIC_DATA_NUMBER_ID) { p = (const unsigned char*)hp + sizeof(MinIniFlashFileHeader); for (size_t i = 0; i < hp->dataSize; i++) { @@ -399,5 +400,5 @@ void ini_print_all(void) p++; } } - picoprobe_info("-------------\n"); + printf("-------------\n"); } // ini_print_all