diff options
author | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-05-04 13:26:52 +0200 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2010-05-05 15:24:24 +0200 |
commit | 82ea640830fe13f9ab8ef33c65a76480b697f856 (patch) | |
tree | 3db8a893b3bf7ac1fd7d92cf39691a8f5fe0a69d /src/flash/nor/core.c | |
parent | 812e21ac396247767da0144748b5f52ad11b3e17 (diff) |
gdb: connect will now fail if flash autoprobe fails
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>
Diffstat (limited to 'src/flash/nor/core.c')
-rw-r--r-- | src/flash/nor/core.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index e6c0eeb2..232d5037 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -220,22 +220,25 @@ struct flash_bank *get_flash_bank_by_name(const char *name) return NULL; } -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) - return NULL; + { + return ERROR_FAIL; + } retval = p->driver->auto_probe(p); if (retval != ERROR_OK) { LOG_ERROR("auto_probe failed %d\n", retval); - return NULL; + return retval; } - return p; + *bank = p; + return ERROR_OK; } /* lookup flash bank by address */ |