9 years, 3 months ago.

Internal Flash Sector 0 -STM32F411RE does not boot

To emulate eeprom capability (I require around 1K to write and read data) on STM32F411RE board, I reserved the first sector (i.e Sector 0 which is 16KB) in the linker file. I want to use this first sector like an EEPROM.

When I reserve Sector 0 in the linker file for eeprom usage , the system does not boot at all. However when I reserve sector 7(128K) to use as an EEPROM , the system boots, but I do not require 128K bytes to be used as EEPROM as it is too high memory.

Below are the linker script changes.

linker snippet

When I reserve for Sector 0, my linker file looks like below

MEMORY
{ 
   EEPROM (rwx): ORIGIN = 0x08000000, LENGTH = 16K  
   FLASH (rx) : ORIGIN = 0x08004000, LENGTH = 496K
   RAM (rwx)  : ORIGIN = 0x20000198, LENGTH = 128k - 0x198
}


When I reserve For Sector 7, my linker file looks like below

MEMORY
{ 
  FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 384K
  EEPROM (rwx): ORIGIN = 0x08060000, LENGTH = 128K
  RAM (rwx)  : ORIGIN = 0x20000198, LENGTH = 128k - 0x198
}



The linker file also has below section declaration

	.user_data :
	{
	. = ALIGN(4);
	*(.user_data)
	. = ALIGN(4);
	} > EEPROM

In one of my .c file, I have declared

attribute((section(".user_data"))) const uint16_t eepConfig[512];

specifies that we wish to store the eepConfig variable in the .user_data section of the linker file.

Why reserving sector0- 16KB does not boot the system, while reserving sector 7 works (at least the system boots though there are other problems related to memory) I do not require sector 7 as it would waste a lot of memory. is there a way to overcome this problem so that i can use sector 0 for storage?

- yk

i was able to make some progress on 411RE board where I now reserve Sector 0 for .isr_vector table and use Sector 1 for EEPROM emulation. This works for nucleo 411RE board and my application main() function gets called, but the same concept does not work for nucleo 401RE board. Is there any way to know whether my reset handler is getting called (I do not have a debugger with me) which finally will call my main() on 401RE board.

This is the linker file that worked for 411RE board but not on 401RE board

MEMORY
{ 
  VECTOR (rx) : ORIGIN = 0x08000000, LENGTH = 16K
  EEPROM (rwx): ORIGIN = 0x08004000, LENGTH = 16K
  FLASH (rx)  : ORIGIN = 0x08008000, LENGTH = 480K
  RAM (rwx)   : ORIGIN = 0x20000198, LENGTH = 128k - 0x198
}
Below is the section which I added for EEPROM and isr_vector.

	.user_data :
	{
	. = ALIGN(4);
	*(.user_data)
	. = ALIGN(4);
	} > EEPROM
	
	.isr_vector :
	{
	 . = ALIGN(4);
	  KEEP(*(.isr_vector)) /* Startup code */
	 . = ALIGN(4); 
	} >VECTOR

Do I need to modify something extra in 401RE start up files ? I believe both the boards are very much similar.

- yk

posted by yogesh kulkarni 30 Jul 2015
Be the first to answer this question.