Bootloader set default pin states (#524)

* Set default pin states needed by Bootloader

* Small Bootloader fix
This commit is contained in:
andreika-git 2017-12-24 20:45:03 +02:00 committed by rusefi
parent a7625f5e08
commit d7c46fbb21
6 changed files with 18 additions and 2 deletions

View File

@ -6,7 +6,7 @@
// This is where the bootloader starts
#define BOOTLOADER_ADDR 0x08000000
// Bootloader code max. size, in bytes
#define BOOTLOADER_SIZE 0x4000
#define BOOTLOADER_SIZE 0x8000
// Number of sectors for the bootloader
#define BOOTLOADER_NUM_SECTORS (BOOTLOADER_SIZE/0x4000)
@ -32,7 +32,7 @@
#define DFU_ACK_BYTE 0x79 // Acknowledge byte ID
#define DFU_NACK_BYTE 0x1F // Not-Acknowledge byte ID
#define DFU_SR5_TIMEOUT_FIRST MS2ST(100)
#define DFU_SR5_TIMEOUT_FIRST MS2ST(200)
#define DFU_SR5_TIMEOUT_NORMAL MS2ST(1000)
#define MCU_REVISION_MASK 0xfff // MCU Revision ID is needed by DFU protocol

View File

@ -38,6 +38,8 @@ int main(void) {
// run ChibiOS
halInit();
chSysInit();
// set base pin configuration based on the board
setDefaultBasePins(PASS_ENGINE_PARAMETER_SIGNATURE);
// set UART pads configuration based on the board
setDefaultSerialParameters(PASS_ENGINE_PARAMETER_SIGNATURE);
// set SD card configuration also

View File

@ -135,6 +135,13 @@ void boardInit(void) {
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.

View File

@ -1345,6 +1345,7 @@ extern "C" {
#endif
void boardInit(void);
void setBoardConfigurationOverrides(void);
void setPinConfigurationOverrides(void);
void setSerialConfigurationOverrides(void);
void setSdCardConfigurationOverrides(void);
#ifdef __cplusplus

View File

@ -370,6 +370,11 @@ void setDefaultBasePins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->fatalErrorPin = GPIOD_14;
engineConfiguration->warninigPin = GPIOD_13;
engineConfiguration->configResetPin = GPIOB_1;
#if EFI_PROD_CODE || defined(__DOXYGEN__)
// call overrided board-specific serial configuration setup, if needed (for custom boards only)
// needed also by bootloader code
setPinConfigurationOverrides();
#endif
}
// needed also by bootloader code

View File

@ -59,6 +59,7 @@ void setConstantDwell(floatms_t dwellMs DECLARE_ENGINE_PARAMETER_SUFFIX);
void printFloatArray(const char *prefix, float array[], int size);
// needed by bootloader
void setDefaultBasePins(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void setDefaultSerialParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void setDefaultSdCardParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE);