diff --git a/demos/ARMCM3-STM32F103-GCC/Makefile b/demos/ARMCM3-STM32F103-GCC/Makefile index a669ad3d5..c476d8cda 100644 --- a/demos/ARMCM3-STM32F103-GCC/Makefile +++ b/demos/ARMCM3-STM32F103-GCC/Makefile @@ -31,6 +31,10 @@ MCU = cortex-m3 # Enable this if you want the linker to remove unused code and data LINK_GC = yes +# Enable this if you really want to use the STM FWLib. ChibiOS/RT does not +# require it and does not support the library except for this Makefile option. +USE_FWLIB = no + # List all default C defines here, like -D_DEBUG=1 DDEFS = @@ -69,6 +73,9 @@ UADEFS = # Imported source files include ../../src/kernel.mk include ../../test/test.mk +ifeq ($(USE_FWLIB),yes) +include ./stm32lib/stm32lib.mk +endif # List ARM-mode C source files here SRC = ../../ports/ARMCM3/chcore.c ../../ports/ARMCM3/nvic.c \ @@ -78,6 +85,10 @@ SRC = ../../ports/ARMCM3/chcore.c ../../ports/ARMCM3/nvic.c \ ../../src/lib/evtimer.c \ board.c main.c +ifeq ($(USE_FWLIB),yes) +SRC += ${STM32SRC} +endif + # List ASM source files here ASMSRC = ../../ports/ARMCM3/crt0.s ../../ports/ARMCM3-STM32F103/vectors.s @@ -97,10 +108,18 @@ ULIBS = # chconf.h. # NOTE: -falign-functions=16 may improve the performance, not always, but # increases the code size. +# NOTE: Add -fno-strict-aliasing if you are tired to see all the warnings +# generated by the STM FWLib, this option increases code size too. OPT = -O2 -ggdb -fomit-frame-pointer -mabi=apcs-gnu #OPT += -ffixed-r7 OPT += -falign-functions=16 +ifeq ($(USE_FWLIB),yes) +# The thing generates a lot of aliasing warnings, this disables an optimization +# and the warning disappears, the code is a bit larger however. +OPT += -fno-strict-aliasing +endif + # Define warning options here WARN = -Wall -Wstrict-prototypes diff --git a/demos/ARMCM3-STM32F103-GCC/stm32lib/inc/stm32f10x_conf.h b/demos/ARMCM3-STM32F103-GCC/stm32lib/inc/stm32f10x_conf.h index dcffed158..3bfc763f4 100644 --- a/demos/ARMCM3-STM32F103-GCC/stm32lib/inc/stm32f10x_conf.h +++ b/demos/ARMCM3-STM32F103-GCC/stm32lib/inc/stm32f10x_conf.h @@ -29,28 +29,28 @@ /* Comment the line below to disable the specific peripheral inclusion */ /************************************* ADC ************************************/ -//#define _ADC -//#define _ADC1 +#define _ADC +#define _ADC1 //#define _ADC2 //#define _ADC3 /************************************* BKP ************************************/ -//#define _BKP +#define _BKP /************************************* CAN ************************************/ -//#define _CAN +#define _CAN /************************************* CRC ************************************/ -//#define _CRC +#define _CRC /************************************* DAC ************************************/ -//#define _DAC +#define _DAC /************************************* DBGMCU *********************************/ -//#define _DBGMCU +#define _DBGMCU /************************************* DMA ************************************/ -//#define _DMA +#define _DMA //#define _DMA1_Channel1 //#define _DMA1_Channel2 //#define _DMA1_Channel3 @@ -65,7 +65,7 @@ //#define _DMA2_Channel5 /************************************* EXTI ***********************************/ -//#define _EXTI +#define _EXTI /************************************* FLASH and Option Bytes *****************/ #define _FLASH @@ -75,7 +75,7 @@ /* #define _FLASH_PROG */ /************************************* FSMC ***********************************/ -//#define _FSMC +#define _FSMC /************************************* GPIO ***********************************/ #define _GPIO @@ -86,7 +86,7 @@ //#define _GPIOE //#define _GPIOF //#define _GPIOG -//#define _AFIO +#define _AFIO /************************************* I2C ************************************/ //#define _I2C @@ -94,22 +94,22 @@ //#define _I2C2 /************************************* IWDG ***********************************/ -//#define _IWDG +#define _IWDG /************************************* NVIC ***********************************/ -//#define _NVIC +#define _NVIC /************************************* PWR ************************************/ -//#define _PWR +#define _PWR /************************************* RCC ************************************/ #define _RCC /************************************* RTC ************************************/ -//#define _RTC +#define _RTC /************************************* SDIO ***********************************/ -//#define _SDIO +#define _SDIO /************************************* SPI ************************************/ //#define _SPI @@ -118,7 +118,7 @@ //#define _SPI3 /************************************* SysTick ********************************/ -//#define _SysTick +#define _SysTick /************************************* TIM ************************************/ //#define _TIM @@ -140,7 +140,7 @@ //#define _UART5 /************************************* WWDG ***********************************/ -//#define _WWDG +#define _WWDG /* In the following line adjust the value of External High Speed oscillator (HSE) used in your application */ diff --git a/demos/ARMCM3-STM32F103-GCC/stm32lib/stm32lib.mk b/demos/ARMCM3-STM32F103-GCC/stm32lib/stm32lib.mk new file mode 100644 index 000000000..ed7ec62fb --- /dev/null +++ b/demos/ARMCM3-STM32F103-GCC/stm32lib/stm32lib.mk @@ -0,0 +1,25 @@ +# STM32 FWLib files. +STM32SRC = stm32lib/src/stm32f10x_adc.c \ + stm32lib/src/stm32f10x_bkp.c \ + stm32lib/src/stm32f10x_can.c \ + stm32lib/src/stm32f10x_crc.c \ + stm32lib/src/stm32f10x_dac.c \ + stm32lib/src/stm32f10x_dbgmcu.c \ + stm32lib/src/stm32f10x_dma.c \ + stm32lib/src/stm32f10x_exti.c \ + stm32lib/src/stm32f10x_flash.c \ + stm32lib/src/stm32f10x_fsmc.c \ + stm32lib/src/stm32f10x_gpio.c \ + stm32lib/src/stm32f10x_i2c.c \ + stm32lib/src/stm32f10x_iwdg.c \ + stm32lib/src/stm32f10x_lib.c \ + stm32lib/src/stm32f10x_nvic.c \ + stm32lib/src/stm32f10x_pwr.c \ + stm32lib/src/stm32f10x_rcc.c \ + stm32lib/src/stm32f10x_rtc.c \ + stm32lib/src/stm32f10x_sdio.c \ + stm32lib/src/stm32f10x_spi.c \ + stm32lib/src/stm32f10x_systick.c \ + stm32lib/src/stm32f10x_tim.c \ + stm32lib/src/stm32f10x_usart.c \ + stm32lib/src/stm32f10x_wwdg.c