Odd sequence required when using the flash tool #33

Closed
peabody124 opened this Issue Nov 25, 2011 · 1 comment

Comments

Projects
None yet
2 participants

So in case it's relevant my .bin I'm uploading includes both a bootloader and the application code. However uploading separately caused about the same issues.

I have to repeat this sequence to flash code into an F1 chip

  1. execute flash tool. It appears to execute correctly. Chip boots up although some of the timings are off. However rebooting chip doesn't work.
  2. power cycle chip and programmer then rerun flash tool. It erases memory but then hangs with this:

2011-11-25T15:38:45 INFO src/stlink-common.c: Successfully unlocked flash
2011-11-25T15:38:45 INFO src/stlink-common.c: Finished erasing 36 pages of 1024 (0x400) bytes
2011-11-25T15:38:45 INFO src/stlink-common.c: Starting Flash write for VL core id
2011-11-25T15:38:45 INFO src/stlink-common.c: Successfully loaded flash loader in sram
2011-11-25T15:38:45 INFO src/stlink-common.c: Writing flash block 0 of size 64 (0x40)
2011-11-25T15:38:45 INFO src/stlink-common.c: Successfully unlocked flash

while consuming lots of cpu. Ctrl-C gives this

2011-11-25T15:38:45 INFO src/stlink-common.c: Successfully unlocked flash
^C^Cflash(53839,0x10e2cc000) malloc: *** error for object 0x7fc4995025c0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

  1. power cycle chip and programmer then rerun flash tool. succcess

I don't understand why #1 appears to work - my best guess is somehow the boot sector fails to write. #2 my guess is that as a result of #1 it's locked into some loop that prevents jumping to ram. #3 seems to work because a full erase and reset occurred first.

Any suggestions of where I can patch the flash tool to make sure it first erases then really resets the chip before writing?

Adding this before the write fixes the issue, but obviously wipes the entire of flash preventing piecewise programming.

stlink_reset(sl);

printf("Erasing chip entirely...");
stlink_erase_flash_mass(sl);
printf(" Done\n");

stlink_force_debug(sl);
stlink_reset(sl);

xor-gate closed this May 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment