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

Added support for flashing second bank on STM32F10x_XL #592

Merged
merged 1 commit into from
May 14, 2017
Merged

Added support for flashing second bank on STM32F10x_XL #592

merged 1 commit into from
May 14, 2017

Conversation

bmellstrom
Copy link
Contributor

Some of the chips in the STM32F10x series has two separate flash banks. The first is always at most 512kB and the size of the second can be 0, 256 or 512 kB. For example, the STM32F103RF has 512 + 256 kB of flash memory. To be able to flash the second you need to use another set of registers instead of the usual SR/CR/AR registers. I made a patch for this that works for me(tm). Let me know if I should change anything; would be nice to get this included in upstream!

@xor-gate xor-gate requested review from texane and xor-gate May 10, 2017 10:14
Copy link
Member

@xor-gate xor-gate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xor-gate
Copy link
Member

@texane could you also have a look and approve the review?

@xor-gate xor-gate removed the request for review from texane May 14, 2017 10:41
@xor-gate xor-gate added this to the v1.3.2 milestone May 14, 2017
@xor-gate xor-gate merged commit 0498621 into stlink-org:master May 14, 2017
@xor-gate
Copy link
Member

Thank you!

@bmellstrom
Copy link
Contributor Author

Wohoo!

skalidindi3 added a commit to skalidindi3/stlink that referenced this pull request May 18, 2017
Pull Request stlink-org#592 (0498621) accidentally deleted the call to `set_flash_cr_pg`.
skalidindi3 added a commit to skalidindi3/stlink that referenced this pull request May 18, 2017
Fixes issue stlink-org#594.

Pull request stlink-org#592 (0498621) accidentally deleted the call to `set_flash_cr_pg`.
xor-gate pushed a commit that referenced this pull request May 18, 2017
Fixes #594. Pull request #592 (0498621) accidentally deleted the call to `set_flash_cr_pg`.
@xor-gate
Copy link
Member

@bmellstrom @skalidindi3 had some problems with F0 target after this patch. Could you test out latest master works with STM32F10x_XL on second bank?

@bmellstrom
Copy link
Contributor Author

@xor-gate yes, retested successfully - it works.
There is something fishy going on in the code there though. If you check the loader code for the F0 it always set's the PG bit by itself anyway, so it shouldn't be needed there. At first I thought the same loader was used for the F1(XL) devices (which would make sense since they have more or less the same interface), but then I realized the loader_code_stm32vl that was actually used, and I'm not sure what it's actually doing. It must be setting the PG bit in the correct CRx register since otherwise the flashing cannot succeed, and since it does succeed flashing both banks I was thinking that meant the initial call to set_flash_cr_pg() would be pointless. I was about to disassemble the loader and double-check what it's actually doing, but never got around to it. Anyway, I'll let you know if I come up with something better!

@Nightwalker-87 Nightwalker-87 linked an issue Mar 18, 2020 that may be closed by this pull request
6 tasks
@Nightwalker-87 Nightwalker-87 removed a link to an issue Mar 18, 2020
6 tasks
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants