mirror of https://github.com/Desuuuu/klipper.git
stm32: Rename stm32f4/ directory to stm32/
Now that the code in stm32f4/ can handle both stm32f1 and stm32f4 chips, rename the directory to just "stm32". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ec3d865b51
commit
8b9cc62359
|
@ -19,12 +19,10 @@ choice
|
||||||
bool "SAMD21/SAMD51"
|
bool "SAMD21/SAMD51"
|
||||||
config MACH_LPC176X
|
config MACH_LPC176X
|
||||||
bool "LPC176x (Smoothieboard)"
|
bool "LPC176x (Smoothieboard)"
|
||||||
|
config MACH_STM32
|
||||||
|
bool "STMicroelectronics STM32F1/F4"
|
||||||
config MACH_STM32F0
|
config MACH_STM32F0
|
||||||
bool "STMicroelectronics STM32F042"
|
bool "STMicroelectronics STM32F042"
|
||||||
config MACH_STM32F1
|
|
||||||
bool "STMicroelectronics STM32F103"
|
|
||||||
config MACH_STM32F4
|
|
||||||
bool "STMicroelectronics STM32F4"
|
|
||||||
config MACH_PRU
|
config MACH_PRU
|
||||||
bool "Beaglebone PRU"
|
bool "Beaglebone PRU"
|
||||||
config MACH_LINUX
|
config MACH_LINUX
|
||||||
|
@ -37,9 +35,8 @@ source "src/avr/Kconfig"
|
||||||
source "src/atsam/Kconfig"
|
source "src/atsam/Kconfig"
|
||||||
source "src/atsamd/Kconfig"
|
source "src/atsamd/Kconfig"
|
||||||
source "src/lpc176x/Kconfig"
|
source "src/lpc176x/Kconfig"
|
||||||
|
source "src/stm32/Kconfig"
|
||||||
source "src/stm32f0/Kconfig"
|
source "src/stm32f0/Kconfig"
|
||||||
source "src/stm32f1/Kconfig"
|
|
||||||
source "src/stm32f4/Kconfig"
|
|
||||||
source "src/pru/Kconfig"
|
source "src/pru/Kconfig"
|
||||||
source "src/linux/Kconfig"
|
source "src/linux/Kconfig"
|
||||||
source "src/simulator/Kconfig"
|
source "src/simulator/Kconfig"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Kconfig settings for STM32F4 processors
|
# Kconfig settings for STM32 processors
|
||||||
|
|
||||||
if MACH_STM32F4
|
if MACH_STM32
|
||||||
|
|
||||||
config STM32F4_SELECT
|
config STM32_SELECT
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
select HAVE_GPIO
|
select HAVE_GPIO
|
||||||
|
@ -12,28 +12,28 @@ config STM32F4_SELECT
|
||||||
|
|
||||||
config BOARD_DIRECTORY
|
config BOARD_DIRECTORY
|
||||||
string
|
string
|
||||||
default "stm32f4"
|
default "stm32"
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Processor model"
|
prompt "Processor model"
|
||||||
config MACH_STM32F103
|
config MACH_STM32F103
|
||||||
bool "STM32F103"
|
bool "STM32F103"
|
||||||
select MACH_STM32F1xx
|
select MACH_STM32F1
|
||||||
select HAVE_STM32_USBFS
|
select HAVE_STM32_USBFS
|
||||||
config MACH_STM32F405
|
config MACH_STM32F405
|
||||||
bool "STM32F405"
|
bool "STM32F405"
|
||||||
select MACH_STM32F4xx
|
select MACH_STM32F4
|
||||||
config MACH_STM32F407
|
config MACH_STM32F407
|
||||||
bool "STM32F407"
|
bool "STM32F407"
|
||||||
select MACH_STM32F4xx
|
select MACH_STM32F4
|
||||||
config MACH_STM32F446
|
config MACH_STM32F446
|
||||||
bool "STM32F446"
|
bool "STM32F446"
|
||||||
select MACH_STM32F4xx
|
select MACH_STM32F4
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config MACH_STM32F1xx
|
config MACH_STM32F1
|
||||||
bool
|
bool
|
||||||
config MACH_STM32F4xx
|
config MACH_STM32F4
|
||||||
bool
|
bool
|
||||||
config HAVE_STM32_USBFS
|
config HAVE_STM32_USBFS
|
||||||
bool
|
bool
|
|
@ -0,0 +1,63 @@
|
||||||
|
# Additional STM32 build rules
|
||||||
|
|
||||||
|
# Setup the toolchain
|
||||||
|
CROSS_PREFIX=arm-none-eabi-
|
||||||
|
|
||||||
|
dirs-y += src/stm32 src/generic
|
||||||
|
dirs-$(CONFIG_MACH_STM32F1) += lib/stm32f1 lib/stm32f1/gcc
|
||||||
|
dirs-$(CONFIG_MACH_STM32F4) += lib/stm32f4 lib/stm32f4/gcc
|
||||||
|
|
||||||
|
MCU := $(shell echo $(CONFIG_MCU))
|
||||||
|
MCU_UPPER := $(shell echo $(CONFIG_MCU) | tr a-z A-Z | tr X x)
|
||||||
|
|
||||||
|
CFLAGS-$(CONFIG_MACH_STM32F1) += -mcpu=cortex-m3 -Ilib/stm32f1/include
|
||||||
|
CFLAGS-$(CONFIG_MACH_STM32F4) += -mcpu=cortex-m4 -Ilib/stm32f4/include
|
||||||
|
CFLAGS-$(CONFIG_MACH_STM32F4) += -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
||||||
|
|
||||||
|
CFLAGS += $(CFLAGS-y) -D$(MCU_UPPER) -mthumb -Ilib/cmsis-core
|
||||||
|
CFLAGS_klipper.elf += -T $(OUT)stm32.ld --specs=nano.specs --specs=nosys.specs
|
||||||
|
|
||||||
|
# Add source files
|
||||||
|
src-y += stm32/main.c stm32/watchdog.c stm32/gpio.c
|
||||||
|
src-y += generic/crc16_ccitt.c generic/armcm_irq.c generic/armcm_timer.c
|
||||||
|
src-$(CONFIG_MACH_STM32F1) += ../lib/stm32f1/system_stm32f1xx.c
|
||||||
|
src-$(CONFIG_MACH_STM32F1) += stm32/stm32f1.c
|
||||||
|
src-$(CONFIG_MACH_STM32F4) += ../lib/stm32f4/system_stm32f4xx.c
|
||||||
|
src-$(CONFIG_MACH_STM32F4) += stm32/clock.c
|
||||||
|
src-$(CONFIG_HAVE_GPIO_ADC) += stm32/adc.c
|
||||||
|
src-$(CONFIG_HAVE_GPIO_SPI) += stm32/spi.c
|
||||||
|
src-$(CONFIG_USBSERIAL) += stm32/usbfs.c generic/usb_cdc.c
|
||||||
|
src-$(CONFIG_SERIAL) += stm32/serial.c generic/serial_irq.c
|
||||||
|
|
||||||
|
# Add assembler build rules
|
||||||
|
$(OUT)%.o: %.s $(OUT)autoconf.h $(OUT)board-link
|
||||||
|
@echo " Assembling $@"
|
||||||
|
$(Q)$(AS) $< -o $@
|
||||||
|
|
||||||
|
asmsrc-$(CONFIG_MACH_STM32F1) := ../lib/stm32f1/gcc/startup_$(MCU).s
|
||||||
|
asmsrc-$(CONFIG_MACH_STM32F4) := ../lib/stm32f4/gcc/startup_$(MCU).s
|
||||||
|
OBJS_klipper.elf += $(patsubst %.s, $(OUT)src/%.o,$(asmsrc-y))
|
||||||
|
|
||||||
|
# Build the linker script
|
||||||
|
$(OUT)stm32.ld: src/stm32/stm32.lds.S $(OUT)board-link
|
||||||
|
@echo " Preprocessing $@"
|
||||||
|
$(Q)$(CPP) -I$(OUT) -P -MD -MT $@ $< -o $@
|
||||||
|
$(OUT)klipper.elf: $(OUT)stm32.ld
|
||||||
|
|
||||||
|
# Binary output file rules
|
||||||
|
target-y += $(OUT)klipper.bin
|
||||||
|
|
||||||
|
$(OUT)klipper.bin: $(OUT)klipper.elf
|
||||||
|
@echo " Creating hex file $@"
|
||||||
|
$(Q)$(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
|
FLASH_TYPE-$(CONFIG_MACH_STM32F1) := stm32f1
|
||||||
|
FLASH_TYPE-$(CONFIG_MACH_STM32F4) := stm32f4
|
||||||
|
|
||||||
|
flash: $(OUT)klipper.bin
|
||||||
|
@echo " Flashing $< to $(FLASH_DEVICE)"
|
||||||
|
$(Q)$(PYTHON) ./scripts/flash_usb.py -t $(FLASH_TYPE-y) -d "$(FLASH_DEVICE)" $(if $(NOSUDO),--no-sudo) $(OUT)klipper.bin
|
||||||
|
|
||||||
|
serialflash: $(OUT)klipper.bin
|
||||||
|
@echo " Flashing $< to $(FLASH_DEVICE) via stm32flash"
|
||||||
|
$(Q)stm32flash -w $< -v -g 0 $(FLASH_DEVICE)
|
|
@ -1,4 +1,4 @@
|
||||||
// ADC functions on STM32F4
|
// ADC functions on STM32
|
||||||
//
|
//
|
||||||
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
||||||
//
|
//
|
||||||
|
@ -22,7 +22,7 @@ static const uint8_t adc_pins[] = {
|
||||||
GPIO('C', 2), GPIO('C', 3), GPIO('C', 4), GPIO('C', 5)
|
GPIO('C', 2), GPIO('C', 3), GPIO('C', 4), GPIO('C', 5)
|
||||||
};
|
};
|
||||||
|
|
||||||
#if CONFIG_MACH_STM32F1xx
|
#if CONFIG_MACH_STM32F1
|
||||||
#define CR2_FLAGS (ADC_CR2_ADON | (7 << ADC_CR2_EXTSEL_Pos) | ADC_CR2_EXTTRIG)
|
#define CR2_FLAGS (ADC_CR2_ADON | (7 << ADC_CR2_EXTSEL_Pos) | ADC_CR2_EXTTRIG)
|
||||||
#else
|
#else
|
||||||
#define CR2_FLAGS ADC_CR2_ADON
|
#define CR2_FLAGS ADC_CR2_ADON
|
||||||
|
@ -52,7 +52,7 @@ gpio_adc_setup(uint32_t pin)
|
||||||
| (aticks << 21) | (aticks << 24) | (aticks << 27));
|
| (aticks << 21) | (aticks << 24) | (aticks << 27));
|
||||||
ADC1->CR2 = CR2_FLAGS;
|
ADC1->CR2 = CR2_FLAGS;
|
||||||
|
|
||||||
#if CONFIG_MACH_STM32F1xx
|
#if CONFIG_MACH_STM32F1
|
||||||
// Perform calibration
|
// Perform calibration
|
||||||
udelay(timer_from_us(1));
|
udelay(timer_from_us(1));
|
||||||
ADC1->CR2 = ADC_CR2_CAL | CR2_FLAGS;
|
ADC1->CR2 = ADC_CR2_CAL | CR2_FLAGS;
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef __STM32F4_GPIO_H
|
#ifndef __STM32_GPIO_H
|
||||||
#define __STM32F4_GPIO_H
|
#define __STM32_GPIO_H
|
||||||
|
|
||||||
#include <stdint.h> // uint32_t
|
#include <stdint.h> // uint32_t
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#ifndef __STM32F4_INTERNAL_H
|
#ifndef __STM32_INTERNAL_H
|
||||||
#define __STM32F4_INTERNAL_H
|
#define __STM32_INTERNAL_H
|
||||||
// Local definitions for STM32F4 code
|
// Local definitions for STM32 code
|
||||||
|
|
||||||
#include "autoconf.h" // CONFIG_MACH_STM32F1xx
|
#include "autoconf.h" // CONFIG_MACH_STM32F1
|
||||||
|
|
||||||
#if CONFIG_MACH_STM32F1xx
|
#if CONFIG_MACH_STM32F1
|
||||||
#include "stm32f1xx.h"
|
#include "stm32f1xx.h"
|
||||||
#else
|
#else
|
||||||
#include "stm32f4xx.h"
|
#include "stm32f4xx.h"
|
|
@ -1,4 +1,4 @@
|
||||||
// Main starting point for STM32F4 boards.
|
// Main starting point for STM32 boards.
|
||||||
//
|
//
|
||||||
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
||||||
//
|
//
|
|
@ -1,4 +1,4 @@
|
||||||
// STM32F4 serial
|
// STM32 serial
|
||||||
//
|
//
|
||||||
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
||||||
//
|
//
|
|
@ -1,4 +1,4 @@
|
||||||
// SPI functions on STM32F4
|
// SPI functions on STM32
|
||||||
//
|
//
|
||||||
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
||||||
//
|
//
|
|
@ -1,4 +1,4 @@
|
||||||
// Watchdog handler on STM32F4
|
// Watchdog handler on STM32
|
||||||
//
|
//
|
||||||
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
// Copyright (C) 2019 Kevin O'Connor <kevin@koconnor.net>
|
||||||
//
|
//
|
|
@ -1,63 +0,0 @@
|
||||||
# Additional STM32F4 build rules
|
|
||||||
|
|
||||||
# Setup the toolchain
|
|
||||||
CROSS_PREFIX=arm-none-eabi-
|
|
||||||
|
|
||||||
dirs-y += src/stm32f4 src/generic
|
|
||||||
dirs-$(CONFIG_MACH_STM32F1xx) += lib/stm32f1 lib/stm32f1/gcc
|
|
||||||
dirs-$(CONFIG_MACH_STM32F4xx) += lib/stm32f4 lib/stm32f4/gcc
|
|
||||||
|
|
||||||
MCU := $(shell echo $(CONFIG_MCU))
|
|
||||||
MCU_UPPER := $(shell echo $(CONFIG_MCU) | tr a-z A-Z | tr X x)
|
|
||||||
|
|
||||||
CFLAGS-$(CONFIG_MACH_STM32F1xx) += -mcpu=cortex-m3 -Ilib/stm32f1/include
|
|
||||||
CFLAGS-$(CONFIG_MACH_STM32F4xx) += -mcpu=cortex-m4 -Ilib/stm32f4/include
|
|
||||||
CFLAGS-$(CONFIG_MACH_STM32F4xx) += -mfpu=fpv4-sp-d16 -mfloat-abi=hard
|
|
||||||
|
|
||||||
CFLAGS += $(CFLAGS-y) -D$(MCU_UPPER) -mthumb -Ilib/cmsis-core
|
|
||||||
CFLAGS_klipper.elf += -T $(OUT)stm32f4.ld --specs=nano.specs --specs=nosys.specs
|
|
||||||
|
|
||||||
# Add source files
|
|
||||||
src-y += stm32f4/main.c stm32f4/watchdog.c stm32f4/gpio.c
|
|
||||||
src-y += generic/crc16_ccitt.c generic/armcm_irq.c generic/armcm_timer.c
|
|
||||||
src-$(CONFIG_MACH_STM32F1xx) += ../lib/stm32f1/system_stm32f1xx.c
|
|
||||||
src-$(CONFIG_MACH_STM32F1xx) += stm32f4/stm32f1.c
|
|
||||||
src-$(CONFIG_MACH_STM32F4xx) += ../lib/stm32f4/system_stm32f4xx.c
|
|
||||||
src-$(CONFIG_MACH_STM32F4xx) += stm32f4/clock.c
|
|
||||||
src-$(CONFIG_HAVE_GPIO_ADC) += stm32f4/adc.c
|
|
||||||
src-$(CONFIG_HAVE_GPIO_SPI) += stm32f4/spi.c
|
|
||||||
src-$(CONFIG_USBSERIAL) += stm32f4/usbfs.c generic/usb_cdc.c
|
|
||||||
src-$(CONFIG_SERIAL) += stm32f4/serial.c generic/serial_irq.c
|
|
||||||
|
|
||||||
# Add assembler build rules
|
|
||||||
$(OUT)%.o: %.s $(OUT)autoconf.h $(OUT)board-link
|
|
||||||
@echo " Assembling $@"
|
|
||||||
$(Q)$(AS) $< -o $@
|
|
||||||
|
|
||||||
asmsrc-$(CONFIG_MACH_STM32F1xx) := ../lib/stm32f1/gcc/startup_$(MCU).s
|
|
||||||
asmsrc-$(CONFIG_MACH_STM32F4xx) := ../lib/stm32f4/gcc/startup_$(MCU).s
|
|
||||||
OBJS_klipper.elf += $(patsubst %.s, $(OUT)src/%.o,$(asmsrc-y))
|
|
||||||
|
|
||||||
# Build the linker script
|
|
||||||
$(OUT)stm32f4.ld: src/stm32f4/stm32f4.lds.S $(OUT)board-link
|
|
||||||
@echo " Preprocessing $@"
|
|
||||||
$(Q)$(CPP) -I$(OUT) -P -MD -MT $@ $< -o $@
|
|
||||||
$(OUT)klipper.elf: $(OUT)stm32f4.ld
|
|
||||||
|
|
||||||
# Binary output file rules
|
|
||||||
target-y += $(OUT)klipper.bin
|
|
||||||
|
|
||||||
$(OUT)klipper.bin: $(OUT)klipper.elf
|
|
||||||
@echo " Creating hex file $@"
|
|
||||||
$(Q)$(OBJCOPY) -O binary $< $@
|
|
||||||
|
|
||||||
FLASH_TYPE-$(CONFIG_MACH_STM32F1xx) := stm32f1
|
|
||||||
FLASH_TYPE-$(CONFIG_MACH_STM32F4xx) := stm32f4
|
|
||||||
|
|
||||||
flash: $(OUT)klipper.bin
|
|
||||||
@echo " Flashing $< to $(FLASH_DEVICE)"
|
|
||||||
$(Q)$(PYTHON) ./scripts/flash_usb.py -t $(FLASH_TYPE-y) -d "$(FLASH_DEVICE)" $(if $(NOSUDO),--no-sudo) $(OUT)klipper.bin
|
|
||||||
|
|
||||||
serialflash: $(OUT)klipper.bin
|
|
||||||
@echo " Flashing $< to $(FLASH_DEVICE) via stm32flash"
|
|
||||||
$(Q)stm32flash -w $< -v -g 0 $(FLASH_DEVICE)
|
|
|
@ -1,2 +1,3 @@
|
||||||
# Base config file for STM32F1 ARM processor
|
# Base config file for STM32F1 ARM processor
|
||||||
CONFIG_MACH_STM32F1=y
|
CONFIG_MACH_STM32=y
|
||||||
|
CONFIG_MACH_STM32F103=y
|
||||||
|
|
Loading…
Reference in New Issue