|Non-Confidential||PDF version||ARM 100073_0608_00_en|
|Home > The ARM C and C++ Libraries > Support for building an application with the C library > Using the C and C++ libraries with an application in a semihosting environment|
If you are developing an application to run in a semihosted environment for debugging, you must have an execution environment that supports A32 or T32 semihosting trap instructions for AArch32 state or A64 semihosting trap instruction for AArch64 state.
The execution environment can be provided by either:
It is not necessary to write any new functions or include files if you are using the default semihosting functionality of the C and C++ libraries.
The ARM debug agents support semihosting, but the memory map assumed by the C library might require tailoring to match the hardware being debugged.
ARM® Compiler supports semihosting by generating trap instructions
BKPT depending on the architecture or profile. Debug
agents can trap these instructions to perform semihosting operations on the host.
Table 1-2 Semihosting trap instructions
|Architecture||Instruction Set||Trap Instruction|
|ARMv8-A and ARMv8-R||A64||
|ARMv8-A and ARMv8-R||A32||
|ARMv8-A and ARMv8-R||T32||
|ARMv7-A and ARMv7-R||A32||
|ARMv7-A and ARMv7-R||T32||
|Any architecture with M-profile||T32||
For AArch32 in architectures with A-profile or R-profile, ARM Compiler supports two different semihosting implementations:
SVCinstruction. This is the default and legacy implementation.
HLTinstruction. This implementation is required for semihosting in hardware debug environments with mixed AArch32 and AArch64 states.
There are separate libraries for SVC-based and HLT-based
semihosting. ARM Compiler uses the HLT-based semihosting library if your code references the symbol
__use_hlt_semihosting. To do this, either:
IMPORT __use_hlt_semihostingfrom assembly language.
__asm(".global __use_hlt_semihosting\n\t")from C.
If you do not use the symbol
__use_hlt_semihosting, then by default, ARM Compiler emits
SVC instructions for semihosting calls. This symbol does
not have an effect on M-profile architectures, or in AArch64 state.
ARM strongly discourages mixing
mechanisms within the same executable. The library only uses either
HLT instructions, rather than a
mixture. However, you must ensure that you do not mix
HLT instructions when using: