From 0820d0659bb4a4c8c5b3575b6257c43eb9efe021 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 27 Nov 2018 14:47:49 -0600 Subject: [PATCH] Squashed commit of the following: arch/arm/src/max326xx/max32660/max32660_clockconfig.c: Fix an error in a register name. arm/src/max326xx/max32660: Fix a few new compilation errors when DEBUG is enabled. --- .../max326xx/max32660/max32660_clockconfig.c | 2 +- .../src/max326xx/max32660/max32660_lowputc.c | 4 --- .../src/max326xx/max32660/max32660_serial.c | 12 ++++++-- configs/max32660-evsys/README.txt | 30 ++++++++++++++++++- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/arch/arm/src/max326xx/max32660/max32660_clockconfig.c b/arch/arm/src/max326xx/max32660/max32660_clockconfig.c index 411ef2728c9..0a3d1cc4788 100644 --- a/arch/arm/src/max326xx/max32660/max32660_clockconfig.c +++ b/arch/arm/src/max326xx/max32660/max32660_clockconfig.c @@ -155,7 +155,7 @@ static void max326_enable_hfio(FAR const struct clock_setup_s *clksetup) /* Wait for the oscillator to become ready */ - while ((getreg32(GCR_CLKCTRL_HIRCRDY) & GCR_CLKCTRL_HIRCRDY) == 0) + while ((getreg32(MAX326_GCR_CLKCTRL) & GCR_CLKCTRL_HIRCRDY) == 0) { } } diff --git a/arch/arm/src/max326xx/max32660/max32660_lowputc.c b/arch/arm/src/max326xx/max32660/max32660_lowputc.c index 3fa6b42286c..4e3e4c0b1c8 100644 --- a/arch/arm/src/max326xx/max32660/max32660_lowputc.c +++ b/arch/arm/src/max326xx/max32660/max32660_lowputc.c @@ -343,10 +343,6 @@ void max326_uart_configure(uintptr_t base, ctrl0 |= UART_CTRL0_TOCNT(4); putreg32(ctrl0, base + MAX326_UART_CTRL0_OFFSET); - /* Enable trigger events */ - - DEBUGASSERT(config->) - /* Setup configuration and enable UART */ ctrl0 &= ~UART_CTRL0_SIZE_MASK; diff --git a/arch/arm/src/max326xx/max32660/max32660_serial.c b/arch/arm/src/max326xx/max32660/max32660_serial.c index 4c5cafcf4fb..e9a6c5a05b5 100644 --- a/arch/arm/src/max326xx/max32660/max32660_serial.c +++ b/arch/arm/src/max326xx/max32660/max32660_serial.c @@ -126,6 +126,12 @@ #define UART_INT_RXERRORS (UART_INT_FRAME | UART_INT_PARITY | \ UART_INT_RXOVR) +#ifdef CONFIG_DEBUG_FEATURES +# define UART_INT_ALL (UART_INT_TX | UART_INT_RX | UART_INT_RXERRORS) +#else +# define UART_INT_ALL (UART_INT_TX | UART_INT_RX) +#endif + /**************************************************************************** * Private Types ****************************************************************************/ @@ -519,7 +525,8 @@ static int max326_interrupt(int irq, void *context, FAR void *arg) /* Read and clear FIFO interrupt status */ regval = max326_serialin(priv, MAX326_UART_STAT_OFFSET); - max326_serialout(priv, MAX326_UART_STAT_OFFSET, regval); + max326_serialout(priv, MAX326_UART_STAT_OFFSET, + regval & UART_INT_ALL); /* Handle incoming, receive bytes. * Check if the received FIFO is not empty. @@ -548,10 +555,11 @@ static int max326_interrupt(int irq, void *context, FAR void *arg) #ifdef CONFIG_DEBUG_FEATURES /* Check for RX error conditions */ - if ((regval & MAX326_INT_RXERRORS) != 0) + if ((regval & UART_INT_RXERRORS) != 0) { /* And now do... what? Should we reset FIFOs on a FIFO error? */ #warning Misssing logic + } #endif } diff --git a/configs/max32660-evsys/README.txt b/configs/max32660-evsys/README.txt index 26a3f4b9b09..6573d53f481 100644 --- a/configs/max32660-evsys/README.txt +++ b/configs/max32660-evsys/README.txt @@ -88,6 +88,9 @@ Buttons OpenOCD ======= +Starting OpenOCD +---------------- + An Eclipse based toolchain is available for download from Maxim Integrated. If you (like me) are not an IDE user then the good news is the OpenOCD for the MAX32660 is available within that toolchain. @@ -110,4 +113,29 @@ OpenOCD IFCFG="C:\Maxim\Toolchain\share\openocd\scripts\interface\max32660_hdk.cfg" MCUCFG="C:\Maxim\Toolchain\share\openocd\scripts\target\max32660.cfg" - ${OPENOCD} -f ${IFCFG} -f ${MCUCFG} + ${OPENOCD} ${1} -f ${IFCFG} # -f ${MCUCFG} + +Loading Code: + + Code can be loaded into FLASH using the convenient ARM MBED drag'n'drop + interface. Or it can be loaded using GDB as follows: + + $ arm-none-eabi-gdb + (gdb) target remote localhost:3333 + (gdb) mon reset + (gdb) mon halt + (gdb) load nuttx + + This does not work so reliably for me, however. + +Debugging: + + $ arm-none-eabi-gdb + (gdb) target remote localhost:3333 + (gdb) mon reset + (gdb) mon reg pc 0x11c + (gdb) file nuttx + (gdb) b os_start + (gdb) c + + Also not very reliable.