Skip to content

Commit

Permalink
boards: riscv: rv32m1: add support for GPIO debugging
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dleach02 authored and carlescufi committed Nov 8, 2019
1 parent 256ec94 commit 94106a8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions boards/riscv/rv32m1_vega/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/controller/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 94106a8

Please sign in to comment.