From 63affd7006fb5f4a3b14ac7d4f8cf12f42902c86 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 1 Jun 2022 10:59:10 -0400 Subject: [PATCH] stm32: Rework kconfig to use CONFIG_CANSERIAL for both can.c and fdcan.c Signed-off-by: Kevin O'Connor --- src/stm32/Kconfig | 8 +++----- src/stm32/Makefile | 13 +++++-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig index 09652673..62551dd8 100644 --- a/src/stm32/Kconfig +++ b/src/stm32/Kconfig @@ -278,8 +278,6 @@ config SERIAL bool config CANSERIAL bool -config FDCANSERIAL - bool choice prompt "Communication interface" config STM32_USB_PA11_PA12 @@ -348,13 +346,13 @@ choice depends on HAVE_STM32_CANBUS select CANSERIAL config STM32_CANBUS_PB0_PB1 - bool "CAN bus (on PB0/PB1)" if LOW_LEVEL_OPTIONS + bool "CAN bus (on PB0/PB1)" depends on HAVE_STM32_FDCANBUS - select FDCANSERIAL + select CANSERIAL endchoice config CANBUS_FREQUENCY - int "CAN bus speed" if LOW_LEVEL_OPTIONS && (CANSERIAL || FDCANSERIAL) + int "CAN bus speed" if LOW_LEVEL_OPTIONS && CANSERIAL default 500000 endif diff --git a/src/stm32/Makefile b/src/stm32/Makefile index 9d72c5a4..2f096369 100644 --- a/src/stm32/Makefile +++ b/src/stm32/Makefile @@ -3,7 +3,7 @@ # Setup the toolchain CROSS_PREFIX=arm-none-eabi- -dirs-y += src/stm32 src/generic +dirs-y += src/stm32 src/generic lib/fast-hash dirs-$(CONFIG_MACH_STM32F0) += lib/stm32f0 dirs-$(CONFIG_MACH_STM32F1) += lib/stm32f1 dirs-$(CONFIG_MACH_STM32F2) += lib/stm32f2 @@ -59,15 +59,12 @@ serial-src-$(CONFIG_MACH_STM32F0) := stm32/stm32f0_serial.c serial-src-$(CONFIG_MACH_STM32G0) := stm32/stm32f0_serial.c serial-src-$(CONFIG_MACH_STM32H7) := stm32/stm32h7_serial.c src-$(CONFIG_SERIAL) += $(serial-src-y) generic/serial_irq.c -src-$(CONFIG_CANSERIAL) += stm32/can.c ../lib/fast-hash/fasthash.c -src-$(CONFIG_CANSERIAL) += generic/canbus.c -src-$(CONFIG_FDCANSERIAL) += stm32/fdcan.c ../lib/fast-hash/fasthash.c -src-$(CONFIG_FDCANSERIAL) += generic/canbus.c +canbus-src-y := generic/canbus.c ../lib/fast-hash/fasthash.c +canbus-src-$(CONFIG_HAVE_STM32_CANBUS) += stm32/can.c +canbus-src-$(CONFIG_HAVE_STM32_FDCANBUS) += stm32/fdcan.c +src-$(CONFIG_CANSERIAL) += $(canbus-src-y) src-$(CONFIG_HAVE_GPIO_HARD_PWM) += stm32/hard_pwm.c -dirs-$(CONFIG_CANSERIAL) += lib/fast-hash -dirs-$(CONFIG_FDCANSERIAL) += lib/fast-hash - # Binary output file rules target-y += $(OUT)klipper.bin