hosted: Addition of selectable fast polling for hosted use cases

This commit is contained in:
Dave Marples 2022-08-29 18:18:54 +01:00 committed by Rachel Mant
parent 470609cec2
commit 868e76b2d0
5 changed files with 19 additions and 3 deletions

View File

@ -222,6 +222,7 @@ int gdb_main_loop(struct target_controller *tc, bool in_syscall)
char c = (char)gdb_if_getchar_to(0); char c = (char)gdb_if_getchar_to(0);
if(c == '\x03' || c == '\x04') if(c == '\x03' || c == '\x04')
target_halt_request(cur_target); target_halt_request(cur_target);
platform_pace_poll();
#ifdef ENABLE_RTT #ifdef ENABLE_RTT
if (rtt_enabled) if (rtt_enabled)
poll_rtt(cur_target); poll_rtt(cur_target);

View File

@ -28,8 +28,10 @@
#if PC_HOSTED == 1 #if PC_HOSTED == 1
void platform_init(int argc, char **argv); void platform_init(int argc, char **argv);
void platform_pace_poll(void);
#else #else
void platform_init(void); void platform_init(void);
inline void platform_pace_poll(void) { }
#endif #endif
typedef struct platform_timeout platform_timeout; typedef struct platform_timeout platform_timeout;

View File

@ -159,6 +159,8 @@ static void cl_help(char **argv)
"\t-j, --jtag Use JTAG instead of SWD\n" "\t-j, --jtag Use JTAG instead of SWD\n"
"\t-A, --auto-scan Automatic scanning - try JTAG first, then SWD\n" "\t-A, --auto-scan Automatic scanning - try JTAG first, then SWD\n"
"\t-C, --hw-reset Connect to target under hardware reset\n" "\t-C, --hw-reset Connect to target under hardware reset\n"
"\t-F, --fast-poll Poll the target for execution status at maximum speed at\n"
"\t the expense of increased CPU and USB resource utilisation.\n"
"\t-t, --list-chain Perform a chain scan and display information about the\n" "\t-t, --list-chain Perform a chain scan and display information about the\n"
"\t conected devices\n" "\t conected devices\n"
"\t-T, --timing Perform continues read- or write-back of a value to allow\n" "\t-T, --timing Perform continues read- or write-back of a value to allow\n"
@ -205,6 +207,7 @@ static const struct option long_options[] = {
{"probe", required_argument, NULL, 'P'}, {"probe", required_argument, NULL, 'P'},
{"serial", required_argument, NULL, 's'}, {"serial", required_argument, NULL, 's'},
{"ftdi-type", required_argument, NULL, 'c'}, {"ftdi-type", required_argument, NULL, 'c'},
{"fast-poll", no_argument, NULL, 'F'},
{"number", required_argument, NULL, 'n'}, {"number", required_argument, NULL, 'n'},
{"jtag", no_argument, NULL, 'j'}, {"jtag", no_argument, NULL, 'j'},
{"auto-scan", no_argument, NULL, 'A'}, {"auto-scan", no_argument, NULL, 'A'},
@ -236,7 +239,7 @@ void cl_init(BMP_CL_OPTIONS_t *opt, int argc, char **argv)
opt->opt_max_swj_frequency = 4000000; opt->opt_max_swj_frequency = 4000000;
opt->opt_scanmode = BMP_SCAN_SWD; opt->opt_scanmode = BMP_SCAN_SWD;
opt->opt_mode = BMP_MODE_DEBUG; opt->opt_mode = BMP_MODE_DEBUG;
while((c = getopt_long(argc, argv, "eEhHv:d:f:s:I:c:Cln:m:M:wVtTa:S:jApP:rR::", long_options, NULL)) != -1) { while((c = getopt_long(argc, argv, "eEFhHv:d:f:s:I:c:Cln:m:M:wVtTa:S:jApP:rR::", long_options, NULL)) != -1) {
switch(c) { switch(c) {
case 'c': case 'c':
if (optarg) if (optarg)
@ -273,6 +276,9 @@ void cl_init(BMP_CL_OPTIONS_t *opt, int argc, char **argv)
if (optarg) if (optarg)
opt->opt_device = optarg; opt->opt_device = optarg;
break; break;
case 'F':
opt->fast_poll = true;
break;
case 'f': case 'f':
if (optarg) { if (optarg) {
char *p; char *p;

View File

@ -53,13 +53,14 @@ typedef struct BMP_CL_OPTIONS_s {
bool opt_list_only; bool opt_list_only;
bool opt_connect_under_reset; bool opt_connect_under_reset;
bool external_resistor_swd; bool external_resistor_swd;
bool fast_poll;
bool opt_no_hl; bool opt_no_hl;
char *opt_flash_file; char *opt_flash_file;
char *opt_device; char *opt_device;
char *opt_serial; char *opt_serial;
uint32_t opt_targetid; uint32_t opt_targetid;
char *opt_ident_string; char *opt_ident_string;
int opt_position; int opt_position;
char *opt_cable; char *opt_cable;
char *opt_monitor; char *opt_monitor;
int opt_debuglevel; int opt_debuglevel;
@ -67,7 +68,7 @@ typedef struct BMP_CL_OPTIONS_s {
uint32_t opt_flash_start; uint32_t opt_flash_start;
uint32_t opt_max_swj_frequency; uint32_t opt_max_swj_frequency;
size_t opt_flash_size; size_t opt_flash_size;
}BMP_CL_OPTIONS_t; } BMP_CL_OPTIONS_t;
void cl_init(BMP_CL_OPTIONS_t *opt, int argc, char **argv); void cl_init(BMP_CL_OPTIONS_t *opt, int argc, char **argv);
int cl_execute(BMP_CL_OPTIONS_t *opt); int cl_execute(BMP_CL_OPTIONS_t *opt);

View File

@ -483,6 +483,12 @@ void platform_buffer_flush(void)
} }
} }
void platform_pace_poll(void)
{
if (!cl_opts.fast_poll)
platform_delay(8);
}
void platform_target_clk_output_enable(const bool enable) void platform_target_clk_output_enable(const bool enable)
{ {
switch (info.bmp_type) { switch (info.bmp_type) {