From 265cef7e00496502ceb6d0012f3a559e380e89ee Mon Sep 17 00:00:00 2001 From: Angus Gratton <gus@projectgus.com> Date: Tue, 28 Jul 2015 11:19:01 +1000 Subject: [PATCH] Add some LED debugging assembler macros Not used directly in esp-open-rtos but useful to keep around. --- core/led_debug.s | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 core/led_debug.s diff --git a/core/led_debug.s b/core/led_debug.s new file mode 100644 index 0000000..8196c9e --- /dev/null +++ b/core/led_debug.s @@ -0,0 +1,29 @@ +/* + * Useful debugging macro to .include for blinking LEDs on/off from assembler code + * (aka 1 bit debugging, yay!) + * + * To have this work from initial reset, without needing an iomux call + * first, choose a pin where iomux defaults to GPIO (ie 0,2,4,5) + */ +LED_GPIO=2 +GPIO_DIR_SET = 0x6000030c +GPIO_OUT_SET = 0x60000300 +GPIO_OUT_CLEAR = 0x60000308 + +.macro led_op rega, regb, target + movi \rega, GPIO_DIR_SET + movi \regb, (1<<LED_GPIO) + s32i \regb, \rega, 0 + movi \rega, \target + s32i \regb, \rega, 0 +.endm + +// Turn LED on. rega, regb will be clobbered +.macro led_on rega, regb + led_op \rega, \regb, GPIO_OUT_SET +.endm + +// Turn LED off. rega, regb will be clobbered +.macro led_off rega, regb + led_op \rega, \regb, GPIO_OUT_CLEAR +.endm