From 29dc401e5ba2c3f5676d426c4c1b10f1fc475fcd Mon Sep 17 00:00:00 2001 From: Pixel Date: Sun, 30 Jan 2011 00:53:28 -0800 Subject: Added semihosting support. --- arch/arm/include/angel.h | 11 ++++++++ arch/arm/src/angel.s | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 arch/arm/include/angel.h create mode 100644 arch/arm/src/angel.s (limited to 'arch/arm') diff --git a/arch/arm/include/angel.h b/arch/arm/include/angel.h new file mode 100644 index 0000000..3b9456a --- /dev/null +++ b/arch/arm/include/angel.h @@ -0,0 +1,11 @@ +#ifndef __ANGEL_H__ +#define __ANGEL_H__ + +int Semihost_SYS_OPEN(uint32_t * args); +int Semihost_SYS_CLOSE(uint32_t * args); +int Semihost_SYS_WRITE(uint32_t * args); +int Semihost_SYS_READ(uint32_t * args); +int Semihost_SYS_SEEK(uint32_t * args); +int Semihost_SYS_FLEN(uint32_t * args); + +#endif diff --git a/arch/arm/src/angel.s b/arch/arm/src/angel.s new file mode 100644 index 0000000..3a0e4c6 --- /dev/null +++ b/arch/arm/src/angel.s @@ -0,0 +1,65 @@ +.cpu cortex-m3 +.syntax unified +.thumb + +.section ".text.Semihost_SYS_OPEN", "x", %progbits +.thumb_func +.globl Semihost_SYS_OPEN +.type Semihost_SYS_OPEN, %function +Semihost_SYS_OPEN: + mov r1, r0 + mov r0, #1 + bkpt 0xAB + bx lr + +.section ".text.Semihost_SYS_CLOSE", "x", %progbits +.thumb_func +.globl Semihost_SYS_CLOSE +.type Semihost_SYS_CLOSE, %function +Semihost_SYS_CLOSE: + mov r1, r0 + mov r0, #2 + bkpt 0xAB + bx lr + +.section ".text.Semihost_SYS_WRITE", "x", %progbits +.thumb_func +.globl Semihost_SYS_WRITE +.type Semihost_SYS_WRITE, %function +Semihost_SYS_WRITE: + mov r1, r0 + mov r0, #5 + bkpt 0xAB + bx lr + +.section ".text.Semihost_SYS_READ", "x", %progbits +.thumb_func +.globl Semihost_SYS_READ +.type Semihost_SYS_READ, %function +Semihost_SYS_READ: + mov r1, r0 + mov r0, #6 + bkpt 0xAB + bx lr + +.section ".text.Semihost_SYS_SEEK", "x", %progbits +.thumb_func +.globl Semihost_SYS_SEEK +.type Semihost_SYS_SEEK, %function +Semihost_SYS_SEEK: + mov r1, r0 + mov r0, #10 + bkpt 0xAB + bx lr + +.section ".text.Semihost_SYS_FLEN", "x", %progbits +.thumb_func +.globl Semihost_SYS_FLEN +.type Semihost_SYS_FLEN, %function +Semihost_SYS_FLEN: + mov r1, r0 + mov r0, #12 + bkpt 0xAB + bx lr + +.end -- cgit v1.2.3