Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplifies conditional compilation in the Stm32Uart driver. #812

Merged
merged 7 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
static Stm32Uart uart0("/dev/ser0", USART2, USART2_IRQn);
static Stm32Uart uart2("/dev/ser0", USART2, USART2_IRQn);

/** RailCom sender UART */
static Stm32RailcomSender railcomUart("/dev/ser1", USART1, USART1_IRQn);
Expand Down Expand Up @@ -357,4 +357,10 @@ void touch_interrupt_handler(void) {
portYIELD_FROM_ISR(true);
}

/// UART2 interrupt handler.
void uart2_interrupt_handler(void)
{
uart2.interrupt_handler();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
// static Stm32Uart uart0("/dev/ser0", USART1, USART1_IRQn);
// static Stm32Uart uart1("/dev/ser0", USART1, USART1_IRQn);

/** CAN 0 CAN driver instance */
static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -278,4 +278,10 @@ void usb_interrupt_handler(void)
dcd_int_handler(0);
}

/// UART1 interrupt handler.
void uart1_interrupt_handler(void)
{
// uart1.interrupt_handler();
}

} // extern "C"
8 changes: 7 additions & 1 deletion boards/st-stm32f072b-discovery/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
// static Stm32Uart uart0("/dev/ser0", USART1, USART1_IRQn);
// static Stm32Uart uart1("/dev/ser0", USART1, USART1_IRQn);

/** CAN 0 CAN driver instance */
static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -222,4 +222,10 @@ void hw_preinit(void)
NVIC_EnableIRQ(TIM14_IRQn);
}

/// UART1 interrupt handler.
void uart1_interrupt_handler(void)
{
// uart1.interrupt_handler();
}

}
8 changes: 7 additions & 1 deletion boards/st-stm32f091rc-nucleo-dev-board/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
static Stm32Uart uart0("/dev/ser0", USART2, USART2_IRQn);
static Stm32Uart uart2("/dev/ser0", USART2, USART2_IRQn);

/** CAN 0 CAN driver instance */
static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -327,4 +327,10 @@ void hw_preinit(void)
NVIC_EnableIRQ(TIM14_IRQn);
}

/// UART2 interrupt handler.
void uart2_interrupt_handler(void)
{
uart2.interrupt_handler();
}

}
8 changes: 7 additions & 1 deletion boards/st-stm32f091rc-nucleo/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
static Stm32Uart uart0("/dev/ser0", USART2, USART2_IRQn);
static Stm32Uart uart2("/dev/ser0", USART2, USART2_IRQn);

/** CAN 0 CAN driver instance */
static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -232,4 +232,10 @@ void hw_preinit(void)
NVIC_EnableIRQ(TIM14_IRQn);
}

/// UART2 interrupt handler.
void uart2_interrupt_handler(void)
{
uart2.interrupt_handler();
}

}
9 changes: 8 additions & 1 deletion boards/st-stm32f103rb-olimexino/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
// static Stm32Uart uart0("/dev/ser0", USART1, USART1_IRQn);
// static Stm32Uart uart1("/dev/ser0", USART1, USART1_IRQn);

/** CAN 0 CAN driver instance */
static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -254,4 +254,11 @@ void hw_preinit(void)
LED1_Pin::hw_init();
LED2_Pin::hw_init();
}

/// UART1 interrupt handler.
void usart1_interrupt_handler(void)
{
// uart1.interrupt_handler();
}

}
12 changes: 7 additions & 5 deletions boards/st-stm32f303-discovery/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */

// this driver causes us to crash in default_interrupt_handler. Check that the
// appropriate weak definition / implementation is used.

//static Stm32Uart uart0("/dev/ser0", USART1, USART1_IRQn);
static Stm32Uart uart1("/dev/ser0", USART1, USART1_IRQn);

/** CAN 0 CAN driver instance */
static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -249,4 +245,10 @@ void hw_preinit(void)
NVIC_EnableIRQ(TIM7_IRQn);
}

