github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/device/arm/cortexm.S (about) 1 .syntax unified 2 .cfi_sections .debug_frame 3 4 .section .text.HardFault_Handler 5 .global HardFault_Handler 6 .type HardFault_Handler, %function 7 HardFault_Handler: 8 .cfi_startproc 9 // Put the old stack pointer in the first argument, for easy debugging. This 10 // is especially useful on Cortex-M0, which supports far fewer debug 11 // facilities. 12 mov r0, sp 13 14 // Load the default stack pointer from address 0 so that we can call normal 15 // functions again that expect a working stack. However, it will corrupt the 16 // old stack so the function below must not attempt to recover from this 17 // fault. 18 movs r3, #0 19 ldr r3, [r3] 20 mov sp, r3 21 22 // Continue handling this error in Go. 23 bl handleHardFault 24 .cfi_endproc 25 .size HardFault_Handler, .-HardFault_Handler 26 27 // This is a convenience function for semihosting support. 28 // At some point, this should be replaced by inline assembly. 29 .section .text.SemihostingCall 30 .global SemihostingCall 31 .type SemihostingCall, %function 32 SemihostingCall: 33 .cfi_startproc 34 bkpt 0xab 35 bx lr 36 .cfi_endproc 37 .size SemihostingCall, .-SemihostingCall