Skip to main content
Associate
July 21, 2025
Question

updates on scatter file getting deleted after building code

  • July 21, 2025
  • 1 reply
  • 237 views

Hi,

 I tried adding APPKEY on the flash to read from bootloader to find if valid application there or not. I added as below in scatter file :

EXCLUDE app_key.o

APPKEY 0x08043FF8 FIXED { ; 0x08013FF0 = last 16 bytes of 64KB app
app_key.o (.app_key)
}

 

and in app_key.c, below lines are added:

__attribute__((used))
__attribute__((section(".app_key")))
const unsigned int APPKEY = 0xFEFFFEFF;

But once code is built, changes done in scatter file are disappearing and also when I check in map file, app_key is not getting allocated in specified location of flash

 

  

1 reply

Technical Moderator
July 29, 2025

Hello @vishwadn 

It is possible that the IDE or build system is regenerating the scatter file automatically.

Please Check your project settings :

  • In Keil/MDK, go to Project > Options for Target > Linker and ensure "Use Memory Layout from Target Dialog" is unchecked.
  • Specify your custom scatter file in the linker settings.
"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question.Saket_Om"