Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd sequence required when using the flash tool #33

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

Odd sequence required when using the flash tool #33

peabody124 opened this issue Nov 25, 2011 · 1 comment

Comments

@peabody124
Copy link

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?

@peabody124
Copy link
Author

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 xor-gate closed this as completed May 4, 2016
@Nightwalker-87 Nightwalker-87 modified the milestones: Resolved questions, Resolved questions & general issues Feb 23, 2020
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants