Skip to main content
keng1230
Associate
September 21, 2011
Question

STM32F103VBT6 Flash memory

  • September 21, 2011
  • 10 replies
  • 1870 views
Posted on September 21, 2011 at 03:27

basically i just want to some simple stuff. write in a variable into the flash memory (permanent) and read it , make sure it is the same .

as i am newbie to micro-controller, and i couldn't get any simple code or example code from the internet or in this forum. so can anyone teach me how to write the code  or give me some sample code 

thx you 

#stm32-flash
This topic has been closed for replies.

10 replies

trevor23
Associate III
September 21, 2011
Posted on September 21, 2011 at 15:59

Do you ever want to cange the variable in flash from your program or will it always be constant? If always constant then just declre it const e.g.

const int variable_in_flash;

printf( ''variable = %d\r\n'', variable_in_flash );

This tells the compiler it will never change which in this case should allow the complier to put it in program memory - flash memory in this case (maybe as part of an instruction etc. but you shouldn't care about that)

However if you need to change the variable you will beed to erase a page of flash and then write to flash.

Let us know which method you require.

Tesla DeLorean
Guru
September 21, 2011
Posted on September 21, 2011 at 16:51

i couldn't get any simple code or example code from the internet or in this forum

 

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/flash read and write (urgent)&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=335

There are also manuals for the part, and an application note about programming flash on STM32 parts.

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/PROGRAMMING_MANUAL/CD002834pdf

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Super User
September 21, 2011
Posted on September 22, 2011 at 00:13

Cross-post:

http://www.keil.com/forum/19571/

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
keng1230
keng1230Author
Associate
September 22, 2011
Posted on September 22, 2011 at 06:46

error:  #147-D: declaration is incompatible with ''void RCC_LSEConfig(u8)'' (declared at line 268 of ''C:\Keil\ARM\INC\ST\STM32F10x\stm32f10x_rcc.h'')

i got this error ? 

Andrew Neil
Super User
September 22, 2011
Posted on September 22, 2011 at 08:19

''declaration is

incompatible

with 'void RCC_LSEConfig(u8)'''

 

So use a declaration which

is

  compatible with that!!

How do you expect anyone to help you resolve that error without seeing the code to which it relates?? Remember that your code is not visible to the forum!

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
keng1230
keng1230Author
Associate
September 22, 2011
Posted on September 22, 2011 at 09:43

ops... that one solve it .... 

now with something new error

.\Release\STM32F10x.sct(7): error: L6236E: No section matches selector - no section to be FIRST/LAST.

i am using this example 

C:\Keil\ARM\Examples\ST\STM32F10xFWLib\Examples\FLASH\Program\main.c

mikebright311
Visitor II
January 1, 2013
Posted on January 01, 2013 at 08:04

Hi Mr K

I have this problem too, could you find any response?

Please say me

Thanks

mikebright311
Visitor II
January 1, 2013
Posted on January 01, 2013 at 08:06

my email address : mikebright311@yahoo.com

Tesla DeLorean
Guru
January 1, 2013
Posted on January 01, 2013 at 17:52

Be aware that this thread was last tickled around 18 months ago, don't expect a response from the original participants.

State clearly your situation and your problem, and don't assume a METOO kind of problem is exactly the same, or conveys enough detail to be answered by current forum participants.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Amel NASRI
ST Technical Moderator
February 5, 2013
Posted on February 05, 2013 at 12:03

Totally agree with Clive1 and suggest to state the problem in a new thread instead of updating an old one.

ST.MCU

To give better visibility on the answered topics, please click on "Best Answer" on the reply which solved your issue or answered your question.