diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2018-07-03 06:31:07 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2018-07-03 06:31:07 -0700 |
| commit | dbc977485c5004e7e63d5783ac51421e3ba026aa (patch) | |
| tree | ee2a4ffa5a52d36843e198a6ee6496f27f1689c5 | |
| parent | f3f8e13b882f5a4d685ce33831c24efd7077f57c (diff) | |
Support gathering register values on nrf.
| -rwxr-xr-x[-rw-r--r--] | ports/nrf/Makefile | 2 | ||||
| -rwxr-xr-x | ports/nrf/supervisor/cpu.s | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 6ba9ef359..5f3b9b25c 100644..100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -213,7 +213,7 @@ FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py') FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy)) OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) -OBJ += $(BUILD)/pins_gen.o +OBJ += $(BUILD)/pins_gen.o supervisor/cpu.o OBJ += $(addprefix $(BUILD)/, $(SRC_HAL:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_NRFX:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o)) diff --git a/ports/nrf/supervisor/cpu.s b/ports/nrf/supervisor/cpu.s new file mode 100755 index 000000000..9e6807a5e --- /dev/null +++ b/ports/nrf/supervisor/cpu.s @@ -0,0 +1,27 @@ +.syntax unified +.cpu cortex-m4 +.thumb +.text +.align 2 + +@ uint cpu_get_regs_and_sp(r0=uint regs[10]) +.global cpu_get_regs_and_sp +.thumb +.thumb_func +.type cpu_get_regs_and_sp, %function +cpu_get_regs_and_sp: +@ store registers into given array +str r4, [r0], #4 +str r5, [r0], #4 +str r6, [r0], #4 +str r7, [r0], #4 +str r8, [r0], #4 +str r9, [r0], #4 +str r10, [r0], #4 +str r11, [r0], #4 +str r12, [r0], #4 +str r13, [r0], #4 + +@ return the sp +mov r0, sp +bx lr |
