Use GPIO2 for led_debug.S

This commit is contained in:
Angus Gratton 2015-09-14 17:19:09 +10:00
parent 45d4e0da2d
commit 0432ae3745
3 changed files with 11 additions and 4 deletions

View file

@ -16,6 +16,8 @@
BSD Licensed as described in the file LICENSE
*/
#include "led_debug.s"
/* Some UserException causes, see table Table 464 in ISA reference */
#define CAUSE_SYSCALL 1
#define CAUSE_LOADSTORE 3
@ -314,7 +316,6 @@ InnerLoadStoreExceptionHandler:
/* verified an 8- or 16-bit read
a2 holds instruction, a5 holds mask to apply to read value
*/
rsr.excvaddr a3 // read faulting address
ssa8l a3 /* sar is now shift to extract a3's byte */
movi a4, ~3

View file

@ -4,6 +4,8 @@
*
* 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)
*
* Current sets on=LOW, as the GPIO2 pin is active low
*/
LED_GPIO=2
GPIO_DIR_SET = 0x6000030c
@ -19,11 +21,11 @@ GPIO_OUT_CLEAR = 0x60000308
.endm
// Turn LED on. rega, regb will be clobbered
.macro led_on rega, regb
.macro led_off rega, regb
led_op \rega, \regb, GPIO_OUT_SET
.endm
// Turn LED off. rega, regb will be clobbered
.macro led_off rega, regb
// Turn LED on. rega, regb will be clobbered
.macro led_on rega, regb
led_op \rega, \regb, GPIO_OUT_CLEAR
.endm

View file

@ -121,6 +121,10 @@ void test_string(const char *string, char *label, bool evict_cache)
void user_init(void)
{
sdk_uart_div_modify(0, UART_CLK_FREQ / 115200);
gpio_enable(2, GPIO_OUTPUT); /* used for LED debug */
gpio_write(2, 1); /* active low */
printf("\r\n\r\nSDK version:%s\r\n", sdk_system_get_sdk_version());
test_string(dramtest, "DRAM", 0);
test_string(iramtest, "IRAM", 0);