github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/device/arm/semihosting.go (about)

     1  package arm
     2  
     3  // Semihosting commands.
     4  // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471c/Bgbjhiea.html
     5  const (
     6  	// Regular semihosting calls
     7  	SemihostingClock      = 0x10
     8  	SemihostingClose      = 0x02
     9  	SemihostingElapsed    = 0x30
    10  	SemihostingErrno      = 0x13
    11  	SemihostingFileLen    = 0x0C
    12  	SemihostingGetCmdline = 0x15
    13  	SemihostingHeapInfo   = 0x16
    14  	SemihostingIsError    = 0x08
    15  	SemihostingIsTTY      = 0x09
    16  	SemihostingOpen       = 0x01
    17  	SemihostingRead       = 0x06
    18  	SemihostingReadByte   = 0x07
    19  	SemihostingRemove     = 0x0E
    20  	SemihostingRename     = 0x0F
    21  	SemihostingSeek       = 0x0A
    22  	SemihostingSystem     = 0x12
    23  	SemihostingTickFreq   = 0x31
    24  	SemihostingTime       = 0x11
    25  	SemihostingTmpName    = 0x0D
    26  	SemihostingWrite      = 0x05
    27  	SemihostingWrite0     = 0x04
    28  	SemihostingWriteByte  = 0x03
    29  
    30  	// Angel semihosting calls
    31  	SemihostingEnterSVC        = 0x17
    32  	SemihostingReportException = 0x18
    33  )
    34  
    35  // Special codes for the Angel Semihosting interface.
    36  // https://www.keil.com/support/man/docs/armcc/armcc_pge1358787050566.htm
    37  const (
    38  	// Hardware vector reason codes
    39  	SemihostingBranchThroughZero = 0x20000
    40  	SemihostingUndefinedInstr    = 0x20001
    41  	SemihostingSoftwareInterrupt = 0x20002
    42  	SemihostingPrefetchAbort     = 0x20003
    43  	SemihostingDataAbort         = 0x20004
    44  	SemihostingAddressException  = 0x20005
    45  	SemihostingIRQ               = 0x20006
    46  	SemihostingFIQ               = 0x20007
    47  
    48  	// Software reason codes
    49  	SemihostingBreakPoint          = 0x20020
    50  	SemihostingWatchPoint          = 0x20021
    51  	SemihostingStepComplete        = 0x20022
    52  	SemihostingRunTimeErrorUnknown = 0x20023
    53  	SemihostingInternalError       = 0x20024
    54  	SemihostingUserInterruption    = 0x20025
    55  	SemihostingApplicationExit     = 0x20026
    56  	SemihostingStackOverflow       = 0x20027
    57  	SemihostingDivisionByZero      = 0x20028
    58  	SemihostingOSSpecific          = 0x20029
    59  )
    60  
    61  // Call a semihosting function.
    62  // TODO: implement it here using inline assembly.
    63  //
    64  //go:linkname SemihostingCall SemihostingCall
    65  func SemihostingCall(num int, arg uintptr) int