probes: add probe-config profiles loaded from probes.yaml
- new modules/probes/ parses probes.yaml (libyaml): a defaults: map applied on every jtag_open + named profiles: selected with `jtag_open <idx> <profile>` (jtag_profiles lists them); each value is pushed into the script envvar store the driver reads at open time - ships a flashpro profile (ADBUS4 high-Z) that lets the IGLOO2 kit's embedded FlashPro (FT4232H, port 0) detect the chain - CLAUDE.md: decision entry for probes.yaml + a design note on the probe / JTAG-link / device config strategy (driver-neutral link layer) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "bsdl_parser/bsdl_loader.h"
|
||||
#include "os_interface/os_interface.h"
|
||||
#include "fpga/fpga.h"
|
||||
#include "probes/probes.h"
|
||||
#include "bscan_spi/bscan_spi.h"
|
||||
#include "spi_flash/spi_flash.h"
|
||||
|
||||
@@ -1802,10 +1803,21 @@ static int cmd_print_probes_list(script_ctx *ctx, char *line)
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
|
||||
/* Push one probes.yaml key/value into the script envvar store — the same
|
||||
* store config.script writes and the driver reads at open time. */
|
||||
static void probe_envvar_set(void *user, const char *key, const char *value)
|
||||
{
|
||||
script_ctx *ctx = (script_ctx *)user;
|
||||
setEnvVarDat((envvar_entry *)ctx->env, (char *)key, (char *)value);
|
||||
}
|
||||
|
||||
const char *cmd_open_probe_help[] = {
|
||||
"<probe>(int)", // Arguments "1<arg>(type) ..."
|
||||
"<probe>(int) [profile](str)", // Arguments "1<arg>(type) ..."
|
||||
"Open a probe by its index from jtag_probes (0, 1, 2, ...).",
|
||||
"A raw 0x-prefixed probe id (as printed after the index) also works.",
|
||||
"Optional [profile] applies a probe-config profile from probes.yaml",
|
||||
"(e.g. 'flashpro'); jtag_profiles lists them. The profile's variables",
|
||||
"override the probes.yaml defaults for this open.",
|
||||
""
|
||||
};
|
||||
static int cmd_open_probe(script_ctx *ctx, char *line)
|
||||
@@ -1813,6 +1825,7 @@ static int cmd_open_probe(script_ctx *ctx, char *line)
|
||||
int ret;
|
||||
int id;
|
||||
char probe_id[64];
|
||||
char profile[64];
|
||||
jtag_core *jc;
|
||||
|
||||
jc = (jtag_core *)ctx->app_ctx;
|
||||
@@ -1836,6 +1849,20 @@ static int cmd_open_probe(script_ctx *ctx, char *line)
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the probes.yaml defaults, then the optional named profile,
|
||||
// into the envvar store the driver reads when it initialises.
|
||||
probe_apply_defaults(probe_envvar_set, ctx);
|
||||
if (get_param(ctx, line, 2, profile) > 0)
|
||||
{
|
||||
if (probe_apply_profile(profile, probe_envvar_set, ctx) < 0)
|
||||
{
|
||||
ctx->script_printf(ctx, MSG_ERROR,
|
||||
"Unknown probe profile '%s'. Run jtag_profiles to list them.\n", profile);
|
||||
return JTAG_CORE_BAD_PARAMETER;
|
||||
}
|
||||
ctx->script_printf(ctx, MSG_INFO_0, "Applied probe profile '%s'.\n", profile);
|
||||
}
|
||||
|
||||
ret = jtagcore_select_and_open_probe(jc, id);
|
||||
if (ret != JTAG_CORE_NO_ERROR)
|
||||
{
|
||||
@@ -1889,6 +1916,32 @@ static int cmd_close_probe(script_ctx *ctx, char *line)
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
|
||||
const char *cmd_profiles_help[] = {
|
||||
"",
|
||||
"List the probe-config profiles defined in probes.yaml.",
|
||||
"Apply one when opening: jtag_open <index> <profile>.",
|
||||
""
|
||||
};
|
||||
static int cmd_profiles(script_ctx *ctx, char *line)
|
||||
{
|
||||
int i, n;
|
||||
const char *src;
|
||||
|
||||
(void)line;
|
||||
n = probe_profile_count();
|
||||
src = probe_config_source();
|
||||
if (!src)
|
||||
{
|
||||
ctx->script_printf(ctx, MSG_INFO_0,
|
||||
"No probes.yaml loaded; using built-in / config.script defaults.\n");
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
ctx->script_printf(ctx, MSG_INFO_0, "%d probe profile(s) in %s:\n", n, src);
|
||||
for (i = 0; i < n; i++)
|
||||
ctx->script_printf(ctx, MSG_NONE, " %s\n", probe_profile_name(i));
|
||||
return JTAG_CORE_NO_ERROR;
|
||||
}
|
||||
|
||||
const char *cmd_load_bsdl_help[] = {
|
||||
"<file>(string) <device>(int)",
|
||||
"Load/attach a bsdl file to a device into the chain.",
|
||||
@@ -3368,6 +3421,7 @@ cmd_list script_commands_list[] =
|
||||
{"jtag_probes", cmd_print_probes_list, cmd_print_probes_list_help},
|
||||
{"jtag_open", cmd_open_probe, cmd_open_probe_help},
|
||||
{"jtag_close", cmd_close_probe, cmd_close_probe_help},
|
||||
{"jtag_profiles", cmd_profiles, cmd_profiles_help},
|
||||
{"jtag_autoinit", cmd_autoinit, cmd_autoinit_help},
|
||||
{"jtag_scan", cmd_init_and_scan, cmd_init_and_scan_help},
|
||||
{"jtag_ndev", cmd_print_nb_dev, cmd_print_nb_dev_help},
|
||||
|
||||
Reference in New Issue
Block a user