boards: riscv: rv32m1: add support for GPIO debugging

Having a pin toggle when the code reaches a certain point
is really useful for debugging; the infrastructure is already
in place for Nordic boards, so just build upon and enable the
mechanism on the Vega board as well.

Signed-off-by: David Leach <david.leach@nxp.com>
This commit is contained in:
David Leach 2019-09-19 13:49:12 +03:00 committed by Carles Cufí
commit 94106a8ff3
2 changed files with 41 additions and 1 deletions

View file

@ -6,8 +6,15 @@
#include <init.h>
#include <drivers/pinmux.h>
#include <drivers/gpio.h>
#include <fsl_port.h>
#ifdef CONFIG_BT_CTLR_DEBUG_PINS
struct device *vega_debug_portb;
struct device *vega_debug_portc;
struct device *vega_debug_portd;
#endif
static int rv32m1_vega_pinmux_init(struct device *dev)
{
ARG_UNUSED(dev);
@ -70,6 +77,39 @@ static int rv32m1_vega_pinmux_init(struct device *dev)
pinmux_pin_set(portb, 22, PORT_PCR_MUX(kPORT_MuxAlt2));
#endif
#ifdef CONFIG_BT_CTLR_DEBUG_PINS
pinmux_pin_set(portb, 29, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(portc, 28, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(portc, 29, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(portc, 30, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(portd, 0, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(portd, 1, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(portd, 2, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(portd, 3, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(portd, 4, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(portd, 5, PORT_PCR_MUX(kPORT_MuxAsGpio));
struct device *gpio_dev = device_get_binding(DT_ALIAS_GPIO_B_LABEL);
gpio_pin_configure(gpio_dev, 29, GPIO_DIR_OUT);
gpio_dev = device_get_binding(DT_ALIAS_GPIO_C_LABEL);
gpio_pin_configure(gpio_dev, 28, GPIO_DIR_OUT);
gpio_pin_configure(gpio_dev, 29, GPIO_DIR_OUT);
gpio_pin_configure(gpio_dev, 30, GPIO_DIR_OUT);
gpio_dev = device_get_binding(DT_ALIAS_GPIO_D_LABEL);
gpio_pin_configure(gpio_dev, 0, GPIO_DIR_OUT);
gpio_pin_configure(gpio_dev, 1, GPIO_DIR_OUT);
gpio_pin_configure(gpio_dev, 2, GPIO_DIR_OUT);
gpio_pin_configure(gpio_dev, 3, GPIO_DIR_OUT);
gpio_pin_configure(gpio_dev, 4, GPIO_DIR_OUT);
gpio_pin_configure(gpio_dev, 5, GPIO_DIR_OUT);
#endif
return 0;
}

View file

@ -801,7 +801,7 @@ config BT_CTLR_PROFILE_ISR
config BT_CTLR_DEBUG_PINS
bool "Bluetooth Controller Debug Pins"
depends on BOARD_NRF51_PCA10028 || BOARD_NRF52_PCA10040 || BOARD_NRF52810_PCA10040 || BOARD_NRF52840_PCA10056
depends on BOARD_NRF51_PCA10028 || BOARD_NRF52_PCA10040 || BOARD_NRF52810_PCA10040 || BOARD_NRF52840_PCA10056 || BOARD_RV32M1_VEGA
help
Turn on debug GPIO toggling for the BLE Controller. This is useful
when debugging with a logic analyzer or profiling certain sections of