summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMirko <mirko@GLMC02DW6PBML85.local>2023-11-08 15:14:19 +0000
committerMirko <mirko@GLMC02DW6PBML85.local>2023-11-08 15:14:19 +0000
commit3cb15d7da2deb69a38940d1fa82570771252951b (patch)
tree6e921cf1eda92ee0f7ad6b34c04fd92da8ec36a4
parentb1d99a2fc22af6935f714525641a01483c076b3c (diff)
final
-rw-r--r--src/st-flash/flash.c1
-rw-r--r--src/st-flash/flash_opts.c2
-rw-r--r--src/stlink-lib/chipid.c2
-rw-r--r--src/stlink-lib/common_flash.c3
4 files changed, 4 insertions, 4 deletions
diff --git a/src/st-flash/flash.c b/src/st-flash/flash.c
index c2cd77a..0b7c0cf 100644
--- a/src/st-flash/flash.c
+++ b/src/st-flash/flash.c
@@ -62,6 +62,7 @@ static void usage(void) {
puts("example read option control register1 byte: ./st-flash --area=optcr1 read");
puts("example write option control register1 byte: ./st-flash --area=optcr1 write 0xXXXXXXXX");
puts("example read OTP area: ./st-flash --area=otp read [path]");
+ puts("example write OTP area: ./st-flash --area=otp write [path] 0xXXXXXXXX");
}
int32_t main(int32_t ac, char** av) {
diff --git a/src/st-flash/flash_opts.c b/src/st-flash/flash_opts.c
index 8f88f6e..e2d4154 100644
--- a/src/st-flash/flash_opts.c
+++ b/src/st-flash/flash_opts.c
@@ -86,7 +86,7 @@ static int32_t bad_arg(const char *arg) {
}
int32_t flash_get_opts(struct flash_opts* o, int32_t ac, char** av) {
-
+
// defaults
memset(o, 0, sizeof(*o));
o->log_level = STND_LOG_LEVEL;
diff --git a/src/stlink-lib/chipid.c b/src/stlink-lib/chipid.c
index 77cbfb1..ceeed31 100644
--- a/src/stlink-lib/chipid.c
+++ b/src/stlink-lib/chipid.c
@@ -35,6 +35,7 @@ void dump_a_chip(struct stlink_chipid_params *dev) {
DLOG("option_size 0x%x\n", dev->option_size);
DLOG("flags %d\n\n", dev->flags);
DLOG("otp_base %d\n\n", dev->otp_base);
+ DLOG("otp_size %d\n\n", dev->otp_size);
}
struct stlink_chipid_params *stlink_chipid_get_params(uint32_t chip_id) {
@@ -181,6 +182,7 @@ void process_chipfile(char *fname) {
fprintf(stderr, "Unknown flags word in %s: '%s'\n", fname, p);
}
}
+
sscanf(value, "%x", &ts->flags);
} else if (strcmp(word, "otp_base") == 0) {
buf[strlen(buf) - 1] = 0; // chomp newline
diff --git a/src/stlink-lib/common_flash.c b/src/stlink-lib/common_flash.c
index 60d8f42..5005a63 100644
--- a/src/stlink-lib/common_flash.c
+++ b/src/stlink-lib/common_flash.c
@@ -1320,7 +1320,6 @@ int32_t stlink_fwrite_flash(stlink_t *sl, const char *path, stm32_addr_t addr) {
(num_empty == mf.len) ? (uint32_t)mf.len : (uint32_t)mf.len - num_empty,
num_empty == mf.len);
}
-
stlink_fwrite_finalize(sl, addr);
unmap_file(&mf);
return (err);
@@ -1433,8 +1432,6 @@ int32_t stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t *base, uint3
flash_loader_t fl;
ILOG("Attempting to write %d (%#x) bytes to stm32 address: %u (%#x)\n", len, len, addr, addr);
- (void)eraseonly;
-
// check addr range is inside the flash
stlink_calculate_pagesize(sl, addr);