Keil Logo


A.4 Environment

Describes implementation-defined aspects of the Arm® C compiler and C library relating to environment, as required by the ISO C standard.

The mapping between physical source file multibyte characters and the source character set in translation phase 1 (
The compiler interprets the physical source file multibyte characters as UTF-8.
The name and type of the function called at program startup in a freestanding environment (
When linking with microlib, the function main() must be declared to take no arguments and must not return.
The effect of program termination in a freestanding environment (
The function exit() is not supported by microlib and the function main() must not return.
An alternative manner in which the main function can be defined (

The main function can be defined in one of the following forms:

int main(void)
int main()
int main(int)
int main(int, char **)
int main(int,char **, char **)
The values given to the strings pointed to by the argv argument to main (
In the generic Arm library the arguments given to main() are the words of the command line not including input/output redirections, delimited by whitespace, except where the whitespace is contained in double quotes.
What constitutes an interactive device (
What constitutes an interactive device depends on the environment and the _sys_istty function. The standard I/O streams stdin, stdout, and stderr are assumed to be interactive devices. They are line-buffered at program startup, regardless of what _sys_istty reports for them. An exception is if they have been redirected on the command line.
Whether a program can have more than one thread of execution in a freestanding environment (
Depends on the environment. The microlib C library is not thread-safe.
The set of signals, their semantics, and their default handling (7.14).

The <signal.h> header defines the following signals:

Signal Value Semantics
SIGABRT 1 Abnormal termination
SIGFPE 2 Arithmetic exception
SIGILL 3 Illegal instruction execution
SIGINT 4 Interactive attention signal
SIGSEGV 5 Bad memory access
SIGTERM 6 Termination request
SIGSTAK 7 Stack overflow (obsolete)
SIGRTRED 8 Run-time redirection error
SIGRTMEM 9 Run-time memory error
SIGUSR1 10 Available for the user
SIGUSR2 11 Available for the user
SIGPVFN 12 Pure virtual function called
SIGCPPL 13 Not normally used
SIGOUTOFHEAP 14 ::operator new or ::operator new[] cannot allocate memory

The default handling of all recognized signals is to print a diagnostic message and call exit().

Signal values other than SIGFPE, SIGILL, and SIGSEGV that correspond to a computational exception (
No signal values other than SIGFPE, SIGILL, and SIGSEGV correspond to a computational exception.
Signals for which the equivalent of signal(sig, SIG_IGN); is executed at program startup (
No signals are ignored at program startup.
The set of environment names and the method for altering the environment list used by the getenv function (
The default implementation returns NULL, indicating that no environment information is available.
The manner of execution of the string by the system function (
Depends on the environment. The default implementation of the function uses semihosting.
Non-ConfidentialPDF file icon PDF version101754_0616_01_en
Copyright © 2019–2021 Arm Limited or its affiliates. All rights reserved. 
  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.