-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
1 parent
ec3d865
commit 8b9cc62
Showing
17 changed files
with
92 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// ADC functions on STM32F4 | ||
// ADC functions on STM32 | ||
// | ||
// Copyright (C) 2019 Kevin O'Connor <[email protected]> | ||
// | ||
|
@@ -22,7 +22,7 @@ static const uint8_t adc_pins[] = { | |
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) | ||
#else | ||
#define CR2_FLAGS ADC_CR2_ADON | ||
|
@@ -52,7 +52,7 @@ gpio_adc_setup(uint32_t pin) | |
| (aticks << 21) | (aticks << 24) | (aticks << 27)); | ||
ADC1->CR2 = CR2_FLAGS; | ||
|
||
#if CONFIG_MACH_STM32F1xx | ||
#if CONFIG_MACH_STM32F1 | ||
// Perform calibration | ||
udelay(timer_from_us(1)); | ||
ADC1->CR2 = ADC_CR2_CAL | CR2_FLAGS; | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Main starting point for STM32F4 boards. | ||
// Main starting point for STM32 boards. | ||
// | ||
// Copyright (C) 2019 Kevin O'Connor <[email protected]> | ||
// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// STM32F4 serial | ||
// STM32 serial | ||
// | ||
// Copyright (C) 2019 Kevin O'Connor <[email protected]> | ||
// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// SPI functions on STM32F4 | ||
// SPI functions on STM32 | ||
// | ||
// Copyright (C) 2019 Kevin O'Connor <[email protected]> | ||
// | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Watchdog handler on STM32F4 | ||
// Watchdog handler on STM32 | ||
// | ||
// Copyright (C) 2019 Kevin O'Connor <[email protected]> | ||
// | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# Base config file for STM32F1 ARM processor | ||
CONFIG_MACH_STM32F1=y | ||
CONFIG_MACH_STM32=y | ||
CONFIG_MACH_STM32F103=y |