# Build procedure
The build procedure for standalone Hexagon processor applications is identical to the build procedure for standard Linux applications. The procedure supports user configuration of the following runtime system properties:
- Stack and heap
- Memory management
- Caches
- ISDB
- TCM
This document does not describe the following runtime environment properties for standalone applications:
- Default IMASK and other register values
- Permissions for non-fixed TLB entries (such as rwx for each 1 MB segment)
Note
These properties are currently not user-configurable and are subject to change in future tools releases.
## Runtime system configuration
The runtime system for standalone Hexagon processor applications is configurable to support various hardware and software configurations.
The program start address is set with the linker option, `--section-start`. For example:
hexagon-clang -Xlinker --section-start -Xlinker .start=address hello.c
Copy to clipboard
The `-Xlinker` compiler option is used to specify that the following argument is passed to the linker as a command option.
## L1 and L2 cache attributes
Set L1 and L2 cache attributes at runtime by calling the library function, `add_translation()` (See Section 3.2.1).
## Parameters
The runtime system is configured primarily by passing various parameters to the linker on the compiler command line. In the following example, three parameters (`STACK_SIZE`, `HEAP_SIZE`, and `STACK_START`) are passed to specify the application stack and heap:
hexagon-clang -Wl,--defsym,STACK_SIZE=0x10000 -Wl,--defsym, HEAP_SIZE=0x10000 -Wl,--defsym, STACK_START=global_end+HEAP_SIZE+STACK_SIZE hello.c
Copy to clipboard
The `-Wl` compiler option specifies that the following two arguments are passed to the linker as a single option. For example, the first `-Wl` option in the example above specifies the following linker option:
--defsym STACK_SIZE=0x10000
Copy to clipboard
`-Xlinker` can also be used to pass parameters to the linker. However, in this case it is less efficient than `-Wl` because it can pass only
one symbol at a time.
If you are linking an application directly (for example, by using the hexagon-link command), these parameters can be set directly using the `--defsym` linker option.
The following table lists the parameters defined for configuring the runtime system.
- The default parameter values are consistent with developing a standalone application that runs on the Hexagon processor simulator.
- The mode-controlling parameters use nonstandard values. Specifically, the value 1 indicates that a mode or feature is disabled (rather than enabled).
| Parameter | Description | Category |
| --- | --- | --- |
| `STACK_START` | Base address of the program stack.
Default = (end of heap) + (stack size) | Application |
| `STACK_SIZE` | Maximum stack size.
Default = 1 MB | Application |
| `HEAP_START` | Base address of the program heap.
Default = End of the global data area | Application |
| `HEAP_SIZE` | Heap size.
Default = 64 MB | Application |
| `PRE_INIT` | Address of the function that is called before any initialization is performed (if defined). | Application |
| `POST_EXIT` | Address of the function that is called after the program finishes executing, with no simulator or RTOS present (if defined). | Application |
| `ANGEL_SUPPORT` | Specifies whether support for Angel semi-hosting is enabled.
0 - Use default setting
1 - Semi-hosting support is disabled
2 - Semi-hosting support is enabled (Default)
0 - Use default setting
1 - Multi-threading is disabled
2 - Multi-threading is enabled (Default)
0 - Use default setting
1 - Cache is disabled
2 - Cache is enabled (Default)
0 - Use default setting
1 - Prefetching is disabled
2 - Prefetching is enabled (Default)
0 - Use default setting
1 - Data cache is disabled
2 - Data cache is enabled (Default)
0 - Use default setting
1 - Prefetching is disabled
2 - Prefetching is enabled (default)
0 - Target-specific maximum L2 cache (Default).
1 - 0 KB L2 cache (all TCM)
2 - 64 KB L2 cache
3 - 128 KB L2 cache
4 - 256 KB L2 cache
5 - 512 KB L2 cache
6 - 1024 KB L2 cache
0 - Parity is disabled (Default)
1 - Parity is enabled
0 - Write back is enabled (Default)
1 - Write back is disabled
0 - Use default setting
1 - Translation is disabled
2 - Translation is enabled (Default)
0 - Use default setting.
1 - ISDB is not secure (Default)
2 - ISDB is secure
0 - Use default setting
1 - ISDB untrusted mode (Default)
2 - ISDB trusted mode
0 - Use default setting
1 - ISDB debug is off (Default)
2 - ISDB debug is on
0 - Use default setting
1 - Auto-incrementing is disabled
2 - Auto-incrementing is enabled (Default)