stm32duino / Arduino_Core_STM32

STM32 core support for Arduino
https://github.com/stm32duino/Arduino_Core_STM32/wiki
Other
2.81k stars 967 forks source link

Compile error with V1.8.0, -DHAL_TIM_MODULE_ONLY in build_opt.h #839

Closed geosmall closed 4 years ago

geosmall commented 4 years ago

Compile error under recently released Version: 1.8.0

Describe the bug Build error when compiling sketch with "HAL_TIM_MODULE_ONLY" defined in build_opt.h

To Reproduce Compile the following minimal example sketch:

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

with the following build_opt.h:

-DHAL_TIM_MODULE_ONLY

Expected behavior Expect to compile without error.

Error when compiling:

Compiling sketch...
"C:\Users\geoma\AppData\Local\Arduino15\packages\STM32\tools\xpack-arm-none-eabi-gcc\9.2.1-1.1/bin/arm-none-eabi-g++" -mcpu=cortex-m3  -mthumb "@C:\Users\geoma\AppData\Local\Temp\arduino_build_285411/sketch/build_opt.h" -c -Os -w -std=gnu++14 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -MMD "-IC:\Users\geoma\OneDrive\Arduino\Blink" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino/avr" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino/stm32" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino/stm32/LL" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino/stm32/usb" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino/stm32/usb/hid" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino/stm32/usb/cdc" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\system/Drivers/STM32F1xx_HAL_Driver/Inc" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\system/Drivers/STM32F1xx_HAL_Driver/Src" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\system/STM32F1xx" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\system/Middlewares/ST/STM32_USB_Device_Library/Core/Inc" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\system/Middlewares/ST/STM32_USB_Device_Library/Core/Src" -DSTM32F1xx -DARDUINO=10805 -DARDUINO_BLUEPILL_F103C8 -DARDUINO_ARCH_STM32 -DBOARD_NAME="BLUEPILL_F103C8"  -DSTM32F103xB  -DHAL_UART_MODULE_ENABLED  "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\tools\CMSIS\5.5.1/CMSIS/Core/Include/" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\system/Drivers/CMSIS/Device/ST/STM32F1xx/Include/" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\system/Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\tools\CMSIS\5.5.1/CMSIS/DSP/Include" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\variants\PILL_F103XX" "-IC:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\libraries\SrcWrapper\src" "C:\Users\geoma\AppData\Local\Temp\arduino_build_285411\sketch\Blink.ino.cpp" -o "C:\Users\geoma\AppData\Local\Temp\arduino_build_285411\sketch\Blink.ino.cpp.o"
In file included from C:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino/board.h:8,
                 from C:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino/wiring.h:41,
                 from C:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino/Arduino.h:32,
                 from C:\Users\geoma\AppData\Local\Temp\arduino_build_285411\sketch\Blink.ino.cpp:1:
C:\Users\geoma\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.8.0\cores\arduino/stm32/analog.h:55:66: error: 'TimerCompareFormat_t' has not been declared
   55 | void pwm_start(PinName pin, uint32_t clock_freq, uint32_t value, TimerCompareFormat_t resolution);
      |   

Screenshots See below attached screencap of error.

Desktop (please complete the following information):

Board (please complete the following information): Seems to be any variant, tested with Bluepill F103 and Wraith32

Capture

fpistm commented 4 years ago

Hi @geosmall Right, since TimerCompareFormat_t was introduced as a parameter of pwm_start() there is an issue. Same if HAL_TIM_MODULE_ENABLED is not enabled.