Skip to content

Commit 382bf9c

Browse files
committed
Book: update for firmware version 1.8 and hardware version 2.3.
BMDebug: autocompletion for help & info commands. BMFlash: added copyright in help/about. Nuklear: respond to button-release of the mouse button, rather than on mouse press.
1 parent c7299de commit 382bf9c

File tree

11 files changed

+43
-302
lines changed

11 files changed

+43
-302
lines changed

‎BlackMagicProbe.pdf‎

2.41 MB
Binary file not shown.

‎doc/BlackMagicProbe.odt‎

373 KB
Binary file not shown.

‎doc/bmp-v23-top.jpg‎

104 KB
Loading

‎doc/bmp-v23.jpg‎

48.9 KB
Loading

‎doc/bmp21_original.png‎

-878 Bytes
Loading

‎doc/github_hash.png‎

19.8 KB
Loading

‎source/bmdebug.c‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,14 +807,14 @@ static int console_autocomplete(char *text, size_t textsize, const DWARF_SYMBOLL
807807
{ "down", NULL, NULL },
808808
{ "enable", NULL, NULL },
809809
{ "file", NULL, "%path" },
810-
{ "find", NULL, NULL },
810+
{ "find", NULL, "%func %var" },
811811
{ "finish", "fin", NULL },
812812
{ "frame", "f", NULL },
813-
{ "help", NULL, "break breakpoints data files keyboard monitor running serial stack status support svd trace user-defined" },
813+
{ "help", NULL, "assembly break breakpoints data files find keyboard monitor running serial stack status support svd trace user-defined" },
814814
{ "info", NULL, "args breakpoints frame functions locals scope set sources stack svd variables vtbl" },
815815
{ "list", NULL, "%func %var %file" },
816816
{ "load", NULL, NULL },
817-
{ "monitor", "mon", "connect_srst hard_srst jtag_scan morse option swdp_scan targets tpwr traceswo vector_catch" },
817+
{ "monitor", "mon", "connect_srst frequency halt_timeout hard_srst heapinfo jtag_scan morse option swdp_scan targets tpwr traceswo vector_catch" },
818818
{ "next", "n", NULL },
819819
{ "print", "p", "%var %reg" },
820820
{ "ptype", NULL, "%var" },
@@ -4055,6 +4055,10 @@ static bool handle_help_cmd(char *command, STRINGLIST *textroot, int *active,
40554055
*active = POPUP_HELP;
40564056
*reformat = nk_true; /* by default, reformat (overruled for "help mon") */
40574057
if (*cmdptr == '\0') {
4058+
stringlist_append(textroot, "BMDebug is a GDB front-end, specifcally for embedded debugging with the Black Magic Probe.", 0);
4059+
stringlist_append(textroot, "Copyright 2019-2022 CompuPhase", 0);
4060+
stringlist_append(textroot, "Licensed under the Apache License version 2.0", 0);
4061+
stringlist_append(textroot, "", 0);
40584062
stringlist_append(textroot, "Front-end topics.", 0);
40594063
stringlist_append(textroot, "", 0);
40604064
stringlist_append(textroot, "assembly -- show assembly mixed with source code.", 0);
@@ -4124,6 +4128,7 @@ static bool handle_help_cmd(char *command, STRINGLIST *textroot, int *active,
41244128
stringlist_append(textroot, "", 0);
41254129
stringlist_append(textroot, "reset -- restart the target program; keep breakpoints and variable watches.", 0);
41264130
stringlist_append(textroot, "reset hard -- restart both the debugger and the target program.", 0);
4131+
stringlist_append(textroot, "reset load -- restart the debugger and reload the target program.", 0);
41274132
return true;
41284133
} else if (TERM_EQU(cmdptr, "serial", 6)) {
41294134
stringlist_append(textroot, "Configure the serial monitor.", 0);
@@ -5314,6 +5319,10 @@ static void help_popup(struct nk_context *ctx, APPSTATE *state, float canvas_wid
53145319
nk_group_set_scroll(ctx, "help", xoffs, yoffs);
53155320
}
53165321

5322+
/* other keyboard functions */
5323+
if (nk_input_is_key_pressed(&ctx->input, NK_KEY_TAB))
5324+
console_autocomplete(state->help_edit, sizearray(state->help_edit), &dwarf_symboltable);
5325+
53175326
nk_popup_end(ctx);
53185327
} else {
53195328
state->popup_active = POPUP_NONE;

‎source/bmflash.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ static int help_popup(struct nk_context *ctx)
639639
"Black Magic Probe. It automatically handles idiosyncrasies of MCU\n"
640640
"families, and supports setting a serial number during the download\n"
641641
"(i.e. serialization). It does not require GDB.\n\n"
642+
"Copyright 2019-2022 CompuPhase\n"
643+
"Licensed under the Apache License version 2.0\n\n"
642644
"^3Options\n"
643645
"The MCU family must be set for post-processing the ELF file or\n"
644646
"performing additional configurations before the download. It is\n"

‎source/nuklear.c‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11997,6 +11997,12 @@ nk_input_button(struct nk_context *ctx, enum nk_buttons id, int x, int y, nk_boo
1199711997
btn->clicked_pos.y = (float)y;
1199811998
btn->down = down;
1199911999
btn->clicked++;
12000+
#ifdef NK_BUTTON_TRIGGER_ON_RELEASE
12001+
if (down == 1 && id == NK_BUTTON_LEFT) {
12002+
in->mouse.down_pos.x = btn->clicked_pos.x;
12003+
in->mouse.down_pos.y = btn->clicked_pos.y;
12004+
}
12005+
#endif
1200012006
}
1200112007
NK_API void
1200212008
nk_input_scroll(struct nk_context *ctx, struct nk_vec2 val)
@@ -12057,8 +12063,14 @@ nk_input_has_mouse_click_in_rect(const struct nk_input *i, enum nk_buttons id,
1205712063
const struct nk_mouse_button *btn;
1205812064
if (!i) return nk_false;
1205912065
btn = &i->mouse.buttons[id];
12060-
if (!NK_INBOX(btn->clicked_pos.x,btn->clicked_pos.y,b.x,b.y,b.w,b.h))
12061-
return nk_false;
12066+
#ifdef NK_BUTTON_TRIGGER_ON_RELEASE
12067+
if (!NK_INBOX(btn->clicked_pos.x,btn->clicked_pos.y,b.x,b.y,b.w,b.h)
12068+
|| !NK_INBOX(i->mouse.down_pos.x,i->mouse.down_pos.y,b.x,b.y,b.w,b.h))
12069+
return nk_false;
12070+
#else
12071+
if (!NK_INBOX(btn->clicked_pos.x,btn->clicked_pos.y,b.x,b.y,b.w,b.h))
12072+
return nk_false;
12073+
#endif
1206212074
return nk_true;
1206312075
}
1206412076
NK_API nk_bool
@@ -21513,7 +21525,8 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
2151321525
}
2151421526

2151521527
/* draw text */
21516-
{struct nk_color background_color;
21528+
{ /* local block */
21529+
struct nk_color background_color;
2151721530
struct nk_color text_color;
2151821531
struct nk_color sel_background_color;
2151921532
struct nk_color sel_text_color;
@@ -21632,7 +21645,8 @@ nk_do_edit(nk_flags *state, struct nk_command_buffer *out,
2163221645
nk_fill_rect(out, label, 0, cursor_color);
2163321646
nk_widget_text(out, label, cursor_ptr, glyph_len, &txt, NK_TEXT_LEFT, font);
2163421647
}
21635-
}}
21648+
}
21649+
} /* end local */
2163621650
} else {
2163721651
/* not active so just draw text */
2163821652
int l = nk_str_len_char(&edit->string);
@@ -21792,14 +21806,18 @@ nk_edit_buffer(struct nk_context *ctx, nk_flags flags,
2179221806
if (flags & NK_EDIT_CLIPBOARD)
2179321807
edit->clip = ctx->clip;
2179421808
edit->active = (unsigned char)win->edit.active;
21795-
} else edit->active = nk_false;
21809+
} else {
21810+
edit->active = nk_false;
21811+
}
21812+
if (nk_is_popup_open(ctx))
21813+
edit->active = nk_false;
2179621814
edit->mode = win->edit.mode;
2179721815

2179821816
filter = (!filter) ? nk_filter_default: filter;
2179921817
prev_state = (unsigned char)edit->active;
2180021818
in = (flags & NK_EDIT_READ_ONLY) ? 0: in;
2180121819
ret_flags = nk_do_edit(&ctx->last_widget_state, &win->buffer, bounds, flags,
21802-
filter, edit, &style->edit, in, style->font);
21820+
filter, edit, &style->edit, in, style->font);
2180321821

2180421822
if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER)
2180521823
ctx->style.cursor_active = ctx->style.cursors[NK_CURSOR_TEXT];
@@ -23797,9 +23815,9 @@ nk_is_popup_open(struct nk_context *ctx)
2379723815
struct nk_window *popup;
2379823816

2379923817
NK_ASSERT(ctx != NULL);
23800-
win = ctx->current;
2380123818
if (ctx->current != ctx->active)
2380223819
return nk_false;
23820+
win = ctx->current;
2380323821
popup = win->popup.win;
2380423822
return (popup != NULL);
2380523823
}

0 commit comments

Comments
 (0)