Keil Logo

ARM: detect overwrite of the startup file

Information in this knowledgebase article applies to:



I use my own linker scatter file, in which the STACK and HEAP areas get defined. In the startup file, the STACK and HEAP related things are removed. That works well, until the startup file gets overwritten for some reason with a default version, which enables the STACK and HEAP related things again.

Therefore it would be helpful, if an error message could be generated during the next build, after the startup file got overwritten. Is this possible?


Normally, there is no error message generated in such a case, as there are multiple valid ways to define the STACK and HEAP areas. If multiples are present, one of them has highest priority and the build will finish but ignore the user preferred method.

With a small changes to the startup and scatter files, an error message can be generated if the startup file was inadvertently replaced. To do this, extend the customized startup file with an additional label, e. g.:

                EXPORT  __CustomStartupFile

Then, in the scatter file add:


which will produce an error message like this:

test.axf: Error: L6388E: ScatterAssert expression
 (defined(__CustomStartupFile) ? 0x1 : 0x0) failed on line 4 : (0x0)

if the startup file with this extension is not present any more.


Last Reviewed: Tuesday, April 4, 2017

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.