Skip to content

Commit

Permalink
arch/arm/samv7: enforce compilation error for incompatible configurat…
Browse files Browse the repository at this point in the history
…ion options

Signed-off-by: Petro Karashchenko <[email protected]>
  • Loading branch information
pkarashchenko committed May 22, 2024
1 parent 1ee279c commit 5bf9ffd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
7 changes: 6 additions & 1 deletion arch/arm/src/samv7/sam_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
* Pre-processor Definitions
****************************************************************************/

#if defined(CONFIG_SAMV7_JTAG_FULL_ENABLE) && defined(CONFIG_SAMV7_USART1)
# error CONFIG_SAMV7_JTAG_FULL_ENABLE is incompatible with CONFIG_SAMV7_USART1.
# error The SYSIO Pin4 must be bound to PB4 to use USART1
#endif

#if !defined(CONFIG_SAMV7_ERASE_ENABLE) || \
!defined(CONFIG_SAMV7_JTAG_FULL_ENABLE)
# if defined(CONFIG_SAMV7_ERASE_DISABLE)
Expand All @@ -51,7 +56,7 @@
# endif
# if defined(CONFIG_SAMV7_JTAG_DISABLE)
# define SYSIO_BITS (MATRIX_CCFG_SYSIO_SYSIO4 | MATRIX_CCFG_SYSIO_SYSIO5 | \
MATRIX_CCFG_SYSIO_SYSIO6 | MATRIX_CCFG_SYSIO_SYSIO7)
MATRIX_CCFG_SYSIO_SYSIO6 | MATRIX_CCFG_SYSIO_SYSIO7)
# endif
# if defined(CONFIG_SAMV7_JTAG_FULL_SW_ENABLE)
# define SYSIO_BITS MATRIX_CCFG_SYSIO_SYSIO4
Expand Down
16 changes: 0 additions & 16 deletions arch/arm/src/samv7/sam_lowputc.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ void sam_lowsetup(void)
uint64_t divb3;
uint32_t intpart;
uint32_t fracpart;
#endif
#if (defined(HAVE_SERIAL_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG)) || \
defined(CONFIG_SAMV7_USART1)
uint32_t regval;
#endif

Expand Down Expand Up @@ -322,19 +319,6 @@ void sam_lowsetup(void)
sam_configgpio(GPIO_USART1_RTS);
# endif

/* To use the USART1 as an USART, the SYSIO Pin4 must be bound to PB4
* instead of TDI
*/

# if defined(CONFIG_SAMV7_JTAG_FULL_ENABLE)
# warning CONFIG_SAMV7_JTAG_FULL_ENABLE is incompatible with CONFIG_SAMV7_USART1.
# warning The SYSIO Pin4 must be bound to PB4 to use USART1
# endif

regval = getreg32(SAM_MATRIX_CCFG_SYSIO);
regval |= MATRIX_CCFG_SYSIO_SYSIO4;
putreg32(regval, SAM_MATRIX_CCFG_SYSIO);

#endif

#ifdef CONFIG_SAMV7_USART2
Expand Down

0 comments on commit 5bf9ffd

Please sign in to comment.