Skip to content

Commit

Permalink
🔨 Fix HAL/STM32 F103Zx builds (MarlinFirmware#22610)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and mh-dm committed May 15, 2022
1 parent 4f9a10e commit 45e98c3
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 74 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/gcode/motion/G2_G3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void plan_arc(
* tool precision in some cases. Therefore, arc path correction is implemented.
*
* Small angle approximation may be used to reduce computation overhead further. This approximation
* holds for everything, but very small circles and large MM_PER_ARC_SEGMENT values. In other words,
* holds for everything, but very small circles and large MAX_ARC_SEGMENT_MM values. In other words,
* theta_per_segment would need to be greater than 0.1 rad and N_ARC_CORRECTION would need to be large
* to cause an appreciable drift error. N_ARC_CORRECTION~=25 is more than small enough to correct for
* numerical drift error. N_ARC_CORRECTION may be on the order a hundred(s) before error becomes an
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
#define FSMC_CS_PIN PD7 // NE4
#define FSMC_RS_PIN PD11 // A0

#define TFT_CS_PIN FSMC_CS_PIN
#define TFT_RS_PIN FSMC_RS_PIN

#define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
#define FSMC_DMA_DEV DMA2
#define FSMC_DMA_CHANNEL DMA_CH5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define HAL_I2C_MODULE_ENABLED
#define HAL_PWR_MODULE_ENABLED
#define HAL_RCC_MODULE_ENABLED
//#define HAL_RTC_MODULE_ENABLED Real Time Clock...do we use it?
//#define HAL_RTC_MODULE_ENABLED // Real Time Clock...do we use it?
#define HAL_SPI_MODULE_ENABLED
#define HAL_TIM_MODULE_ENABLED
#define HAL_USART_MODULE_ENABLED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define HAL_I2C_MODULE_ENABLED
#define HAL_PWR_MODULE_ENABLED
#define HAL_RCC_MODULE_ENABLED
//#define HAL_RTC_MODULE_ENABLED Real Time Clock...do we use it?
//#define HAL_RTC_MODULE_ENABLED // Real Time Clock...do we use it?
#define HAL_SPI_MODULE_ENABLED
#define HAL_TIM_MODULE_ENABLED
#define HAL_USART_MODULE_ENABLED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define HAL_I2C_MODULE_ENABLED
#define HAL_PWR_MODULE_ENABLED
#define HAL_RCC_MODULE_ENABLED
//#define HAL_RTC_MODULE_ENABLED Real Time Clock...do we use it?
//#define HAL_RTC_MODULE_ENABLED // Real Time Clock...do we use it?
#define HAL_SPI_MODULE_ENABLED
#define HAL_TIM_MODULE_ENABLED
#define HAL_USART_MODULE_ENABLED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define HAL_I2C_MODULE_ENABLED
#define HAL_PWR_MODULE_ENABLED
#define HAL_RCC_MODULE_ENABLED
//#define HAL_RTC_MODULE_ENABLED Real Time Clock...do we use it?
//#define HAL_RTC_MODULE_ENABLED // Real Time Clock...do we use it?
#define HAL_SPI_MODULE_ENABLED
#define HAL_TIM_MODULE_ENABLED
#define HAL_USART_MODULE_ENABLED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,31 @@ extern "C" {
*/
#include "stm32yyxx_hal_conf.h"

#ifdef HAL_PWR_MODULE_ENABLED
#undef HAL_PWR_MODULE_ENABLED // only way to disable it
#endif
#undef HAL_PWR_MODULE_ENABLED
#define HAL_PWR_MODULE_ONLY // disable low power & PA0 wakeup pin (its T°c pin)

#if defined(HAL_PWR_MODULE_ENABLED) && !defined(HAL_PWR_MODULE_ONLY)
#define HAL_PWR_MODULE_ONLY // disable low power & PA0 wakeup pin (its T°c pin)
#endif

#ifndef HAL_IWDG_MODULE_ENABLED
#define HAL_IWDG_MODULE_ENABLED // USE_WATCHDOG
#endif
#define HAL_IWDG_MODULE_ENABLED // USE_WATCHDOG

#ifdef HAL_PCD_MODULE_ENABLED
#warning No direct STM32 USB pins on Longer3D board
#warning "No direct STM32 USB pins on Longer3D board"
#undef HAL_PCD_MODULE_ENABLED // USB Device
#endif

#ifdef HAL_HCD_MODULE_ENABLED
#warning No direct STM32 USB pins on Longer3D board
#warning "No direct STM32 USB pins on Longer3D board"
#undef HAL_HCD_MODULE_ENABLED // USB Host
#endif

#ifndef HAL_USART_MODULE_ENABLED
//#define HAL_USART_MODULE_ENABLED // Useless.... UART_MODULE do it
#endif

#ifdef HAL_CAN_LEGACY_MODULE_ENABLED
#undef HAL_CAN_LEGACY_MODULE_ENABLED
#endif

#ifdef HAL_CAN_MODULE_ENABLED
#undef HAL_CAN_MODULE_ENABLED
#endif

#ifdef HAL_DAC_MODULE_ENABLED
#undef HAL_DAC_MODULE_ENABLED
#endif
#undef HAL_CAN_LEGACY_MODULE_ENABLED
#undef HAL_CAN_MODULE_ENABLED
#undef HAL_DAC_MODULE_ENABLED
#undef HAL_RTC_MODULE_ENABLED

#ifdef HAL_RTC_MODULE_ENABLED
#undef HAL_RTC_MODULE_ENABLED
#endif

#ifndef HAL_EXTI_MODULE_ENABLED
#define HAL_EXTI_MODULE_ENABLED // for ENDSTOP_INTERRUPTS_FEATURE
#endif
#define HAL_EXTI_MODULE_ENABLED // for ENDSTOP_INTERRUPTS_FEATURE

/**
* @brief List of modules in the framework (first ones enabled by default)
Expand Down Expand Up @@ -345,4 +325,3 @@ extern "C" {
#ifdef __cplusplus
}
#endif

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* SYS_WKUP */
#ifdef PWR_WAKEUP_PIN1
#if defined(PWR_WAKEUP_PIN1) && defined(HAL_PWR_MODULE_ENABLED) && !defined(HAL_PWR_MODULE_ONLY)
#error "PA0 is used by thermal sensor. Disable low power wake with -DHAL_PWR_MODULE_ONLY."
SYS_WKUP1 = PA_0,
#endif
#ifdef PWR_WAKEUP_PIN2
Expand Down
71 changes: 37 additions & 34 deletions buildroot/share/PlatformIO/variants/MARLIN_F103Zx/hal_conf_custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,43 @@ extern "C" {
/**
* @brief This is the list of modules to be used in the HAL driver
*/
//#define HAL_MODULE_ENABLED
//#define HAL_ADC_MODULE_ENABLED
//#define HAL_CAN_MODULE_ENABLED
//#define HAL_CAN_LEGACY_MODULE_ENABLED
//#define HAL_CEC_MODULE_ENABLED
//#define HAL_CORTEX_MODULE_ENABLED
//#define HAL_CRC_MODULE_ENABLED
//#define HAL_DAC_MODULE_ENABLED
//#define HAL_DMA_MODULE_ENABLED
//#define HAL_ETH_MODULE_ENABLED
//#define HAL_EXTI_MODULE_ENABLED
//#define HAL_FLASH_MODULE_ENABLED
//#define HAL_GPIO_MODULE_ENABLED
//#define HAL_HCD_MODULE_ENABLED
//#define HAL_I2C_MODULE_ENABLED
//#define HAL_I2S_MODULE_ENABLED
//#define HAL_IRDA_MODULE_ENABLED
//#define HAL_IWDG_MODULE_ENABLED
//#define HAL_NAND_MODULE_ENABLED
//#define HAL_NOR_MODULE_ENABLED
//#define HAL_PCCARD_MODULE_ENABLED
//#define HAL_PCD_MODULE_ENABLED
//#define HAL_PWR_MODULE_ENABLED
//#define HAL_RCC_MODULE_ENABLED
//#define HAL_RTC_MODULE_ENABLED
//#define HAL_SD_MODULE_ENABLED
//#define HAL_SMARTCARD_MODULE_ENABLED
//#define HAL_SPI_MODULE_ENABLED
//#define HAL_SRAM_MODULE_ENABLED
//#define HAL_TIM_MODULE_ENABLED
//#define HAL_UART_MODULE_ENABLED
//#define HAL_USART_MODULE_ENABLED
//#define HAL_WWDG_MODULE_ENABLED
//#define HAL_MMC_MODULE_ENABLED
#define HAL_MODULE_ENABLED
#define HAL_ADC_MODULE_ENABLED
#define HAL_CRC_MODULE_ENABLED
#define HAL_DMA_MODULE_ENABLED
#define HAL_EXTI_MODULE_ENABLED
#define HAL_FLASH_MODULE_ENABLED
#define HAL_GPIO_MODULE_ENABLED
#define HAL_I2C_MODULE_ENABLED
#define HAL_IWDG_MODULE_ENABLED
#define HAL_RCC_MODULE_ENABLED
#define HAL_SPI_MODULE_ENABLED
#define HAL_SRAM_MODULE_ENABLED
#define HAL_TIM_MODULE_ENABLED
#define HAL_USART_MODULE_ENABLED
#define HAL_CORTEX_MODULE_ENABLED
//#define HAL_UART_MODULE_ENABLED // by default
//#define HAL_PCD_MODULE_ENABLED // Since STM32 v3.10700.191028 this is automatically added if any type of USB is enabled (as in Arduino IDE)
#define HAL_SD_MODULE_ENABLED

#undef HAL_CAN_MODULE_ENABLED
#undef HAL_CAN_LEGACY_MODULE_ENABLED
#undef HAL_CEC_MODULE_ENABLED
#undef HAL_DAC_MODULE_ENABLED
#undef HAL_ETH_MODULE_ENABLED
#undef HAL_HCD_MODULE_ENABLED // USB Host
#undef HAL_I2S_MODULE_ENABLED
#undef HAL_IRDA_MODULE_ENABLED
#undef HAL_NAND_MODULE_ENABLED
#undef HAL_NOR_MODULE_ENABLED
#undef HAL_PCCARD_MODULE_ENABLED
#undef HAL_PWR_MODULE_ENABLED
#undef HAL_RTC_MODULE_ENABLED
#undef HAL_SMARTCARD_MODULE_ENABLED
#undef HAL_WWDG_MODULE_ENABLED
#undef HAL_MMC_MODULE_ENABLED

#define HAL_PWR_MODULE_ONLY

/* ########################## Oscillator Values adaptation ####################*/
/**
Expand Down
12 changes: 9 additions & 3 deletions ini/stm32f1.ini
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,15 @@ debug_tool = stlink
# TRIGORILLA PRO (STM32F103ZET6)
#
[env:trigorilla_pro]
platform = ${common_stm32.platform}
extends = env:mks_robin
extra_scripts = ${common_stm32.extra_scripts}
platform = ${stm32_variant.platform}
extends = stm32_variant
board = genericSTM32F103ZE
board_build.variant = MARLIN_F103Zx
board_build.offset = 0x7000
build_flags = ${stm32_variant.build_flags}
-DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC

#
# Chitu boards like Tronxy X5s (STM32F103ZET6)
Expand Down

0 comments on commit 45e98c3

Please sign in to comment.