############################################################################## # Build global options # NOTE: Can be overridden externally. # # default paramenters MCU_SIZE ?= MCU_386K_64K USE_USB_DEVICE ?= no # Imported source files and paths CHIBIOS = $(SDK_ROOT) include $(CHIBIOS)/econais/build/configs.inc CONFIG = $(LIB_CONFIG) BOOTLOADER = $(LIB_BOOTLOADER) PLAT = $(LIB_PLAT) USE_UPNP = $(LIB_USE_UPNP) USE_DEBUGER = $(LIB_USE_DEBUGER) USE_WPS = $(LIB_USE_WPS) USE_8021X = $(LIB_USE_8021X) RF_TEST = $(LIB_RF_TEST) # Select the LWIP version (v140,v141) LWIP ?= v141 # Compiler options here. ifeq ($(USE_OPT),) USE_OPT = -ggdb -fomit-frame-pointer -falign-functions=16 ifeq ($(USE_DEBUGER),false) USE_OPT += -O2 else USE_OPT += -O0 endif endif # C specific options here (added to USE_OPT). ifeq ($(USE_COPT),) USE_COPT = endif # C++ specific options here (added to USE_OPT). ifeq ($(USE_CPPOPT),) USE_CPPOPT = -fno-rtti endif # Enable this if you want the linker to remove unused code and data ifeq ($(USE_LINK_GC),) USE_LINK_GC = yes endif # If enabled, this option allows to compile the application in THUMB mode. ifeq ($(USE_THUMB),) USE_THUMB = yes endif # Enable this if you want to see the full log while compiling. ifeq ($(USE_VERBOSE_COMPILE),) USE_VERBOSE_COMPILE = no endif # # Build global options ############################################################################## ############################################################################## # Architecture or project specific options # # Enable this if you really want to use the STM FWLib. ifeq ($(USE_FWLIB),) USE_FWLIB = yes endif # # Architecture or project specific options ############################################################################## ############################################################################## # Project, sources and paths # # Define project name here PROJECT = $(PROJECT_OUT) ifeq ($(PLAT),STM32F4) # Imported source files and paths include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F4xx/port.mk # Define linker script file here LDSCRIPT= $(PORTLD)/STM32F407xG.ld # platform specific flags USE_OPT += -mfpu=fpv4-sp-d16 -mhard-float -fsingle-precision-constant endif ifeq ($(PLAT),STM32F1) # Imported source files and paths include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F1xx/port.mk # Define linker script file here ifeq ($(MCU_SIZE),MCU_768K_96K) ifeq ($(BOOTLOADER),BOOTLOADER_NONE) # NO bootloader LDSCRIPT= $(PORTLD)/STM32F103xG_768K_96K.ld else # OTA bootloader LDSCRIPT= $(PORTLD)/STM32F103xG_768K_96K_bootloader_ota.ld endif endif ifeq ($(MCU_SIZE),MCU_1M_96K) ifeq ($(BOOTLOADER),BOOTLOADER_NONE) # NO bootloader LDSCRIPT= $(PORTLD)/STM32F103xG_1M_96K.ld else # OTA bootloader LDSCRIPT= $(PORTLD)/STM32F103xG_1M_96K_bootloader_ota.ld endif endif # platform specific flags USE_OPT += -DUSE_STDPERIPH_DRIVER -DSTM32F10X_XL -DUSE_STM3210E_EVAL -DVECT_TAB_FLASH endif include $(CHIBIOS)/os/kernel/kernel.mk # C sources that can be compiled in ARM or THUMB mode depending on the global # setting. CSRC = $(PORTSRC) \ $(KERNSRC) \ $(CHIBIOS)/os/various/syscalls.c \ $(CHIBIOS)/os/various/evtimer.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global # setting. CPPSRC = # C sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. ACSRC = # C++ sources to be compiled in ARM mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. ACPPSRC = # C sources to be compiled in THUMB mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. TCSRC = # C sources to be compiled in THUMB mode regardless of the global setting. # NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler # option that results in lower performance and larger code size. TCPPSRC = # List ASM source files here ASMSRC = $(PORTASM) INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ $(CHIBIOS)/os/various # # Project, sources and paths ############################################################################## ############################################################################## # Compiler settings # ifeq ($(PLAT),STM32F4) MCU = cortex-m4 endif ifeq ($(PLAT),STM32F1) MCU = cortex-m3 endif #TRGT = arm-elf- TRGT = arm-none-eabi- CC = $(TRGT)gcc CPPC = $(TRGT)g++ # Enable loading with g++ only if you need C++ runtime support. # NOTE: You can use C++ even without C++ support if you are careful. C++ # runtime support makes code size explode. LD = $(TRGT)gcc #LD = $(TRGT)g++ CP = $(TRGT)objcopy AS = $(TRGT)gcc -x assembler-with-cpp OD = $(TRGT)objdump HEX = $(CP) -O ihex BIN = $(CP) -O binary SIZE = $(TRGT)size # ARM-specific options here AOPT = # THUMB-specific options here TOPT = -mthumb -DTHUMB # Define C warning options here CWARN = -Wall -Wstrict-prototypes -Wunused-variable -Wunused-function # Define C++ warning options here CPPWARN = -Wall -Wunused-variable # # Compiler settings ############################################################################## ############################################################################## # Start of default section # # List all default C defines here, like -D_DEBUG=1 DDEFS = -DGCC_ARMCM3 -DCHIBIOS -D$(PLAT) $(USER_DEFS) # List all default ASM defines here, like -D_DEBUG=1 DADEFS = # List all default directories to look for include files here DINCDIR = # List the default directory to look for the libraries here DLIBDIR = # List all default libraries here DLIBS = # # End of default section ############################################################################## ############################################################################## # Start of user section # # List all user C define here, like -D_DEBUG=1 UDEFS = # Define ASM defines here UADEFS = # List all user directories here UINCDIR = # List the user directory to look for the libraries here ULIBDIR = # List all user libraries here ULIBS = $(CHIBIOS)/econais/build/libwismart.a # # End of user defines ############################################################################## ifeq ($(CONFIG),release) DDEFS += -DLWIP_NOASSERT USE_OPT += -DLIBWISMART_RELEASE endif ifeq ($(BOOTLOADER),BOOTLOADER_NONE) DDEFS += -DLIBWISMART_BOOTLOADER_NONE endif ifeq ($(BOOTLOADER),BOOTLOADER_OTA) DDEFS += -DLIBWISMART_BOOTLOADER_OTA DDEFS += -DBOOLOADER_IMAGE_PAGES="(132)" DDEFS += -DBOOTLOADER_MUTUAL_EEPROM_PAGE_INDEX="(BOOLOADER_IMAGE_PAGES + 0)" DDEFS += -DBOOTLOADER_APP_PAGE_INDEX="(BOOLOADER_IMAGE_PAGES + 1)" DDEFS += -DCORTEX_VTOR_INIT="(BOOTLOADER_APP_PAGE_INDEX * 2048)" endif ifeq ($(USE_UPNP),yes) USE_OPT += -DLWIP_UPNP endif ifeq ($(USE_FWLIB),yes) USE_OPT += -DUSE_STDPERIPH_DRIVER ifeq ($(PLAT),STM32F4) USE_OPT += -DSTM32F4XX USE_OPT += -DUSE_STM324xG_EVAL USE_OPT += -DMEDIA_USB_KEY USE_OPT += -DUSB_LOCK USE_OPT += -DMII_MODE endif endif ifeq ($(PLAT),STM32F4) #include USB Host files include $(CHIBIOS)/stm32f4Driver/usb_key.mk include $(CHIBIOS)/stm32f4Driver/usb_key_include.mk CSRC += $(USB_PROJECT_SRC) INCDIR += $(USB_PROJECT_INC) #include stm library include $(CHIBIOS)/stm32f4Library/stm32f4Library.mk CSRC += $(STM_LIBRARY_SRC) INCDIR += $(STM_LIBRARY_INC) #include stm drivers include $(CHIBIOS)/stm32f4Driver/stm32f4Driver.mk CSRC += $(STM_DRIVER_ETHERNET_SRC) INCDIR += $(STM_DRIVER_ETHERNET_INC) #CSRC += $(STM_DRIVER_EVAL_SRC) INCDIR += $(STM_DRIVER_EVAL_INC) #include fatfs include $(CHIBIOS)/externalModules/fatfs.mk CSRC += $(FATFS_SRC) INCDIR += $(FATFS_INC) endif ifeq ($(PLAT),STM32F1) #include stm library include $(CHIBIOS)/econais/STM32_Libs/F1/stm32f1Library.mk INCDIR += $(STM_LIBRARY_INC) ifeq ($(USE_USB_DEVICE),yes) #include stm32f1 FS USB Device driver and more stm drivers include $(CHIBIOS)/stm32f1Driver/stm32f1Driver.mk USE_OPT += -DUSE_USB_DEVICE CSRC += $(STM_DRIVER_FS_USB_DEVICE_SRC) INCDIR += $(STM_DRIVER_FS_USB_DEVICE_INC) CSRC += $(STM_DRIVER_EVAL_SRC) INCDIR += $(STM_DRIVER_EVAL_INC) INCDIR += $(STM_DRIVER_EVAL_INC) endif endif ############################################################################## # include files the src code is inside of .a file #include lwip ifeq ($(LWIP),v140) include $(CHIBIOS)/externalModules/lwip_v14/lwip_include.mk endif ifeq ($(LWIP),v141) include $(CHIBIOS)/externalModules/lwip_v141/lwip_include.mk endif INCDIR += $(LWIP_INC) #include econais INCDIR += $(CHIBIOS)/econais/ INCDIR += $(CHIBIOS)/econais/inc/$(PLAT) ########## #include main CSRC += $(USER_SRC) INCDIR += $(USER_INCDIR) include $(CHIBIOS)/os/ports/GCC/ARMCMx/rules.mk EXTERNAL: ifneq ($(PLAT),$(LIB_PLAT)) $(error The target platform of the libwimart is different from the target platform of application. $(PLAT)-$(LIB_PLAT)) endif