From a1a949fa5598c3d2e014d276e7e52aeb8d62f3e4 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Mon, 30 Jan 2012 13:32:18 +0100 Subject: [PATCH] Limit reading from RAM to the SRAM Size --- flash/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flash/main.c b/flash/main.c index 387a335..249e5fd 100644 --- a/flash/main.c +++ b/flash/main.c @@ -148,6 +148,12 @@ int main(int ac, char** av) } else /* read */ { + if ((o.addr >= sl->flash_base) && + (o.addr < sl->flash_base + sl->flash_size)) + o.size = sl->flash_size; + else if ((o.addr >= sl->sram_base) && + (o.addr < sl->sram_base + sl->sram_size)) + o.size = sl->sram_size; err = stlink_fread(sl, o.filename, o.addr, o.size); if (err == -1) {