h7 flash, guard against no CAN (#2317)

* h7 flash

* guard some other stuff

* I guess it just builds now?

* maybe ci too
This commit is contained in:
Matthew Kennedy 2021-02-08 13:24:38 -08:00 committed by GitHub
parent a349bf1ca8
commit 435f8f7e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 90 additions and 29 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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;
}

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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 */

View File

@ -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
* @{