Skip to main content
maor
Associate II
July 27, 2018
Question

STM32F072 - How do i know what flash pages available to save data ?

  • July 27, 2018
  • 7 replies
  • 2460 views

Hello ,

1 i would like to save user configuration into the flash of STM32F072 into pages . ( it few Kbytes )

2. reading : RM0091 Reference manual I saw the pages space - but how do i know what flash pageas are available for save data.

3. i use keil 5.2 and st32cube

please your help

thanks

yaniv

    This topic has been closed for replies.

    7 replies

    Tesla DeLorean
    Guru
    July 27, 2018

    Use the ones at the end of memory, and shrink the allocation reported to the linker for your code (ie menu settings, scatter file, or linker script)

    To see how much memory you're using currently, review the .MAP file.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    maor
    maorAuthor
    Associate II
    July 28, 2018

    Hello Clive ,

    1. thanks you for your time TO answer me ,
    2. looking at the .map as you said i see few "blocks " of Rom
    3. 2.1 is Image Entry point : 0x080000c1 is FLASH Region _IROM1 () just to be 100% sure ?

    Image Entry point : 0x080000c1

     Load Region LR_IROM1 (Base: 0x08000000, Size: 0x0000287c, Max: 0x00020000, ABSOLUTE)

      Execution Region ER_IROM1 (Base: 0x08000000, Size: 0x00002840, Max: 0x00020000, ABSOLUTE)

      Base Addr  Size     Type  Attr   Idx  E Section Name    Object

      0x08000000  0x000000c0  Data  RO      3  RESET        startup_stm32f072xb.o

      0x080000c0  0x00000000  Code  RO     4241 * .ARM.Collect$$$$00000000 mc_p.l(entry.o)

      0x080000c0  0x00000004  Code  RO     4556  .ARM.Collect$$$$00000001 mc_p.l(entry2.o)

    ....

    ....

    ...

     0x08002676  0x00000002  PAD

      0x08002678  0x00000190  Code  RO     294  i.main       main.o

      0x08002808  0x00000010  Data  RO     4201  .constdata     system_stm32f0xx.o

      0x08002818  0x00000008  Data  RO     4202  .constdata     system_stm32f0xx.o

      0x08002820  0x00000020  Data  RO     4611  Region$$Table    anon$$obj.o

    so from  0x00000021 for this program all FLASH above should be free for my own data to write ro flash use ?

    thanks

    GenuineDeveloper
    Associate III
    July 28, 2018

    Check the flash memory section in the reference manual.

    Additionally you can use STM32 ST-LINK UTILITY software to view the memory address you have accessed/used to view the data you have stored. For this, you need to have some sort of debugger like st-link debugger.

    GenuineDeveloper
    Associate III
    July 28, 2018

    In the RM, under the topic Embedded flash memory there is a table which mentions the flash memory space. You can use the main flash memory area as per the addresses mentioned.

    Tesla DeLorean
    Guru
    July 28, 2018

    The 0x080000C1 is likely the address of Reset_Handler, the first code the processor is running

    0x08002820 + 0x20 -> 0x08002840 describes the end of the Region Table (describes initialization data), that data itself extends up to 0x0800287C

    Instead of having 128KB of IROM1/FLASH (0x20000) define it as being 0x1F000 in length, then 0x0801F000 will be a safe/clear area to use, and will be consistent as code changes size, and each rebuild.

    Please edit you profile with a more recognizable user name

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    henry.dick
    Associate II
    July 28, 2018
    1. compare map vs. memory map.
    2. or simply declare a large static data type (ilke an array) and save data dynamically to it.
    Pavel A.
    July 28, 2018

    You cannot just write data into flash memory like into RAM. The ST library has functions for working with flash: erase pages and program data. Read the fine manuals and learn how it works. If you declare an array aligned on 2K (the STM32F072 flash page size) and size multiple of 2K, you can use the mentioned flash library functions to store data there.

    -- pa