Skip to content

Commit

Permalink
st-util: open usb can return sl pointer with no target connected.
Browse files Browse the repository at this point in the history
Check if connected target chip id is known. Some more info regarding
connected chip should be set in chipid to know if debugging / attach
is possible, but not yet. some more checks should be done to generate
flash map / handle flashing if flash type is not supported..
  • Loading branch information
grevaillot committed Apr 19, 2020
1 parent 3a10386 commit e90f809
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/gdbserver/gdb-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,14 @@ int main(int argc, char** argv) {
printf("st-util %s\n", STLINK_VERSION);

sl = do_connect(&state);
if (sl == NULL) return 1;
if (sl == NULL) {
return 1;
}

if (sl->chip_id == STLINK_CHIPID_UNKNOWN) {
ELOG("Unsupported Target (Chip ID is %#010x, Core ID is %#010x).\n", sl->chip_id, sl->core_id);
return 1;
}

connected_stlink = sl;
signal(SIGINT, &cleanup);
Expand All @@ -245,10 +252,7 @@ int main(int argc, char** argv) {
stlink_reset(sl);
}


// This is low-level information for debugging, not useful for normal use.
// So: Demoted to a debug meesage. -- REW
DLOG("Chip ID is %08x, Core ID is %08x.\n", sl->chip_id, sl->core_id);
DLOG("Chip ID is %#010x, Core ID is %#08x.\n", sl->chip_id, sl->core_id);

sl->verbose=0;
current_memory_map = make_memory_map(sl);
Expand Down Expand Up @@ -1852,7 +1856,8 @@ int serve(stlink_t *sl, st_state_t *st) {
stlink_close(sl);

sl = do_connect(st);
if (sl == NULL) cleanup(0);
if (sl == NULL || sl->chip_id == STLINK_CHIPID_UNKNOWN)
cleanup(0);
connected_stlink = sl;

if (st->reset) {
Expand Down

0 comments on commit e90f809

Please sign in to comment.