cancel
Showing results for 
Search instead for 
Did you mean: 

How to program FLASH using Standard Peripherals Library?

areify
Associate II

Hi everyone.

At this moment I'm working in an integration on an old project which used Standard Peripherals Library instead of HAL libraries.

Here, when I try to write in FLASH memory I find the next line:

assert_param(IS_FLASH_ADDRESS(Address));

Which basically is checking if the given address is inside the range [0x08000000, 0x080FFFFF). In my particular case, I'm trying to write inside the range [0x00000000, 0x0003FFFF], that is also flash memory for user when BOOT pins are set in a certain way.

Is possible to write in this positions using this libraries?

I'm working with a STM32F105VC, and the line I talked you about is inside the function FLASH_ProgramWord(...) of this lib.

Thank you. My best regards.

Areify.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

The flash is still accessible at 0x08000000 even when mapped to 0x0. Just write to it in it's original location.

That or redefine IS_FLASH_ADDRESS, but that seems like a bad idea.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

4 REPLIES 4
TDK
Guru

The flash is still accessible at 0x08000000 even when mapped to 0x0. Just write to it in it's original location.

That or redefine IS_FLASH_ADDRESS, but that seems like a bad idea.

If you feel a post has answered your question, please click "Accept as Solution".
areify
Associate II

Redefinition is a bad idea because is an existing project (if not, I would use HAL) and other parts of code are working with this library.

Do you mean that if I write at 0x08000000 it will apply to 0x00000000? Are you sure that BOOT pins configuration work as a mapping activation/deactivation?

Yes and yes, per the “Boot configuration�? section of the RM.
If you feel a post has answered your question, please click "Accept as Solution".

Can I write a halfword value in a position which has not value FF FF?

I'm getting FLASH_ERROR_PG, I suppose this is the problem.