rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | LOCAL_DIR := $(GET_LOCAL_DIR) |
| 2 | |
| 3 | MODULE := $(LOCAL_DIR) |
| 4 | |
| 5 | # ROMBASE, MEMBASE, and MEMSIZE are required for the linker script |
| 6 | ROMBASE ?= 0x08000000 |
| 7 | MEMBASE ?= 0x20000000 |
| 8 | # default memsize, specific STM32_CHIP may override this |
| 9 | # and target/project may have already overridden |
| 10 | MEMSIZE ?= 131072 |
| 11 | |
| 12 | ARCH := arm |
| 13 | ARM_CPU := cortex-m4 |
| 14 | |
| 15 | # TODO: integrate better with platform/stm32f4xx/CMSIS/stm32f4xx.h |
| 16 | ifeq ($(STM32_CHIP),stm32f407) |
| 17 | GLOBAL_DEFINES += STM32F40_41xxx |
| 18 | FOUND_CHIP := true |
| 19 | endif |
| 20 | ifeq ($(STM32_CHIP),stm32f417) |
| 21 | FOUND_CHIP := true |
| 22 | GLOBAL_DEFINES += STM32F40_41xxx |
| 23 | endif |
| 24 | |
| 25 | ifeq ($(FOUND_CHIP),) |
| 26 | $(error unknown STM32F4xx chip $(STM32_CHIP)) |
| 27 | endif |
| 28 | |
| 29 | GLOBAL_INCLUDES += \ |
| 30 | $(LOCAL_DIR)/include/dev |
| 31 | |
| 32 | MODULE_SRCS += \ |
| 33 | $(LOCAL_DIR)/init.c \ |
| 34 | $(LOCAL_DIR)/vectab.c \ |
| 35 | $(LOCAL_DIR)/gpio.c \ |
| 36 | $(LOCAL_DIR)/timer.c \ |
| 37 | $(LOCAL_DIR)/debug.c \ |
| 38 | $(LOCAL_DIR)/uart.c \ |
| 39 | $(LOCAL_DIR)/flash.c |
| 40 | |
| 41 | # use a two segment memory layout, where all of the read-only sections |
| 42 | # of the binary reside in rom, and the read/write are in memory. The |
| 43 | # ROMBASE, MEMBASE, and MEMSIZE make variables are required to be set |
| 44 | # for the linker script to be generated properly. |
| 45 | # |
| 46 | LINKER_SCRIPT += \ |
| 47 | $(BUILDDIR)/system-twosegment.ld |
| 48 | |
| 49 | MODULE_DEPS += \ |
| 50 | arch/arm/arm-m/systick \ |
| 51 | lib/cbuf \ |
| 52 | lib/bio |
| 53 | |
| 54 | include $(LOCAL_DIR)/STM32F4xx_StdPeriph_Driver/rules.mk $(LOCAL_DIR)/CMSIS/rules.mk |
| 55 | |
| 56 | include make/module.mk |