stm32f4: Builds and links!

master
Solomon Peachy 10 years ago
parent 318aa83967
commit bd09013aba
  1. 14
      inc/stm32f4xx_hw.h
  2. 1
      libs/stm32f4xx.ld.in
  3. 42
      libs/stm32f4xx.mk
  4. 6
      src/build.mk

@ -0,0 +1,14 @@
#ifndef __STM32F4XX_HW_H
#define __STM32F4XX_HW_H
/* Configuration */
#define MCU_SRAM_SIZE (256*1024)
#define MCU_SRAM_BASE (0x20000000)
#define MCU_EXTSRAM_SIZE (0)
#define MCU_EXTSRAM_BASE (0x68000000)
#define MCU_FLASH_BASE (0x08000000)
#define MCU_FLASH_SIZE (2048*1024)
#define MCU_FLASH_PAGE_SIZE 2048
#define MCU_FLASH_IMAGE_SIZE (2046*1024)
#endif

@ -0,0 +1 @@
stm32f10x.ld.in

@ -0,0 +1,42 @@
# The processor!
MCU_CORE=cm4
# Set up include paths
MCU_INCLUDE += -I$(LIBDIR)/CMSIS/Include
MCU_INCLUDE += -I$(LIBDIR)/CMSIS/Device/ST/STM32F4xx/Include
MCU_INCLUDE += -I$(LIBDIR)/STM32F4xx_StdPeriph_Driver/inc
# Set up CFLAGS
MCU_CPPFLAGS += -D$(shell echo -n $(MCU_SUBTYPE) | tr a-z A-Z )
MCU_CPPFLAGS += -D"assert_param(expr)=((void)0)"
MCU_CFLAGS += -mcpu=cortex-m4 -mthumb -Wa,-mthumb
# Target Libraries
MCU_LIBS += $(LIBDIR)/libstm32f4xx.a
# CMSIS
STM32F4xx_OBJS = $(LIBDIR)/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.o
# Standard Peripheral Library
STM32F4xx_OBJSR = misc.o stm32f4xx_dma.o stm32f4xx_rcc.o stm32f4xx_adc.o \
stm32f4xx_exti.o stm32f4xx_rng.o stm32f4xx_can.o stm32f4xx_flash.o \
stm32f4xx_rtc.o stm32f4xx_crc.o stm32f4xx_fsmc.o stm32f4xx_sdio.o \
stm32f4xx_cryp_aes.o stm32f4xx_gpio.o stm32f4xx_spi.o \
stm32f4xx_cryp.o stm32f4xx_hash.o stm32f4xx_syscfg.o \
stm32f4xx_cryp_des.o stm32f4xx_hash_md5.o stm32f4xx_tim.o \
stm32f4xx_cryp_tdes.o stm32f4xx_hash_sha1.o stm32f4xx_usart.o \
stm32f4xx_dac.o stm32f4xx_i2c.o stm32f4xx_wwdg.o stm32f4xx_dbgmcu.c \
stm32f4xx_iwdg.o stm32f4xx_dcmi.o stm32f4xx_pwr.o
STM32F4xx_OBJS += $(addprefix $(LIBDIR)/STM32F4xx_StdPeriph_Driver/src/,$(STM32F4xx_OBJSR))
# Bookkeeping
MCU_LIBS_OBJS += $(STM32F4xx_OBJS)
# Build Rules
$(LIBDIR)/startup_$(MCU_SUBTYPE).o: $(LIBDIR)/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc_ride7/startup_$(MCU_SUBTYPE).s
@$(E) " AS " $@
$(Q)$(AS) -c -o $@ $<
$(LIBDIR)/libstm32f4xx.a: $(STM32F4xx_OBJS) $(LIBDIR)/startup_$(MCU_SUBTYPE).o
@$(E) " AR " $@
$(Q)$(AR) cr $@ $(STM32F4xx_OBJS) $(LIBDIR)/startup_$(MCU_SUBTYPE).o

@ -4,8 +4,8 @@ CFLAGS += -Wno-unused-parameter
# Objects
OBJSR := main.o
OBJS = $(addprefix src/,$(OBJSR))
SRC_OBJS = $(addprefix src/,$(OBJSR))
src/core.a: $(VERSION_H) $(OBJS)
src/core.a: $(VERSION_H) $(SRC_OBJS)
@$(E) " AR " $@
$(Q)$(AR) cr $@ $(OBJS)
$(Q)$(AR) cr $@ $(SRC_OBJS)

Loading…
Cancel
Save