summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
812e21a)
This stops GDB from launching with an empty memory map,
making gdb load w/flashing fail for no obvious reason.
The error message points in the direction of the gdb-attach
event that can be set up to issue a halt or "reset init"
which will put GDB in a well defined stated upon attach
and thus have a robust flash autoprobe.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
-struct flash_bank *get_flash_bank_by_num(int num)
+int get_flash_bank_by_num(int num, struct flash_bank **bank)
{
struct flash_bank *p = get_flash_bank_by_num_noprobe(num);
int retval;
if (p == NULL)
{
struct flash_bank *p = get_flash_bank_by_num_noprobe(num);
int retval;
if (p == NULL)
+ {
+ return ERROR_FAIL;
+ }
retval = p->driver->auto_probe(p);
if (retval != ERROR_OK)
{
LOG_ERROR("auto_probe failed %d\n", retval);
retval = p->driver->auto_probe(p);
if (retval != ERROR_OK)
{
LOG_ERROR("auto_probe failed %d\n", retval);
+ *bank = p;
+ return ERROR_OK;
}
/* lookup flash bank by address */
}
/* lookup flash bank by address */
/**
* Returns a flash bank by the specified flash_bank_s bank_number, @a num.
* @param num The flash bank number.
/**
* Returns a flash bank by the specified flash_bank_s bank_number, @a num.
* @param num The flash bank number.
- * @returns A struct flash_bank for flash bank @a num, or NULL
+ * @param bank returned bank if fn returns ERROR_OK
+ * @returns ERROR_OK if successful
-struct flash_bank *get_flash_bank_by_num(int num);
+int get_flash_bank_by_num(int num, struct flash_bank **bank);
/**
* Retreives @a bank from a command argument, reporting errors parsing
* the bank identifier or retreiving the specified bank. The bank
/**
* Retreives @a bank from a command argument, reporting errors parsing
* the bank identifier or retreiving the specified bank. The bank
unsigned bank_num;
COMMAND_PARSE_NUMBER(uint, name, bank_num);
unsigned bank_num;
COMMAND_PARSE_NUMBER(uint, name, bank_num);
- *bank = get_flash_bank_by_num(bank_num);
- if (!*bank)
- {
- command_print(CMD_CTX, "flash bank '%s' not found", name);
- return ERROR_INVALID_ARGUMENTS;
- }
- return ERROR_OK;
+ return get_flash_bank_by_num(bank_num, bank);
uint32_t last;
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr);
uint32_t last;
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr);
- struct flash_bank *p = get_flash_bank_by_num(bank_nr);
- if (!p)
- return ERROR_OK;
+
+ struct flash_bank *p;
+ int retval;
+ retval = get_flash_bank_by_num(bank_nr, &p);
+ if (retval != ERROR_OK)
+ return retval;
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], first);
if (strcmp(CMD_ARGV[2], "last") == 0)
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], first);
if (strcmp(CMD_ARGV[2], "last") == 0)
else
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], last);
else
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], last);
if ((retval = flash_check_sector_parameters(CMD_CTX,
first, last, p->num_sectors)) != ERROR_OK)
return retval;
if ((retval = flash_check_sector_parameters(CMD_CTX,
first, last, p->num_sectors)) != ERROR_OK)
return retval;
uint32_t last;
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr);
uint32_t last;
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr);
- struct flash_bank *p = get_flash_bank_by_num(bank_nr);
- if (!p)
- return ERROR_OK;
+ struct flash_bank *p;
+ int retval = get_flash_bank_by_num(bank_nr, &p);
+ if (retval != ERROR_OK)
+ return retval;
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], first);
if (strcmp(CMD_ARGV[2], "last") == 0)
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], first);
if (strcmp(CMD_ARGV[2], "last") == 0)
bool set;
COMMAND_PARSE_ON_OFF(CMD_ARGV[3], set);
bool set;
COMMAND_PARSE_ON_OFF(CMD_ARGV[3], set);
if ((retval = flash_check_sector_parameters(CMD_CTX,
first, last, p->num_sectors)) != ERROR_OK)
return retval;
if ((retval = flash_check_sector_parameters(CMD_CTX,
first, last, p->num_sectors)) != ERROR_OK)
return retval;
gdb_putback_char(connection, initial_ack);
target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_ATTACH);
gdb_putback_char(connection, initial_ack);
target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_ATTACH);
+ if (gdb_use_memory_map)
+ {
+ /* Connect must fail if the memory map can't be set up correctly.
+ *
+ * This will cause an auto_probe to be invoked, which is either
+ * a no-op or it will fail when the target isn't ready(e.g. not halted).
+ */
+ int i;
+ for (i = 0; i < flash_get_bank_count(); i++)
+ {
+ struct flash_bank *p;
+ retval = get_flash_bank_by_num(i, &p);
+ if (retval != ERROR_OK)
+ {
+ LOG_ERROR("Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect.");
+ return retval;
+ }
+ }
+ }
+
gdb_actual_connections++;
LOG_DEBUG("New GDB Connection: %d, Target %s, state: %s",
gdb_actual_connections,
gdb_actual_connections++;
LOG_DEBUG("New GDB Connection: %d, Target %s, state: %s",
gdb_actual_connections,
banks = malloc(sizeof(struct flash_bank *)*flash_get_bank_count());
for (i = 0; i < flash_get_bank_count(); i++) {
banks = malloc(sizeof(struct flash_bank *)*flash_get_bank_count());
for (i = 0; i < flash_get_bank_count(); i++) {
- p = get_flash_bank_by_num(i);
- if (p == NULL) {
+ retval = get_flash_bank_by_num(i, &p);
+ if (retval != ERROR_OK)
+ {
gdb_send_error(connection, retval);
return retval;
}
gdb_send_error(connection, retval);
return retval;
}
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)