diff --git a/src/Kconfig b/src/Kconfig index 43f527e..dc5f9c5 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -18,6 +18,8 @@ source "src/stm32/Kconfig" source "src/lpc176x/Kconfig" # Generic configuration options for serial ports +config SERIAL + bool config SERIAL_BAUD depends on SERIAL int "Baud rate for serial port" if LOW_LEVEL_OPTIONS @@ -27,12 +29,14 @@ config SERIAL_BAUD to 250000. Read the FAQ before changing this value. # Generic configuration options for USB +config USBSERIAL + bool config USB_VENDOR_ID default 0x1d50 config USB_DEVICE_ID default 0x6177 config USB_SERIAL_NUMBER_CHIPID - depends on HAVE_CHIPID + depends on HAVE_CHIPID && USBSERIAL default y config USB_SERIAL_NUMBER default "12345" @@ -40,15 +44,28 @@ config USB_SERIAL_NUMBER menu "USB ids" depends on USBSERIAL && LOW_LEVEL_OPTIONS config USB_VENDOR_ID - hex "USB vendor ID" + hex "USB vendor ID" if USBSERIAL config USB_DEVICE_ID - hex "USB device ID" + hex "USB device ID" if USBSERIAL config USB_SERIAL_NUMBER_CHIPID bool "USB serial number from CHIPID" if HAVE_CHIPID config USB_SERIAL_NUMBER string "USB serial number" if !USB_SERIAL_NUMBER_CHIPID endmenu +# Generic configuration options for CANbus +config CANSERIAL + bool +config CANBUS + bool + default y if CANSERIAL +config CANBUS_FREQUENCY + int "CAN bus speed" if CANBUS + default 500000 +config CANBUS_FILTER + bool + default y if CANSERIAL + config INITIAL_PINS string "GPIO pins to set on bootloader entry" depends on LOW_LEVEL_OPTIONS diff --git a/src/lpc176x/Kconfig b/src/lpc176x/Kconfig index 3279757..af60bb0 100644 --- a/src/lpc176x/Kconfig +++ b/src/lpc176x/Kconfig @@ -57,10 +57,6 @@ config FLASH_START hex default 0x0000 -config USBSERIAL - bool -config SERIAL - bool choice prompt "Communication interface" config LPC_USB diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig index 30642ab..f8c64fe 100644 --- a/src/stm32/Kconfig +++ b/src/stm32/Kconfig @@ -75,6 +75,10 @@ choice select MACH_STM32H7 endchoice +config MACH_STM32F103x6 + depends on LOW_LEVEL_OPTIONS && MACH_STM32F103 + bool "Only 10KiB of RAM (for rare stm32f103x6 variant)" + config MACH_STM32F0 bool config MACH_STM32F1 @@ -93,7 +97,8 @@ config MACH_STM32F4x5 # F405, F407, F429 series bool config HAVE_STM32_USBFS bool - default y if MACH_STM32F103 || MACH_STM32F0x2 || MACH_STM32F070 || MACH_STM32G0 + default y if MACH_STM32F0x2 || MACH_STM32G0 + default y if (MACH_STM32F103 || MACH_STM32F070) && !STM32_CLOCK_REF_INTERNAL config HAVE_STM32_USBOTG bool default y if MACH_STM32F2 || MACH_STM32F4 || MACH_STM32H7 @@ -152,7 +157,8 @@ config RAM_SIZE default 0x1000 if MACH_STM32F031 default 0x1800 if MACH_STM32F042 default 0x4000 if MACH_STM32F070 || MACH_STM32F072 - default 0x5000 if MACH_STM32F103 # Ram size of stm32f103x8 (20KiB) + default 0x2800 if MACH_STM32F103x6 + default 0x5000 if MACH_STM32F103 && !MACH_STM32F103x6 # Ram size of stm32f103x8 default 0x20000 if MACH_STM32F207 default 0x10000 if MACH_STM32F401 default 0x20000 if MACH_STM32F4x5 || MACH_STM32F446 @@ -257,12 +263,6 @@ config STM32F0_TRIM # Communication inteface ###################################################################### -config USBSERIAL - bool -config SERIAL - bool -config CANSERIAL - bool choice prompt "Communication interface" config STM32_USB_PA11_PA12 @@ -332,11 +332,6 @@ choice select CANSERIAL endchoice -config CANBUS_FREQUENCY - int "CAN bus speed" if LOW_LEVEL_OPTIONS && CANSERIAL - default 500000 - - ###################################################################### # Flash settings ###################################################################### diff --git a/src/stm32/Makefile b/src/stm32/Makefile index 5cdf64f..fc39af8 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 @@ -53,10 +53,9 @@ 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 - -dirs-$(CONFIG_CANSERIAL) += lib/fast-hash +canbus-src-y := generic/canserial.c ../lib/fast-hash/fasthash.c +canbus-src-$(CONFIG_HAVE_STM32_CANBUS) += stm32/can.c +src-$(CONFIG_CANSERIAL) += $(canbus-src-y) generic/canbus.c stm32/chipid.c # Binary output file rules target-y += $(OUT)canboot.bin