1.8.4 Bare machine integer C

If you are writing a program in C that does not use the library and is to run without any environment initialization, there are a number of requirements you must meet.

These requirements are:

  • Re-implement __rt_raise() if you are using the heap.
  • Not define main(), to avoid linking in the library initialization code.
  • Write an assembly language veneer that establishes the register state required to run C. This veneer must branch to the entry function in your application.
  • Provide your own RW/ZI initialization code.
  • Ensure that your initialization veneer is executed by, for example, placing it in your reset handler.
  • For AArch32 targets, build your application using -mfpu=none. For AArch64 targets, use -mcpu or -march to disable floating-point instructions and registers.

When you have met these requirements, link your application normally. The linker uses the appropriate C library variant to find any required compiler functions that are implicitly called.

Many library facilities require __user_libspace for static data. Even without the initialization code activated by having a main() function, __user_libspace is created automatically and uses 96 bytes in the ZI segment.

Non-ConfidentialPDF file icon PDF versionARM 100073_0607_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.