EEPROM Emulation not working in code >64K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-11 1:39 AM - last edited on ‎2025-04-11 1:44 AM by Andrew Neil
Split from EEPROM Emulation: meaning of the VirtAddVarTab as this is a new question.
The eeprom emulation in my simple trial sofware is working fine. The code is quite small.
I tried to use this software inside a more complex program, larger than 64K, and the system hangs.
From what I have understood only the first 16K are available for program with the suggested setup.
It is possile to have a setup for eeprom that allows to use more flash program memory?
Solved! Go to Solution.
- Labels:
-
Flash
-
STM32CubeExpansion
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-15 5:21 AM
Your defines seems ok , but too is required linker file changes for spare this space.
MEMORY
{
FLASH0 (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* FL0 only isr */
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
FLASH (rx) : ORIGIN = 0x8010000, LENGTH = 1984K /* reserve EEPROM sec 1 2 3 used only 2 3*/
}
...
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-11 1:47 AM
If your previous question is now resolved, please mark the solution in that thread:
https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256
@OldSTMan wrote:I tried to use this software inside a more complex program, larger than 64K
What STM32 are you using?
Does it have enough Flash for both your code and your emulated EEPROM to be in separate pages?
Have you made sure that they are in separate pages?
@OldSTMan wrote:the system hangs.
So where, exactly, does it hang?
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-14 3:55 AM - edited ‎2025-04-14 4:16 AM
Hello @OldSTMan
What is the MCU you are using please?
Did you check the examples on X-Cube EEPROM library please?
Try to modify the linker script to allocate the good flash memory size for your Emulation.
Saket_Om
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-14 5:01 AM
The project is for stm32f401re and includes SD card and CDC. Using the examples I was able to run the eeprom emulation in a small sample project. I would now undestand how to run it in alarger project (more than 64K).
I was playing with the configuration file with bad results (target not detected..). Can someone help me to understand what to do with programs larger than 16K? How can I configure to have the program in separate pages?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-14 5:23 AM
For emulation is requiredd knowledge about flash sectors for F4
your code for emulate require arange into little sectors, or you waste big when not used, your choice your job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-14 11:42 PM - last edited on ‎2025-04-15 1:07 AM by Andrew Neil
I used sectors 2 and 3 (16K) as in the example and in large program it is not working:
/* EEPROM start address in Flash */
#define EEPROM_START_ADDRESS ((uint32_t)0x08008000) /* EEPROM emulation start address:
from sector2 : after 16KByte of used
Flash memory */
/* Pages 0 and 1 base and end addresses */
#define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x0000))
#define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1)))
#define PAGE0_ID FLASH_SECTOR_2
#define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x4000))
#define PAGE1_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (2 * PAGE_SIZE - 1))-1)
#define PAGE1_ID FLASH_SECTOR_3
Source Code formatting applied - please see How to insert source code for future reference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-15 1:04 AM - edited ‎2025-04-15 1:08 AM
Please see How to insert source code.
Note that X-CUBE-EEPROM is not for STM32F4 - you need STSW-STM32066 (AN3969)instead:
But you still have to choose your Flash pages.
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-15 5:21 AM
Your defines seems ok , but too is required linker file changes for spare this space.
MEMORY
{
FLASH0 (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* FL0 only isr */
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
FLASH (rx) : ORIGIN = 0x8010000, LENGTH = 1984K /* reserve EEPROM sec 1 2 3 used only 2 3*/
}
...
.isr_vector :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} >FLASH0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-17 1:14 AM
Thanks , the last hint solved all my problems !
