Explorar el Código

add code optimization control to the Makefile

Dmitry hace 7 años
padre
commit
d6c9e42bce
Se han modificado 2 ficheros con 3 adiciones y 1 borrados
  1. 2 1
      Makefile
  2. 1 0
      readme.md

+ 2 - 1
Makefile

@@ -9,6 +9,7 @@ AR           = $(TOOLSET)gcc-ar
 OBJCOPY      = $(TOOLSET)objcopy
 DFU_UTIL	?= dfu-util
 STPROG_CLI  ?= ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI
+OPTFLAGS    ?= -Os
 
 ifeq ($(OS),Windows_NT)
 	RM = del /Q
@@ -25,7 +26,7 @@ DEFINES     ?= STM32F1 STM32F103x6
 ARFLAGS      = -cvq
 LDFLAGS      = --specs=nano.specs -nostartfiles -Wl,--gc-sections
 INCLUDES     = $(CMSISDEV)/ST $(CMSISCORE) inc
-CFLAGS2      = -mthumb -Os -std=gnu99 -fshort-wchar
+CFLAGS2      = -mthumb -std=gnu99 -fshort-wchar $(OPTFLAGS)
 
 OBJDIR       = obj
 SOURCES      = $(wildcard src/*.c) $(wildcard src/*.S)

+ 1 - 0
readme.md

@@ -119,6 +119,7 @@ make help
 | CFLAGS   | -mcpu=cortex-m3 -mfloat-abi=soft    | MCU specified compiler flags  |
 | DEFINES  | STM32L1 STM32L100xC                 | MCU specified defines         |
 | STPROG_CLI | ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI | Path to the ST Cube Programmer CLI |
+| OPTFLAFS | -Os | Code optimization flags |
 
 ### Useful Resources ###
 1. [USB Implementers Forum official site](https://www.usb.org/)