2018-07-27 11:43 AM
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
2018-07-27 01:03 PM
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.
2018-07-28 03:55 AM
Hello Clive ,
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
2018-07-28 04:26 AM
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.
2018-07-28 05:01 AM
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.
2018-07-28 05:33 AM
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
2018-07-28 07:36 AM
2018-07-28 03:33 PM
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