stlink-org / stlink

Open source STM32 MCU programming toolset
BSD 3-Clause "New" or "Revised" License
4.35k stars 1.23k forks source link

Unable to run out of RAM after trying to flash #58

Closed wware closed 12 years ago

wware commented 12 years ago

Probably I'm doing something bone-headed, but: I was able to get the blink example running out of flash with both blue and green LEDs flashing. Then I got adventurous and tried blink_flash. The blue and green LEDs never lit up for that, and I think I did that wrong. But having done that, I now can't get the green and blue LEDs to flash when I try to run out of RAM. This is with a 32VL Discovery board, and my host is Ubuntu 10.04. I don't know if it matters but I had an old "arm-elf" toolchain around already so I didn't use "arm-none-eabi". Would that mess things up?

wware commented 12 years ago

Luckily I have a second board which was previously unopened. So I tried it, and it ran the initial blink program (where the user button changes the green flashing pattern and is echoed by the blue LED) and it ran the blink example out of RAM just fine. The first board no longer runs the initial blink program. So it's definitely something bad I've done to the board. Is there any trick for putting the first board back in its happy state? Maybe move a jumper and apply power for 10 seconds or something like that? I've seen that sort of thing on other boards.

wware commented 12 years ago

Managed to figure it out. Both boards responded well to the flash utility, so I grabbed a bin off the good board and used it to program the bad board, and now both boards are good. So I am closing this issue.

karlp commented 12 years ago

Also, those projects were simply not properly set up :( There's some outstanding work in progress to make the examples more reliable, with better documentation... Sorry about that.

wware commented 12 years ago

The one thing I still can't do is run the blink_flash example out of flash. I haven't investigated this at all, just blindly followed the instructions in the PDF. If I get up more energy I'll try and figure out what's going on with that, now that I know how to fix it when it goes wrong.

karlp commented 12 years ago

You could also look at : https://github.com/karlp/stlink/tree/master/example/blink It uses different startup code, and I've verified it with flash and sram, and running other projects in between. Really, the existing blink and blink_flash projects shouldn't be looked at.

I'm just trying to clean up my commit history to get this merged into the mainline. Hopefully over the weekend.

UweBonnes commented 12 years ago

Running from RAM is a difficult thing. There are two areas to observe:

wware commented 12 years ago

@UweBonnes - I've just been working with the LED blinking demo which is probably just some GPIO and a timing loop, so running it out of RAM has been no problem. Where I've had difficulty has been in using the blink_flash demo, programming it into flash at 0x8000000, and then being able to run it. It sounds like you are working with some other piece of code.