From 9c393c39c257ae3bf3977af5195f749e13cecfd2 Mon Sep 17 00:00:00 2001 From: NetBUG Date: Mon, 7 Aug 2017 10:22:50 -0700 Subject: [PATCH 1/3] Compilation OK; linking failed --- Bootloader/main.c | 11 ++- Inc/Buzzer.h | 3 + Inc/PanelDue.h | 1 + Inc/bsp_driver_sd.h | 3 + Inc/eeprom.h | 1 + Inc/mks_conf.h | 2 + Makefile | 185 ++++++++++++++++++++++++++++++++++++++++++++ Src/Buzzer.cpp | 2 +- Src/Mem.cpp | 2 +- Src/Misc.cpp | 2 +- Src/bsp_driver_sd.c | 2 +- Src/fatfs.c | 2 +- Src/main.c | 6 +- 13 files changed, 208 insertions(+), 14 deletions(-) create mode 100755 Makefile diff --git a/Bootloader/main.c b/Bootloader/main.c index 9f3a45d..a02d53b 100644 --- a/Bootloader/main.c +++ b/Bootloader/main.c @@ -31,9 +31,13 @@ ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ -#include "boot_conf.h" +#include "mks_conf.h" #include "stm32f1xx_hal.h" +#include "stm32f1xx_hal_conf.h" +#include "stm32f1xx_hal_spi.h" +#include "stm32f1xx_hal_tim.h" +#include "boot_conf.h" #include "fatfs.h" #if defined(STM32F107xC) && defined(MKS_TFT) @@ -65,11 +69,6 @@ void Error_Handler(void); static void MX_GPIO_Init(void); void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim); -void osDelay(__IO uint32_t Delay) -{ - HAL_Delay(Delay); -} - inline void moveVectorTable(uint32_t Offset) { // __disable_irq(); diff --git a/Inc/Buzzer.h b/Inc/Buzzer.h index 16becca..608671c 100644 --- a/Inc/Buzzer.h +++ b/Inc/Buzzer.h @@ -9,6 +9,9 @@ #ifndef BUZZER_H_ #define BUZZER_H_ +#include "mks_conf.h" +#include "stm32f1xx_hal_tim.h" + #ifdef __cplusplus namespace Buzzer diff --git a/Inc/PanelDue.h b/Inc/PanelDue.h index d71bb23..bdce3f2 100644 --- a/Inc/PanelDue.h +++ b/Inc/PanelDue.h @@ -13,6 +13,7 @@ #include "RequestTimer.h" #include "PrinterStatus.h" #include "UserInterface.h" +#include "eeprom.h" // Functions called from the serial I/O module extern void ProcessReceivedValue(const char id[], const char val[], int index); diff --git a/Inc/bsp_driver_sd.h b/Inc/bsp_driver_sd.h index 6c5a350..0bb6bda 100644 --- a/Inc/bsp_driver_sd.h +++ b/Inc/bsp_driver_sd.h @@ -36,12 +36,15 @@ #ifndef __STM32F1XX_SD_H #define __STM32F1XX_SD_H + #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f1xx_hal.h" +#include "stm32f1xx_hal_conf.h" +#include "stm32f1xx_hal_sd.h" /* Exported constants --------------------------------------------------------*/ diff --git a/Inc/eeprom.h b/Inc/eeprom.h index 3248585..afbc6dd 100644 --- a/Inc/eeprom.h +++ b/Inc/eeprom.h @@ -35,6 +35,7 @@ #define __EEPROM_H #include "stm32f1xx_hal.h" +#include "stm32f1xx_hal_i2c.h" #include "cmsis_os.h" #define EEPROM_ADDRESS 0xA0 // A0 = A1 = A2 = 0 diff --git a/Inc/mks_conf.h b/Inc/mks_conf.h index 7acf87c..a96dd86 100644 --- a/Inc/mks_conf.h +++ b/Inc/mks_conf.h @@ -36,9 +36,11 @@ #include "ecv.h" #include "stm32f1xx_hal.h" +#include "stm32f1xx_hal_spi.h" #include "cmsis_os.h" #include "fatfs.h" + #if defined(STM32F107xC) && defined(MKS_TFT) /** * Makerbase MKS-TFT32 diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..d1133f5 --- /dev/null +++ b/Makefile @@ -0,0 +1,185 @@ +TARGET=main.hex +EXECUTABLE=main.elf +BINARY=main.bin + +CC=arm-none-eabi-gcc +LD=arm-none-eabi-gcc +AR=arm-none-eabi-ar +AS=arm-none-eabi-as +CP=arm-none-eabi-objcopy +OD=arm-none-eabi-objdump + +BIN=$(CP) -O ihex + +# Select the appropriate option for your device, the available options are listed below +# with a description copied from stm32f10x.h +# Make sure to set the startup code file to the right device family, too! +# +# STM32F10X_LD STM32F10X_LD: STM32 Low density devices +# STM32F10X_LD_VL STM32F10X_LD_VL: STM32 Low density Value Line devices +# STM32F10X_MD STM32F10X_MD: STM32 Medium density devices +# STM32F10X_MD_VL STM32F10X_MD_VL: STM32 Medium density Value Line devices +# STM32F10X_HD STM32F10X_HD: STM32 High density devices +# STM32F10X_HD_VL STM32F10X_HD_VL: STM32 High density value line devices +# STM32F10X_XL STM32F10X_XL: STM32 XL-density devices +# STM32F10X_CL STM32F10X_CL: STM32 Connectivity line devices +# +# - Low-density devices are STM32F101xx, STM32F102xx and STM32F103xx microcontrollers +# where the Flash memory density ranges between 16 and 32 Kbytes. +# +# - Low-density value line devices are STM32F100xx microcontrollers where the Flash +# memory density ranges between 16 and 32 Kbytes. +# +# - Medium-density devices are STM32F101xx, STM32F102xx and STM32F103xx microcontrollers +# where the Flash memory density ranges between 64 and 128 Kbytes. +# +# - Medium-density value line devices are STM32F100xx microcontrollers where the +# Flash memory density ranges between 64 and 128 Kbytes. +# +# - High-density devices are STM32F101xx and STM32F103xx microcontrollers where +# the Flash memory density ranges between 256 and 512 Kbytes. +# +# - High-density value line devices are STM32F100xx microcontrollers where the +# Flash memory density ranges between 256 and 512 Kbytes. +# +# - XL-density devices are STM32F101xx and STM32F103xx microcontrollers where +# the Flash memory density ranges between 512 and 1024 Kbytes. +# +# - Connectivity line devices are STM32F105xx and STM32F107xx microcontrollers. +# +# HSE_VALUE sets the value of the HSE clock, 8MHz in this case + +DEFS = -DUSE_STDPERIPH_DRIVER -DSTM32F10X_CL -DHSE_VALUE=8000000 -DSTM32F107xC -DMKS_TFT -DILI9325 +#STARTUP = ../Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/startup_stm32f10x_cl.s +STARTUP = Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f107xc.s + +MCU = cortex-m3 +MCFLAGS = -mcpu=$(MCU) -mthumb -mlittle-endian -mthumb-interwork + +STM32_INCLUDES = -IDrivers/STM32F1xx_HAL_Driver/Inc/ \ + -IDrivers/CMSIS/Device/ST/STM32F1xx/Include/ \ + -IDrivers/CMSIS/Include/ \ + -IIcons \ + -IInc \ + -IBootloader \ + -IMiddlewares/Third_Party/FreeRTOS/Source/include \ + -IMiddlewares/Third_Party/FatFs/src/ \ + -IMiddlewares/ST/STM32_USB_Host_Library/Class/MSC/Inc \ + -IMiddlewares/ST/STM32_USB_Host_Library/Core/Inc \ + -IMiddlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 \ + -IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS + +OPTIMIZE = -Os + +CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) -I. -I./ $(STM32_INCLUDES) -Wl,-T,STM32F107VC_FLASH.ld +AFLAGS = $(MCFLAGS) + +SRC = Src/Buzzer.cpp \ + Src/Display.cpp \ + Src/eeprom.c \ + Src/fatfs.c \ + Src/FileManager.cpp \ + Src/main.c \ + Src/Mem.cpp \ + Src/MessageLog.cpp \ + Src/Misc.cpp \ + Src/PanelDue.cpp \ + Src/Print.cpp \ + Src/RequestTimer.cpp \ +# Src/sd_diskio.c \ + Src/SerialIo.cpp \ + Src/spiflash_w25q16dv.c \ + Src/spisd_diskio.c \ + Src/stm32f1xx_hal_msp.c \ + Src/stm32f1xx_hal_timebase_TIM.c \ + Src/stm32f1xx_it.c \ + Src/system_stm32f1xx_4boot.c \ + Src/usb_host.c \ + Src/usbh_conf.c \ + Src/usbh_diskio.c \ + Src/UserInterface.cpp \ + Src/UTFT.cpp \ + Src/UTouch.cpp \ + Src/bsp_driver_sd.c + +SRC += Bootloader/flash.c \ +Bootloader/main.c \ +Bootloader/stm32f1xx_it.c \ + +SRC += Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_hcd.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sd.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sram.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_fsmc.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_sdmmc.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \ + +SRC += Fonts/glcd17x22.cpp \ +Fonts/glcd28x32.cpp \ +Icons/HomeIcons.cpp \ +Icons/KeyIcons.cpp \ +Icons/MiscIcons.cpp \ +Icons/NozzleIcons.cpp \ + +SRC += Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Src/usbh_msc.c \ +Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Src/usbh_msc_bot.c \ +Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Src/usbh_msc_scsi.c \ +Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_core.c \ +Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ctlreq.c \ +Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ioreq.c \ +Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_pipes.c \ +Middlewares/Third_Party/FatFs/src/diskio.c \ +Middlewares/Third_Party/FatFs/src/ff.c \ +Middlewares/Third_Party/FatFs/src/ff_gen_drv.c \ +Middlewares/Third_Party/FatFs/src/option/ccsbcs.c \ +Middlewares/Third_Party/FatFs/src/option/syscall.c \ +Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c \ +Middlewares/Third_Party/FreeRTOS/Source/croutine.c \ +Middlewares/Third_Party/FreeRTOS/Source/event_groups.c \ +Middlewares/Third_Party/FreeRTOS/Source/list.c \ +Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c \ +Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c \ +Middlewares/Third_Party/FreeRTOS/Source/queue.c \ +Middlewares/Third_Party/FreeRTOS/Source/tasks.c \ +Middlewares/Third_Party/FreeRTOS/Source/timers.c \ + +OBJDIR = build +OBJ = $(SRC:%.c=$(OBJDIR)/%.o) +OBJ += Startup.o + +all: $(BINARY) + +$(BINARY): $(EXECUTABLE) + $(CP) -O binary $(EXECUTABLE) $(BINARY) + +flash: $(BINARY) +# st-flash write $(BINARY) 0x08000000 + stm32flash -w $(BINARY) -v -g 0x0 /dev/ttyUSB0 + +$(EXECUTABLE): $(SRC) $(STARTUP) + $(CC) $(CFLAGS) $^ -lm -lc -lnosys -o $@ + +clean: + rm -f Startup.lst $(TARGET) $(TARGET).lst $(OBJ) $(AUTOGEN) $(TARGET).out $(TARGET).hex $(TARGET).map \ + $(TARGET).dmp $(EXECUTABLE) + +# Последнюю строчку лучше добавить в make, в секцию executable: +# $(EXECUTABLE): $(SRC) $(STARTUP) +# $(CC) $(CFLAGS) $^ -lm -lc -lnosys -o $@ +# $(CP) -O binary $(EXECUTABLE).elf $(EXECUTABLE).bin diff --git a/Src/Buzzer.cpp b/Src/Buzzer.cpp index 2fcbe46..9de4ee7 100644 --- a/Src/Buzzer.cpp +++ b/Src/Buzzer.cpp @@ -7,13 +7,13 @@ * The backlight control is included in this module because it also uses PWM. Output PWMH1 (aka PB1 peripheral A) drives the backlight pin. */ +#include "Buzzer.h" #include #include "ecv.h" #include "stm32f1xx_hal.h" #include "cmsis_os.h" -#include "Buzzer.h" TimerHandle_t xBuzzerTimer; extern TIM_HandleTypeDef htim2; diff --git a/Src/Mem.cpp b/Src/Mem.cpp index badc043..9aeddc6 100644 --- a/Src/Mem.cpp +++ b/Src/Mem.cpp @@ -5,10 +5,10 @@ * Author: David */ +#include "Mem.h" #include "ecv.h" #include "stm32f1xx_hal.h" #include "cmsis_os.h" -#include "Mem.h" //#include //void* operator new(size_t objsize, std::nothrow_t dummy) { diff --git a/Src/Misc.cpp b/Src/Misc.cpp index 2ec1ae3..3099395 100644 --- a/Src/Misc.cpp +++ b/Src/Misc.cpp @@ -8,7 +8,7 @@ #include "ecv.h" #include "Misc.h" -#include +//#include #include // Safe version of strncpy that ensures that the destination is always null-terminated on return diff --git a/Src/bsp_driver_sd.c b/Src/bsp_driver_sd.c index ad9e85d..44ff77a 100644 --- a/Src/bsp_driver_sd.c +++ b/Src/bsp_driver_sd.c @@ -36,7 +36,7 @@ #include "bsp_driver_sd.h" /* Extern variables ---------------------------------------------------------*/ - + extern SD_HandleTypeDef hsd; extern HAL_SD_CardInfoTypedef SDCardInfo; diff --git a/Src/fatfs.c b/Src/fatfs.c index 584527e..b90a6ba 100644 --- a/Src/fatfs.c +++ b/Src/fatfs.c @@ -31,8 +31,8 @@ ****************************************************************************** */ -#include "fatfs.h" #include "mks_conf.h" +#include "fatfs.h" #if defined(STM32F107xC) && defined(MKS_TFT) char SPISD_Path[4]; /* USER logical drive path */ diff --git a/Src/main.c b/Src/main.c index 96a13cd..a57903f 100644 --- a/Src/main.c +++ b/Src/main.c @@ -32,10 +32,10 @@ */ /* Includes ------------------------------------------------------------------*/ #include "stm32f1xx_hal.h" -#include "cmsis_os.h" -#include "fatfs.h" - +#include "stm32f1xx_hal_i2c.h" +#include "stm32f1xx_hal_uart.h" #include "mks_conf.h" +#include "cmsis_os.h" #if defined(STM32F107xC) && defined(MKS_TFT) # include "usb_host.h" From b7596658bc493f28b8cf7dddc249157665f409d0 Mon Sep 17 00:00:00 2001 From: NetBUG Date: Tue, 8 Aug 2017 02:55:03 -0700 Subject: [PATCH 2/3] Working & tested Make on Mac with Sierra with arm-gcc-none-eabi v6.3.1 --- Makefile | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index d1133f5..fc5ee7c 100755 --- a/Makefile +++ b/Makefile @@ -74,22 +74,7 @@ OPTIMIZE = -Os CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) -I. -I./ $(STM32_INCLUDES) -Wl,-T,STM32F107VC_FLASH.ld AFLAGS = $(MCFLAGS) -SRC = Src/Buzzer.cpp \ - Src/Display.cpp \ - Src/eeprom.c \ - Src/fatfs.c \ - Src/FileManager.cpp \ - Src/main.c \ - Src/Mem.cpp \ - Src/MessageLog.cpp \ - Src/Misc.cpp \ - Src/PanelDue.cpp \ - Src/Print.cpp \ - Src/RequestTimer.cpp \ -# Src/sd_diskio.c \ - Src/SerialIo.cpp \ - Src/spiflash_w25q16dv.c \ - Src/spisd_diskio.c \ +SRC = Src/main.c \ Src/stm32f1xx_hal_msp.c \ Src/stm32f1xx_hal_timebase_TIM.c \ Src/stm32f1xx_it.c \ @@ -97,17 +82,31 @@ SRC = Src/Buzzer.cpp \ Src/usb_host.c \ Src/usbh_conf.c \ Src/usbh_diskio.c \ + Src/fatfs.c \ + Src/spiflash_w25q16dv.c \ + Src/spisd_diskio.c \ + Src/Buzzer.cpp \ + Src/PanelDue.cpp \ + Src/Display.cpp \ + Src/FileManager.cpp \ + Src/SerialIo.cpp \ Src/UserInterface.cpp \ Src/UTFT.cpp \ Src/UTouch.cpp \ - Src/bsp_driver_sd.c + Src/eeprom.c \ + Src/Mem.cpp \ + Src/MessageLog.cpp \ + Src/Print.cpp \ + Src/Misc.cpp \ + Src/RequestTimer.cpp \ +# Src/sd_diskio.c \ +# Src/bsp_driver_sd.c -SRC += Bootloader/flash.c \ -Bootloader/main.c \ -Bootloader/stm32f1xx_it.c \ +#SRC += Bootloader/flash.c \ +#Bootloader/main.c \ +#Bootloader/stm32f1xx_it.c \ -SRC += Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ +SRC += Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \ @@ -123,12 +122,13 @@ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sd.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sram.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_fsmc.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_sdmmc.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ +#Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c \ SRC += Fonts/glcd17x22.cpp \ Fonts/glcd28x32.cpp \ @@ -173,7 +173,7 @@ flash: $(BINARY) stm32flash -w $(BINARY) -v -g 0x0 /dev/ttyUSB0 $(EXECUTABLE): $(SRC) $(STARTUP) - $(CC) $(CFLAGS) $^ -lm -lc -lnosys -o $@ + $(CC) $(CFLAGS) $^ -lm -lc -lstdc++ -lgcc -lc -lnosys -o $@ clean: rm -f Startup.lst $(TARGET) $(TARGET).lst $(OBJ) $(AUTOGEN) $(TARGET).out $(TARGET).hex $(TARGET).map \ From 71a4f79b77d22bace947c3a9a8f63e2f302e68d9 Mon Sep 17 00:00:00 2001 From: NetBUG Date: Tue, 8 Aug 2017 07:43:33 -0700 Subject: [PATCH 3/3] Linking correctly for STM21F107 --- Makefile | 79 ++++++++++++++------------------------------------------ 1 file changed, 19 insertions(+), 60 deletions(-) diff --git a/Makefile b/Makefile index fc5ee7c..90688e3 100755 --- a/Makefile +++ b/Makefile @@ -11,50 +11,11 @@ OD=arm-none-eabi-objdump BIN=$(CP) -O ihex -# Select the appropriate option for your device, the available options are listed below -# with a description copied from stm32f10x.h -# Make sure to set the startup code file to the right device family, too! -# -# STM32F10X_LD STM32F10X_LD: STM32 Low density devices -# STM32F10X_LD_VL STM32F10X_LD_VL: STM32 Low density Value Line devices -# STM32F10X_MD STM32F10X_MD: STM32 Medium density devices -# STM32F10X_MD_VL STM32F10X_MD_VL: STM32 Medium density Value Line devices -# STM32F10X_HD STM32F10X_HD: STM32 High density devices -# STM32F10X_HD_VL STM32F10X_HD_VL: STM32 High density value line devices -# STM32F10X_XL STM32F10X_XL: STM32 XL-density devices -# STM32F10X_CL STM32F10X_CL: STM32 Connectivity line devices -# -# - Low-density devices are STM32F101xx, STM32F102xx and STM32F103xx microcontrollers -# where the Flash memory density ranges between 16 and 32 Kbytes. -# -# - Low-density value line devices are STM32F100xx microcontrollers where the Flash -# memory density ranges between 16 and 32 Kbytes. -# -# - Medium-density devices are STM32F101xx, STM32F102xx and STM32F103xx microcontrollers -# where the Flash memory density ranges between 64 and 128 Kbytes. -# -# - Medium-density value line devices are STM32F100xx microcontrollers where the -# Flash memory density ranges between 64 and 128 Kbytes. -# -# - High-density devices are STM32F101xx and STM32F103xx microcontrollers where -# the Flash memory density ranges between 256 and 512 Kbytes. -# -# - High-density value line devices are STM32F100xx microcontrollers where the -# Flash memory density ranges between 256 and 512 Kbytes. -# -# - XL-density devices are STM32F101xx and STM32F103xx microcontrollers where -# the Flash memory density ranges between 512 and 1024 Kbytes. -# -# - Connectivity line devices are STM32F105xx and STM32F107xx microcontrollers. -# -# HSE_VALUE sets the value of the HSE clock, 8MHz in this case - -DEFS = -DUSE_STDPERIPH_DRIVER -DSTM32F10X_CL -DHSE_VALUE=8000000 -DSTM32F107xC -DMKS_TFT -DILI9325 -#STARTUP = ../Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/startup/gcc_ride7/startup_stm32f10x_cl.s +DEFS = -D__HEAP_SIZE=0x200 -D__STACK_SIZE=0x100 -DSTM32F107VC -DSTM32F10X_CL -DSTM32F107xC -DMKS_TFT -DILI9328 -MMD STARTUP = Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f107xc.s MCU = cortex-m3 -MCFLAGS = -mcpu=$(MCU) -mthumb -mlittle-endian -mthumb-interwork +MCFLAGS = -mcpu=$(MCU) -mthumb STM32_INCLUDES = -IDrivers/STM32F1xx_HAL_Driver/Inc/ \ -IDrivers/CMSIS/Device/ST/STM32F1xx/Include/ \ @@ -71,14 +32,13 @@ STM32_INCLUDES = -IDrivers/STM32F1xx_HAL_Driver/Inc/ \ OPTIMIZE = -Os -CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) -I. -I./ $(STM32_INCLUDES) -Wl,-T,STM32F107VC_FLASH.ld -AFLAGS = $(MCFLAGS) +CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) -fno-exceptions -funroll-loops -fdata-sections -ffunction-sections -g3 $(STM32_INCLUDES) -Wl,-T,STM32F107VC_FLASH.ld +AFLAGS = $(MCFLAGS) SRC = Src/main.c \ Src/stm32f1xx_hal_msp.c \ Src/stm32f1xx_hal_timebase_TIM.c \ Src/stm32f1xx_it.c \ - Src/system_stm32f1xx_4boot.c \ Src/usb_host.c \ Src/usbh_conf.c \ Src/usbh_diskio.c \ @@ -98,9 +58,7 @@ SRC = Src/main.c \ Src/MessageLog.cpp \ Src/Print.cpp \ Src/Misc.cpp \ - Src/RequestTimer.cpp \ -# Src/sd_diskio.c \ -# Src/bsp_driver_sd.c + Src/RequestTimer.cpp #SRC += Bootloader/flash.c \ #Bootloader/main.c \ @@ -118,24 +76,24 @@ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sd.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi_ex.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sram.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_fsmc.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_sdmmc.c \ -Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \ Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \ -#Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \ +Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \ +Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c +#Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sd.c \ +#Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_fsmc.c \ +#Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_sdmmc.c \ +#Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sram.c \ SRC += Fonts/glcd17x22.cpp \ -Fonts/glcd28x32.cpp \ Icons/HomeIcons.cpp \ Icons/KeyIcons.cpp \ Icons/MiscIcons.cpp \ -Icons/NozzleIcons.cpp \ +Icons/NozzleIcons.cpp +#Fonts/glcd28x32.cpp \ SRC += Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Src/usbh_msc.c \ Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Src/usbh_msc_bot.c \ @@ -169,15 +127,16 @@ $(BINARY): $(EXECUTABLE) $(CP) -O binary $(EXECUTABLE) $(BINARY) flash: $(BINARY) -# st-flash write $(BINARY) 0x08000000 - stm32flash -w $(BINARY) -v -g 0x0 /dev/ttyUSB0 + st-flash write $(BINARY) 0x08000000 +# stm32flash -w $(BINARY) -v -g 0x0 /dev/ttyUSB0 $(EXECUTABLE): $(SRC) $(STARTUP) - $(CC) $(CFLAGS) $^ -lm -lc -lstdc++ -lgcc -lc -lnosys -o $@ + $(CC) $(CFLAGS) $^ -lm -lstdc++ -lgcc -lc -lnosys -o $@ clean: - rm -f Startup.lst $(TARGET) $(TARGET).lst $(OBJ) $(AUTOGEN) $(TARGET).out $(TARGET).hex $(TARGET).map \ + echo rm -f Startup.lst $(TARGET) $(TARGET).lst $(AUTOGEN) $(TARGET).out $(TARGET).hex $(TARGET).map \ $(TARGET).dmp $(EXECUTABLE) +# $(OBJ) # Последнюю строчку лучше добавить в make, в секцию executable: # $(EXECUTABLE): $(SRC) $(STARTUP)