From d41a2a5bbbfd9eced0b671d13cc18a1e27fd5af7 Mon Sep 17 00:00:00 2001 From: Kuba Sanak Date: Wed, 4 Mar 2020 11:24:09 +0000 Subject: [PATCH] boards: pinmux: Don't throw compiler warnings on using custom sercom use In order to use its serial peripheral SERCOMs SAMD socs require their pins to be configured with pinmux. Currently pins are muxed only for the boards' default serial interfaces. The pinmux code is written to throw a compiler error if a user tries to use any sercom in a way it wasn't pre-defined to be used. This commit changes compiler errors to warnings so that user can provide custom pinmuxing code in their app. Fixes #23133 Signed-off-by: Kuba Sanak --- .../adafruit_feather_m0_basic_proto/pinmux.c | 20 ++++----- boards/arm/adafruit_trinket_m0/pinmux.c | 16 +++---- boards/arm/arduino_zero/pinmux.c | 18 ++++---- boards/arm/atsamd20_xpro/pinmux.c | 18 ++++---- boards/arm/atsamd21_xpro/pinmux.c | 16 +++---- boards/arm/atsame54_xpro/pinmux.c | 42 +++++++++---------- boards/arm/atsamr21_xpro/pinmux.c | 26 ++++++------ 7 files changed, 78 insertions(+), 78 deletions(-) diff --git a/boards/arm/adafruit_feather_m0_basic_proto/pinmux.c b/boards/arm/adafruit_feather_m0_basic_proto/pinmux.c index 657b14730491b9..c1d5723f5fb1dd 100644 --- a/boards/arm/adafruit_feather_m0_basic_proto/pinmux.c +++ b/boards/arm/adafruit_feather_m0_basic_proto/pinmux.c @@ -22,19 +22,19 @@ static int board_pinmux_init(struct device *dev) #endif #if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS @@ -45,19 +45,19 @@ static int board_pinmux_init(struct device *dev) #endif #if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #ifdef CONFIG_USB_DC_SAM0 diff --git a/boards/arm/adafruit_trinket_m0/pinmux.c b/boards/arm/adafruit_trinket_m0/pinmux.c index 31a998f0ef7a9d..c2dc1d4d25d881 100644 --- a/boards/arm/adafruit_trinket_m0/pinmux.c +++ b/boards/arm/adafruit_trinket_m0/pinmux.c @@ -26,16 +26,16 @@ static int board_pinmux_init(struct device *dev) #endif #if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS @@ -52,16 +52,16 @@ static int board_pinmux_init(struct device *dev) #endif #if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #ifdef CONFIG_USB_DC_SAM0 diff --git a/boards/arm/arduino_zero/pinmux.c b/boards/arm/arduino_zero/pinmux.c index bf7579cf574d2f..e965fc3cf78281 100644 --- a/boards/arm/arduino_zero/pinmux.c +++ b/boards/arm/arduino_zero/pinmux.c @@ -27,16 +27,16 @@ static int board_pinmux_init(struct device *dev) #endif #if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS @@ -47,19 +47,19 @@ static int board_pinmux_init(struct device *dev) #endif #if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #ifdef CONFIG_USB_DC_SAM0 diff --git a/boards/arm/atsamd20_xpro/pinmux.c b/boards/arm/atsamd20_xpro/pinmux.c index 14c786f15932ca..de4a787a7f8b25 100644 --- a/boards/arm/atsamd20_xpro/pinmux.c +++ b/boards/arm/atsamd20_xpro/pinmux.c @@ -15,13 +15,13 @@ static int board_pinmux_init(struct device *dev) ARG_UNUSED(dev); #if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS /* SERCOM3 on RX=PA25, TX=PA24 */ @@ -33,7 +33,7 @@ static int board_pinmux_init(struct device *dev) pinmux_pin_set(muxb, 9, PINMUX_FUNC_D); #endif #if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS @@ -43,19 +43,19 @@ static int board_pinmux_init(struct device *dev) pinmux_pin_set(muxa, 7, PINMUX_FUNC_D); #endif #if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif return 0; diff --git a/boards/arm/atsamd21_xpro/pinmux.c b/boards/arm/atsamd21_xpro/pinmux.c index 2d988d77d8982a..0afa6988cbfcb8 100644 --- a/boards/arm/atsamd21_xpro/pinmux.c +++ b/boards/arm/atsamd21_xpro/pinmux.c @@ -25,7 +25,7 @@ static int board_pinmux_init(struct device *dev) pinmux_pin_set(muxa, 16, PINMUX_FUNC_C); #endif #if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS /* SERCOM3 ON RX=PA23, TX=PA22 */ @@ -33,26 +33,26 @@ static int board_pinmux_init(struct device *dev) pinmux_pin_set(muxa, 22, PINMUX_FUNC_C); #endif #if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS /* SPI SERCOM5 on MISO=PB16/pad 0, MOSI=PB22/pad 2, SCK=PB23/pad 3 */ diff --git a/boards/arm/atsame54_xpro/pinmux.c b/boards/arm/atsame54_xpro/pinmux.c index 618673282489a9..4746b7a6ffdcd1 100644 --- a/boards/arm/atsame54_xpro/pinmux.c +++ b/boards/arm/atsame54_xpro/pinmux.c @@ -21,10 +21,10 @@ static int board_pinmux_init(struct device *dev) ARG_UNUSED(muxd); #if DT_ATMEL_SAM0_UART_SERCOM_0_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS /* SERCOM2 ON RX=PB24, TX=PB25 */ @@ -32,32 +32,32 @@ static int board_pinmux_init(struct device *dev) pinmux_pin_set(muxb, 25, PINMUX_FUNC_D); #endif #if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_6_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_7_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS /* SERCOM4 ON MOSI=PB27, MISO=PB29, SCK=PB26 */ @@ -66,35 +66,35 @@ static int board_pinmux_init(struct device *dev) pinmux_pin_set(muxb, 29, PINMUX_FUNC_D); #endif #if DT_ATMEL_SAM0_SPI_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_6_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_7_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_0_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_6_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_7_BASE_ADDRESS pinmux_pin_set(muxd, 8, PINMUX_FUNC_C); diff --git a/boards/arm/atsamr21_xpro/pinmux.c b/boards/arm/atsamr21_xpro/pinmux.c index 0ff86698cf91d7..274c32d8919980 100644 --- a/boards/arm/atsamr21_xpro/pinmux.c +++ b/boards/arm/atsamr21_xpro/pinmux.c @@ -22,16 +22,16 @@ static int board_pinmux_init(struct device *dev) pinmux_pin_set(muxa, 5, PINMUX_FUNC_D); #endif #if DT_ATMEL_SAM0_UART_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_UART_SERCOM_5_BASE_ADDRESS /* SERCOM5 on RX=PA23, TX=PA22 */ @@ -40,16 +40,16 @@ static int board_pinmux_init(struct device *dev) #endif #if DT_ATMEL_SAM0_SPI_SERCOM_0_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_1_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_SPI_SERCOM_4_BASE_ADDRESS /** @@ -71,7 +71,7 @@ static int board_pinmux_init(struct device *dev) #endif #if DT_ATMEL_SAM0_I2C_SERCOM_0_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_1_BASE_ADDRESS /* SERCOM1 on SDA=PA16, SCL=PA17 */ @@ -79,16 +79,16 @@ static int board_pinmux_init(struct device *dev) pinmux_pin_set(muxa, 17, PINMUX_FUNC_C); #endif #if DT_ATMEL_SAM0_I2C_SERCOM_2_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_3_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_4_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #if DT_ATMEL_SAM0_I2C_SERCOM_5_BASE_ADDRESS -#error Pin mapping is not configured +#warning Pin mapping may not be configured #endif #ifdef CONFIG_USB_DC_SAM0