/// USART1 interrupt handler.
void usart1_interrupt_handler(void)
{
uart1.interrupt_handler();
}

}
4 changes: 2 additions & 2 deletions boards/st-stm32f303re-nucleo-dev-board/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
static Stm32Uart uart0("/dev/ser0", USART2, USART2_IRQn);
static Stm32Uart uart2("/dev/ser0", USART2, USART2_IRQn);

/** CAN 0 CAN driver instance */
static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -364,7 +364,7 @@ void hw_preinit(void)

void usart2_interrupt_handler(void)
{
Stm32Uart::interrupt_handler(1);
uart2.interrupt_handler();
}

}
4 changes: 2 additions & 2 deletions boards/st-stm32f303re-nucleo/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
static Stm32Uart uart0("/dev/ser0", USART2, USART2_IRQn);
static Stm32Uart uart2("/dev/ser0", USART2, USART2_IRQn);

/** CAN 0 CAN driver instance */
static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -254,7 +254,7 @@ void hw_preinit(void)

void usart2_interrupt_handler(void)
{
Stm32Uart::interrupt_handler(1);
uart2.interrupt_handler();
}

}
4 changes: 2 additions & 2 deletions boards/st-stm32f767zi-nucleo/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
static Stm32Uart uart0("/dev/ser0", USART3, USART3_IRQn);
static Stm32Uart uart3("/dev/ser0", USART3, USART3_IRQn);

/** CAN 0 CAN driver instance */
static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -296,7 +296,7 @@ void hw_preinit(void)

void usart3_interrupt_handler(void)
{
Stm32Uart::interrupt_handler(2);
uart3.interrupt_handler();
}

extern void RTC_Alarm_IRQHandler(void);
Expand Down
6 changes: 3 additions & 3 deletions boards/st-stm32g0b1rc-railcom/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
static Stm32Uart uart0("/dev/ser0", USART3, USART3_4_5_6_LPUART1_IRQn);
static Stm32Uart uart3("/dev/ser0", USART3, USART3_4_5_6_LPUART1_IRQn);

/** CAN 0 CAN driver instance */
//static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -286,12 +286,12 @@ void hw_init(void) {

void uart2_lpuart2_interrupt_handler(void)
{
Stm32Uart::interrupt_handler(1);
// no instance.
}

void uart3_4_5_6_lpuart1_interrupt_handler(void)
{
Stm32Uart::interrupt_handler(2);
uart3.interrupt_handler();
}

// timer17_fdcan_it1_interrupt_handler()
Expand Down
6 changes: 3 additions & 3 deletions boards/st-stm32g0b1re-nucleo/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
static Stm32Uart uart0("/dev/ser0", USART2, USART2_LPUART2_IRQn);
static Stm32Uart uart2("/dev/ser0", USART2, USART2_LPUART2_IRQn);

/** CAN 0 CAN driver instance */
//static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -300,12 +300,12 @@ void hw_init(void) {

void uart2_lpuart2_interrupt_handler(void)
{
Stm32Uart::interrupt_handler(1);
uart2.interrupt_handler();
}

void uart3_4_5_6_lpuart1_interrupt_handler(void)
{
Stm32Uart::interrupt_handler(2);
// no instance
}

// timer17_fdcan_it1_interrupt_handler()
Expand Down
4 changes: 2 additions & 2 deletions boards/st-stm32l432kc-nucleo/HwInit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const char *STDOUT_DEVICE = "/dev/ser0";
const char *STDERR_DEVICE = "/dev/ser0";

/** UART 0 serial driver instance */
static Stm32Uart uart0("/dev/ser0", USART2, USART2_IRQn);
static Stm32Uart uart2("/dev/ser0", USART2, USART2_IRQn);

/** CAN 0 CAN driver instance */
static Stm32Can can0("/dev/can0");
Expand Down Expand Up @@ -268,7 +268,7 @@ void hw_preinit(void)

void usart2_interrupt_handler(void)
{
Stm32Uart::interrupt_handler(1);
uart2.interrupt_handler();
}

}
Loading
Loading