mirror of
https://github.com/mitxela/clock4.git
synced 2025-12-05 23:20:26 -08:00
bootloader user request on PA2/hinge TX
This commit is contained in:
@@ -66,6 +66,7 @@ extern "C" {
|
|||||||
#define bSegDecode7 0b0000011100
|
#define bSegDecode7 0b0000011100
|
||||||
#define bSegDecode8 0b0111111100
|
#define bSegDecode8 0b0111111100
|
||||||
#define bSegDecode9 0b0110111100
|
#define bSegDecode9 0b0110111100
|
||||||
|
#define bSegDecodeU 0b0011111000
|
||||||
|
|
||||||
#define bCat0 0b1111000000000000
|
#define bCat0 0b1111000000000000
|
||||||
#define bCat1 0b1110001000000000
|
#define bCat1 0b1110001000000000
|
||||||
@@ -94,6 +95,9 @@ extern "C" {
|
|||||||
|
|
||||||
#define ERR_UNKNOWN bSegDecode9
|
#define ERR_UNKNOWN bSegDecode9
|
||||||
|
|
||||||
|
// User request bootloader hang for backup USB stack
|
||||||
|
#define ERR_USER bSegDecodeU
|
||||||
|
|
||||||
/* USER CODE END EC */
|
/* USER CODE END EC */
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
|||||||
@@ -402,6 +402,11 @@ int main(void)
|
|||||||
// debug force reload
|
// debug force reload
|
||||||
// new_fw_crc=0;
|
// new_fw_crc=0;
|
||||||
|
|
||||||
|
// Hinge TX connection shorted to ground - force bootloader to hang
|
||||||
|
if ((GPIOA->IDR & (1<<2))==0) {
|
||||||
|
hang_error(ERR_USER);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (loaded_fw_crc == byteswap32(*(uint32_t*)(FLASH_BASE + BOOT_SIZE + APP_SIZE -4)) ) { // loaded firmware valid
|
if (loaded_fw_crc == byteswap32(*(uint32_t*)(FLASH_BASE + BOOT_SIZE + APP_SIZE -4)) ) { // loaded firmware valid
|
||||||
|
|
||||||
@@ -717,6 +722,15 @@ static void MX_GPIO_Init(void)
|
|||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**USART2 GPIO Configuration
|
||||||
|
PA2 ------> USART2_TX
|
||||||
|
PA3 ------> USART2_RX
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13|GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2
|
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13|GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2
|
||||||
|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6
|
|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6
|
||||||
|
|||||||
Reference in New Issue
Block a user