diff --git a/.github/workflows/build-firmware.yaml b/.github/workflows/build-firmware.yaml index e649b09041..e1e2616484 100644 --- a/.github/workflows/build-firmware.yaml +++ b/.github/workflows/build-firmware.yaml @@ -12,7 +12,7 @@ jobs: matrix: # What boards should we build for? In the 'include' section below, # set up what each of these boards needs to build. - build-target: [hellen72, cypress, frankenso_na6, kinetis, mre_f4, mre_f4_recovery, mre_f4_hardware_QC_special_build, mre_f7, prometheus_405, prometheus_469, proteus_f4, proteus_f4_hardware_QC_special_build, proteus_f7, stm32f767_nucleo] + build-target: [hellen72, cypress, frankenso_na6, kinetis, mre_f4, mre_f4_recovery, mre_f4_hardware_QC_special_build, mre_f7, prometheus_405, prometheus_469, proteus_f4, proteus_f4_hardware_QC_special_build, proteus_f7, stm32f767_nucleo, stm32h743_nucleo] include: # Board configurations @@ -76,6 +76,11 @@ jobs: console-settings: firmware/config/boards/nucleo_f767/rusefi_console_properties.xml skip-config: yes + - build-target: stm32h743_nucleo + folder: nucleo_h743 + ini-file: no + skip-config: yes + steps: - uses: actions/checkout@v1 with: diff --git a/firmware/config/boards/nucleo_h743/board.mk b/firmware/config/boards/nucleo_h743/board.mk index f48daae7a2..41132d63fe 100644 --- a/firmware/config/boards/nucleo_h743/board.mk +++ b/firmware/config/boards/nucleo_h743/board.mk @@ -4,8 +4,6 @@ BOARDINC = $(PROJECT_DIR)/config/stm32h7ems CONFDIR = config/stm32h7ems -LDSCRIPT = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/ld/STM32H743xI.ld - # Shared variables -ALLCPPSRC += $(BOARDCPPSRC) +ALLCPPSRC += $(PROJECT_DIR)/config/boards/nucleo_h743/board_configuration.cpp ALLINC += $(BOARDINC) diff --git a/firmware/config/boards/nucleo_h743/board_configuration.cpp b/firmware/config/boards/nucleo_h743/board_configuration.cpp new file mode 100644 index 0000000000..297c4c24a7 --- /dev/null +++ b/firmware/config/boards/nucleo_h743/board_configuration.cpp @@ -0,0 +1,45 @@ +#include "adc_inputs.h" + +/** + * @brief Board-specific configuration code overrides. + * @todo Add your board-specific code, if any. + */ +void setBoardConfigurationOverrides(void) { +} + +/** + * @brief Board-specific pin configuration code overrides. Needed by bootloader code. + * @todo Add your board-specific code, if any. + */ +void setPinConfigurationOverrides(void) { +} + +/** + * @brief Board-specific Serial configuration code overrides. Needed by bootloader code. + * @todo Add your board-specific code, if any. + */ +void setSerialConfigurationOverrides(void) { +} + +/** + * @brief Board-specific SD card configuration code overrides. Needed by bootloader code. + * @todo Add your board-specific code, if any. + */ +void setSdCardConfigurationOverrides(void) { +} + +/** + * @brief Board-specific ADC channel configuration code overrides. + * @todo Add your board-specific code, if any. + */ +void setAdcChannelOverrides(void) { +} + +// TODO: fix analog inputs so we don't need these stubs +float getVoltage(const char*, adc_channel_e) { + return 0; +} + +float getVoltageDivided(const char*, adc_channel_e) { + return 0; +} diff --git a/firmware/config/boards/nucleo_h743/compile_stm32h743_nucleo.sh b/firmware/config/boards/nucleo_h743/compile_stm32h743_nucleo.sh index fc7934a2e1..6c15c6496e 100644 --- a/firmware/config/boards/nucleo_h743/compile_stm32h743_nucleo.sh +++ b/firmware/config/boards/nucleo_h743/compile_stm32h743_nucleo.sh @@ -9,14 +9,12 @@ export PROJECT_BOARD=nucleo_h743 export PROJECT_CPU=ARCH_STM32H7 export USE_LIS302=no export USE_FATFS=no -export EXTRA_PARAMS="-DDUMMY -DSTM32H743xx \ +export EXTRA_PARAMS="-DDUMMY \ -DEFI_INJECTOR_PIN3=GPIO_UNASSIGNED \ -DFIRMWARE_ID=\\\"nucleoH743\\\" \ -DEFI_COMMUNICATION_PIN=GPIOB_7 \ -DSTATUS_LOGGING_BUFFER_SIZE=1400 \ - -DLED_CRITICAL_ERROR_BRAIN_PIN=GPIOB_14 \ - -DEFI_ENABLE_ASSERTS=FALSE \ - -DCH_DBG_ENABLE_CHECKS=FALSE -DCH_DBG_ENABLE_ASSERTS=FALSE -DCH_DBG_ENABLE_STACK_CHECK=FALSE -DCH_DBG_FILL_THREADS=FALSE -DCH_DBG_THREADS_PROFILING=FALSE" + -DLED_CRITICAL_ERROR_BRAIN_PIN=GPIOB_14" export DEBUG_LEVEL_OPT="-O2" bash ../common_make.sh diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp index 01a899a47e..a0ce30604a 100644 --- a/firmware/controllers/bench_test.cpp +++ b/firmware/controllers/bench_test.cpp @@ -257,7 +257,7 @@ private: } if (widebandUpdatePending) { -#if EFI_WIDEBAND_FIRMWARE_UPDATE +#if EFI_WIDEBAND_FIRMWARE_UPDATE && HAL_USE_CAN updateWidebandFirmware(logger); #endif widebandUpdatePending = false; diff --git a/firmware/controllers/can/wideband_bootloader.cpp b/firmware/controllers/can/wideband_bootloader.cpp index f4aa4f8727..117a2d7c73 100644 --- a/firmware/controllers/can/wideband_bootloader.cpp +++ b/firmware/controllers/can/wideband_bootloader.cpp @@ -1,6 +1,6 @@ #include "global.h" -#if EFI_WIDEBAND_FIRMWARE_UPDATE +#if EFI_WIDEBAND_FIRMWARE_UPDATE && HAL_USE_CAN #include "ch.h" #include "can_msg_tx.h" @@ -95,4 +95,4 @@ void updateWidebandFirmware(Logging* logging) { waitingBootloaderThread = nullptr; } -#endif // EFI_WIDEBAND_FIRMWARE_UPDATE +#endif // EFI_WIDEBAND_FIRMWARE_UPDATE && HAL_USE_CAN diff --git a/firmware/hw_layer/ports/stm32/stm32h7/stm32h7xx_hal_flash.c b/firmware/hw_layer/ports/stm32/stm32h7/stm32h7xx_hal_flash.c index 5b8cce4c5d..8789c2d2cd 100644 --- a/firmware/hw_layer/ports/stm32/stm32h7/stm32h7xx_hal_flash.c +++ b/firmware/hw_layer/ports/stm32/stm32h7/stm32h7xx_hal_flash.c @@ -87,6 +87,10 @@ /* Includes ------------------------------------------------------------------*/ //#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_flash_ex.h" +#include "stm32h7xx_hal_flash.h" + +#define assert_param(expr) ((void)0) /** @addtogroup STM32H7xx_HAL_Driver * @{ @@ -729,7 +733,7 @@ void HAL_FLASH_IRQHandler(void) __weak void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue) { /* Prevent unused argument(s) compilation warning */ - UNUSED(ReturnValue); + (void)ReturnValue; /* NOTE : This function Should not be modified, when the callback is needed, the HAL_FLASH_EndOfOperationCallback could be implemented in the user file @@ -747,7 +751,7 @@ __weak void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue) __weak void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue) { /* Prevent unused argument(s) compilation warning */ - UNUSED(ReturnValue); + (void)ReturnValue; /* NOTE : This function Should not be modified, when the callback is needed, the HAL_FLASH_OperationErrorCallback could be implemented in the user file @@ -988,13 +992,15 @@ uint32_t HAL_FLASH_GetError(void) */ HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout, uint32_t Bank) { + (void)Timeout; + /* Wait for the FLASH operation to complete by polling on QW flag to be reset. Even if the FLASH operation fails, the QW flag will be reset and an error flag will be set */ uint32_t bsyflag = FLASH_FLAG_QW_BANK1; uint32_t errorflag = FLASH->SR1 & FLASH_FLAG_ALL_ERRORS_BANK1; - uint32_t tickstart = HAL_GetTick(); + //uint32_t tickstart = HAL_GetTick(); assert_param(IS_FLASH_BANK_EXCLUSIVE(Bank)); @@ -1013,10 +1019,11 @@ HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout, uint32_t Bank) { if(Timeout != HAL_MAX_DELAY) { - if(((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U)) - { - return HAL_TIMEOUT; - } + // todo: implement rusEfi own timeout + // if(((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U)) + // { + // return HAL_TIMEOUT; + // } } } @@ -1062,19 +1069,21 @@ HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout, uint32_t Bank) */ HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout) { + (void)Timeout; /* Get timeout */ - uint32_t tickstart = HAL_GetTick(); + //uint32_t tickstart = HAL_GetTick(); /* Wait for the FLASH Option Bytes change operation to complete by polling on OPT_BUSY flag to be reset */ while(READ_BIT(FLASH->OPTSR_CUR, FLASH_OPTSR_OPT_BUSY) != 0U) { - if(Timeout != HAL_MAX_DELAY) + // TODO: rusefi own timeout + /*if(Timeout != HAL_MAX_DELAY) { if(((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U)) { return HAL_TIMEOUT; } - } + }*/ } /* Check option byte change error */ @@ -1102,7 +1111,8 @@ HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout) HAL_StatusTypeDef FLASH_CRC_WaitForLastOperation(uint32_t Timeout, uint32_t Bank) { uint32_t bsyflag; - uint32_t tickstart = HAL_GetTick(); + (void)Timeout; + //uint32_t tickstart = HAL_GetTick(); assert_param(IS_FLASH_BANK_EXCLUSIVE(Bank)); @@ -1119,13 +1129,14 @@ HAL_StatusTypeDef FLASH_CRC_WaitForLastOperation(uint32_t Timeout, uint32_t Bank /* Wait for the FLASH CRC computation to complete by polling on CRC_BUSY flag to be reset */ while(__HAL_FLASH_GET_FLAG(bsyflag)) { - if(Timeout != HAL_MAX_DELAY) - { - if(((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U)) - { - return HAL_TIMEOUT; - } - } + // TODO: rusefi own timeout + // if(Timeout != HAL_MAX_DELAY) + // { + // if(((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U)) + // { + // return HAL_TIMEOUT; + // } + // } } /* Check FLASH CRC read error flag */ diff --git a/firmware/hw_layer/ports/stm32/stm32h7/stm32h7xx_hal_flash_ex.c b/firmware/hw_layer/ports/stm32/stm32h7/stm32h7xx_hal_flash_ex.c index fe10bd5482..c8a9549567 100644 --- a/firmware/hw_layer/ports/stm32/stm32h7/stm32h7xx_hal_flash_ex.c +++ b/firmware/hw_layer/ports/stm32/stm32h7/stm32h7xx_hal_flash_ex.c @@ -75,6 +75,10 @@ /* Includes ------------------------------------------------------------------*/ //#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_flash_ex.h" +#include "stm32h7xx_hal_flash.h" + +#define assert_param(expr) ((void)0) /** @addtogroup STM32H7xx_HAL_Driver * @{