Обновление
This commit is contained in:
parent
21cf6338b5
commit
ab35a1932e
|
|
@ -8,5 +8,6 @@
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
|
|
||||||
void BootJumpToAddress(const uint32_t address);
|
void BootJumpToAddress(const uint32_t address);
|
||||||
|
void Reset();
|
||||||
|
|
||||||
#endif //HVAC_ON_CHIP_BOOTLOADER_JUMP_H
|
#endif //HVAC_ON_CHIP_BOOTLOADER_JUMP_H
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
#include "fc7xxx_driver_fcuart.h"
|
#include "fc7xxx_driver_fcuart.h"
|
||||||
#include "fc7240_fcuart_regs.h"
|
#include "fc7240_fcuart_regs.h"
|
||||||
#include "fc7xxx_driver_pcc.h"
|
#include "fc7xxx_driver_pcc.h"
|
||||||
|
#include "fc7xxx_driver_adc.h"
|
||||||
|
#include "fc7xxx_driver_flexcan.h"
|
||||||
|
#include "fc7xxx_driver_tpu.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef void (*pFunction)(void);
|
typedef void (*pFunction)(void);
|
||||||
|
|
@ -81,3 +85,67 @@ void BootJumpToAddress(const uint32_t address) {
|
||||||
|
|
||||||
while (1);
|
while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Reset() {
|
||||||
|
// 1. ГЛОБАЛЬНО отключаем прерывания (первое, что делаем)
|
||||||
|
__disable_irq();
|
||||||
|
|
||||||
|
// 2. Отключаем ВСЕ прерывания в NVIC
|
||||||
|
for (int i = 0; i < 8; i++) { // Обычно достаточно 8 банков для всех прерываний
|
||||||
|
NVIC->ICER[i] = 0xFFFFFFFF;
|
||||||
|
NVIC->ICPR[i] = 0xFFFFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Останавливаем SysTick и сбрасываем
|
||||||
|
SysTick->CTRL = 0;
|
||||||
|
SysTick->LOAD = 0;
|
||||||
|
SysTick->VAL = 0;
|
||||||
|
|
||||||
|
// 4. Сбрасываем все pending-флаги
|
||||||
|
SCB->ICSR |= SCB_ICSR_PENDSVCLR_Msk | SCB_ICSR_PENDSTCLR_Msk;
|
||||||
|
|
||||||
|
// 5. Отключаем периферию, которая может генерировать прерывания
|
||||||
|
|
||||||
|
// 5.1. DMA
|
||||||
|
DMA_DeInit(DMA_INSTANCE_0);
|
||||||
|
|
||||||
|
// 5.2. UART
|
||||||
|
for (uint8_t i = 0; i < FCUART_INSTANCE_COUNT; ++i) {
|
||||||
|
FCUART_DeInit(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5.3. CAN
|
||||||
|
for (uint8_t i = 0; i < FLEXCAN_INSTANCE_COUNT; ++i) {
|
||||||
|
FLEXCAN_DeInit(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5.4. ADC
|
||||||
|
for (uint8_t i = 0; i < ADC_INSTANCE_COUNT; ++i) {
|
||||||
|
ADC_DeInit(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5.5. TPU
|
||||||
|
TPU_DeInit();
|
||||||
|
|
||||||
|
|
||||||
|
// 5.3 RESET CLK
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_DMA0);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_DMAMUX0);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FLEXCAN0);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FLEXCAN1);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FLEXCAN2);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FLEXCAN3);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_ADC0);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_ADC1);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FCUART0);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FCUART1);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FCUART2);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FCUART3);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FCUART4);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FCUART5);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FCUART6);
|
||||||
|
PCC_GenPeripheralReset(PCC_CLK_FCUART7);
|
||||||
|
|
||||||
|
NVIC_SystemReset();
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue