更新boot
This commit is contained in:
parent
f62d27f6f5
commit
a954b820a3
BIN
cva_bootloader_m0146/SDK/CVA.M01.1.7.1.pack
Normal file
BIN
cva_bootloader_m0146/SDK/CVA.M01.1.7.1.pack
Normal file
Binary file not shown.
@ -84,7 +84,7 @@
|
||||
</option>
|
||||
<option>
|
||||
<name>OCDynDriverList</name>
|
||||
<state>JLINK_ID</state>
|
||||
<state>CMSISDAP_ID</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>OCLastSavedByProductVersion</name>
|
||||
@ -328,7 +328,7 @@
|
||||
<option>
|
||||
<name>CMSISDAPResetList</name>
|
||||
<version>1</version>
|
||||
<state>10</state>
|
||||
<state>4</state>
|
||||
</option>
|
||||
<option>
|
||||
<name>CMSISDAPHWResetDuration</name>
|
||||
|
@ -2947,6 +2947,9 @@
|
||||
</group>
|
||||
<group>
|
||||
<name>RTT</name>
|
||||
<excluded>
|
||||
<configuration>Debug</configuration>
|
||||
</excluded>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\src\RTT\SEGGER_RTT.c</name>
|
||||
</file>
|
||||
|
@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
|
||||
|
||||
@echo on
|
||||
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\RP-01\CODE\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.general.xcl" --backend -f "F:\FCB_project\RP-01\CODE\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.driver.xcl"
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCBproject\DMK-RP-01\RP-01\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.general.xcl" --backend -f "F:\FCBproject\DMK-RP-01\RP-01\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.driver.xcl"
|
||||
|
||||
@echo off
|
||||
goto end
|
||||
@ -34,7 +34,7 @@ goto end
|
||||
|
||||
@echo on
|
||||
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\RP-01\CODE\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.general.xcl" "--debug_file=%~1" --backend -f "F:\FCB_project\RP-01\CODE\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.driver.xcl"
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCBproject\DMK-RP-01\RP-01\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.general.xcl" "--debug_file=%~1" --backend -f "F:\FCBproject\DMK-RP-01\RP-01\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.driver.xcl"
|
||||
|
||||
@echo off
|
||||
:end
|
@ -23,9 +23,9 @@
|
||||
|
||||
if ($debugfile -eq "")
|
||||
{
|
||||
& "E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\RP-01\CODE\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.general.xcl" --backend -f "F:\FCB_project\RP-01\CODE\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.driver.xcl"
|
||||
& "D:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCBproject\DMK-RP-01\RP-01\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.general.xcl" --backend -f "F:\FCBproject\DMK-RP-01\RP-01\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.driver.xcl"
|
||||
}
|
||||
else
|
||||
{
|
||||
& "E:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCB_project\RP-01\CODE\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.general.xcl" --debug_file=$debugfile --backend -f "F:\FCB_project\RP-01\CODE\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.driver.xcl"
|
||||
& "D:\Program Files\IAR Systems\Embedded Workbench 9.2\common\bin\cspybat" -f "F:\FCBproject\DMK-RP-01\RP-01\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.general.xcl" --debug_file=$debugfile --backend -f "F:\FCBproject\DMK-RP-01\RP-01\cva_bootloader_m0146\settings\cva_bootloader_m0146.Debug.driver.xcl"
|
||||
}
|
||||
|
@ -6,25 +6,31 @@
|
||||
|
||||
"-p"
|
||||
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf"
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf"
|
||||
|
||||
"--semihosting"
|
||||
|
||||
"--device=CVM0144"
|
||||
|
||||
"--drv_communication=USB0"
|
||||
"--multicore_nr_of_cores=1"
|
||||
|
||||
"--drv_interface_speed=auto"
|
||||
"--jet_probe=cmsisdap"
|
||||
|
||||
"--jlink_initial_speed=1000"
|
||||
"--jet_standard_reset=4,0,0"
|
||||
|
||||
"--jlink_reset_strategy=0,0"
|
||||
"--reset_style=\"0,-,0,Disabled__no_reset_\""
|
||||
|
||||
"--drv_interface=SWD"
|
||||
"--reset_style=\"1,-,0,Software\""
|
||||
|
||||
"--drv_catch_exceptions=0x000"
|
||||
"--reset_style=\"2,-,0,Hardware\""
|
||||
|
||||
"--drv_swo_clock_setup=112000000,0,2000000"
|
||||
"--reset_style=\"3,-,0,Core\""
|
||||
|
||||
"--reset_style=\"4,-,1,System\""
|
||||
|
||||
"--drv_catch_exceptions=0xff0"
|
||||
|
||||
"--jet_emu_param=DebugInReset=1"
|
||||
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armPROC.dll"
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armPROC.dll"
|
||||
|
||||
"E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armJLINK.dll"
|
||||
"D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armJET.dll"
|
||||
|
||||
"F:\FCB_project\RP-01\CODE\cva_bootloader_m0146\Debug_FLASH\Exe\bootloader_m146.out"
|
||||
"F:\FCBproject\DMK-RP-01\RP-01\cva_bootloader_m0146\Debug_FLASH\Exe\bootloader_m146.out"
|
||||
|
||||
--plugin="E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armbat.dll"
|
||||
--plugin="D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\bin\armbat.dll"
|
||||
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
<CStepIntDis>_ 0</CStepIntDis>
|
||||
</JLinkDriver>
|
||||
<DebugChecksum>
|
||||
<Checksum>3131505811</Checksum>
|
||||
<Checksum>909251498</Checksum>
|
||||
</DebugChecksum>
|
||||
<Trace1>
|
||||
<Enabled>0</Enabled>
|
||||
@ -77,11 +77,11 @@
|
||||
</CallStackStripe>
|
||||
<PlDriver>
|
||||
<FirstRun>0</FirstRun>
|
||||
<MemConfigValue>E:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf</MemConfigValue>
|
||||
<MemConfigValue>D:\Program Files\IAR Systems\Embedded Workbench 9.2\arm\config\debugger\CVAChip\CVM0144.ddf</MemConfigValue>
|
||||
</PlDriver>
|
||||
<ArmDriver>
|
||||
<EnableCache>0</EnableCache>
|
||||
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
|
||||
<EnableCache>0</EnableCache>
|
||||
</ArmDriver>
|
||||
<TerminalIO>
|
||||
<InputSource>1</InputSource>
|
||||
@ -160,6 +160,14 @@
|
||||
<Probe0>I0</Probe0>
|
||||
<ProbeSetup0>2 1 1 2 0 0</ProbeSetup0>
|
||||
</PowerProbe>
|
||||
<Jet>
|
||||
<JetConnSerialNo>CMSIS-DAP v2:000000800671FF515256656767161348A5A5A5A597969908</JetConnSerialNo>
|
||||
<JetConnFoundProbes />
|
||||
<DisableInterrupts>0</DisableInterrupts>
|
||||
<LeaveRunning>0</LeaveRunning>
|
||||
<MultiCoreRunAll>0</MultiCoreRunAll>
|
||||
<CpuHaltOnBreakpointSet>0</CpuHaltOnBreakpointSet>
|
||||
</Jet>
|
||||
<TermIOLog>
|
||||
<LoggingEnabled>_ 0</LoggingEnabled>
|
||||
<LogFile>_ ""</LogFile>
|
||||
|
File diff suppressed because one or more lines are too long
@ -46,7 +46,7 @@
|
||||
|
||||
#define CTRL_HW_CTRL_3 (0x1) /*decimal 1*/
|
||||
|
||||
#define CTRL_M_S_CTRL (0x13) /*decimal 19*/
|
||||
#define CTRL_M_S_CTRL (0x11) /*decimal 17*/
|
||||
|
||||
#define CTRL_PWM_CTRL (0x0) /*decimal 0*/
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "bootloader.h"
|
||||
#include "SEGGER_RTT.h"
|
||||
//#include "SEGGER_RTT.h"
|
||||
#include "uds_service11.h"
|
||||
|
||||
/*******************************************************************************
|
||||
@ -418,6 +418,7 @@ static void Bootloader_PgmState(void)
|
||||
*/
|
||||
static void Bootloader_CheckState(void)
|
||||
{
|
||||
uint8_t testdata[8];
|
||||
if((sBootloader_Cb.bootSubState == BOOTLOADER_SUB_STATE_NONE) || (sBootloader_Cb.bootSubState == BOOTLOADER_SUB_STATE_DOING))
|
||||
{
|
||||
sBootloader_Cb.bootSubState = BOOTLOADER_SUB_STATE_DOING;
|
||||
@ -430,6 +431,8 @@ static void Bootloader_CheckState(void)
|
||||
sBootloader_Cb.bootActive = true;
|
||||
sBootloader_Cb.bootSubState = BOOTLOADER_SUB_STATE_END;
|
||||
sBootloader_Cb.pgmInfo.crcResult = false;
|
||||
testdata[0] = 0xA2;
|
||||
TxTestMsg(testdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -454,6 +457,8 @@ static void Bootloader_CheckState(void)
|
||||
sBootloader_Cb.bootActive = true;
|
||||
sBootloader_Cb.bootSubState = BOOTLOADER_SUB_STATE_END;
|
||||
sBootloader_Cb.pgmInfo.crcResult = false;
|
||||
testdata[0] = 0xA3;
|
||||
TxTestMsg(testdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -461,6 +466,8 @@ static void Bootloader_CheckState(void)
|
||||
/* If the current app is ok and no bootloader process action, then enter into exit state */
|
||||
if(sBootloader_Cb.bootActive == false)
|
||||
{
|
||||
testdata[0] = 0xAA;
|
||||
TxTestMsg(testdata);
|
||||
Bootloader_SetBootState(BOOTLOADER_STATE_EXIT);
|
||||
}
|
||||
else
|
||||
@ -540,8 +547,6 @@ static void Bootloader_ExitState(void)
|
||||
{
|
||||
/* Jump to App */
|
||||
pJumpFunctionPtr jumpFunc = sBootloader_Cb.pCallBackFunctionList->jumpFunction;
|
||||
//SEGGER_RTT_Init();
|
||||
//SEGGER_RTT_printf(0,"Jump to App\n");
|
||||
Bootloader_DeInit();
|
||||
jumpFunc();
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ extern "C" {
|
||||
* the defines
|
||||
******************************************************************************/
|
||||
/* If want to Generate flash driver code in ram, enable the configuration; if not, disable the configuration */
|
||||
#define BOOTLOADER_CFG_FLS_CODE_GENERATE_EN (0u)
|
||||
#define BOOTLOADER_CFG_FLS_CODE_GENERATE_EN (1u)
|
||||
/* Copy flash driver from flash to ram to run if don't get flash driver from out side, only just for debug the flash driver */
|
||||
#define BOOTLOADER_CFG_FLS_COPY_AUTO_EN (0u)
|
||||
#define BOOTLOADER_CFG_FLS_COPY_AUTO_EN (1u)
|
||||
|
||||
/* Indication value with boot loader request from asw */
|
||||
#define BOOTLOADER_CFG_REQ_ACTIVE (0x55AAAA55ul)
|
||||
@ -66,7 +66,7 @@ extern "C" {
|
||||
#define BOOTLOADER_CFG_FLS_DRV_RAM_CODE_SIZE (BOOTLOADER_CFG_FLS_DRV_RAM_CRC_ADDR - BOOTLOADER_CFG_FLS_DRV_RAM_START_ADDR)
|
||||
|
||||
/* The max time stay in boot before can jump to App, unit: ms */
|
||||
#define BOOTLOADER_CFG_BOOT_DURATION_MS (10u)
|
||||
#define BOOTLOADER_CFG_BOOT_DURATION_MS (20u)
|
||||
|
||||
/* Erased all sector */
|
||||
#define BOOTLOADER_CFG_ERASE_ALL (0xFFFFFFFF)
|
||||
|
@ -28,12 +28,18 @@
|
||||
#include "bootloader.h"
|
||||
#include "fls.h"
|
||||
#include "private_driver/uds/user/uds_user.h"
|
||||
#include "SEGGER_RTT.h"
|
||||
|
||||
#include "TLE94x1.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* the defines
|
||||
******************************************************************************/
|
||||
#define BOOT_DEBUG 0
|
||||
|
||||
#if (BOOT_DEBUG == 1)
|
||||
#include "SEGGER_RTT.h"
|
||||
#endif
|
||||
|
||||
#define UDS_PHYS_RECV_MSG_ID (0x732)
|
||||
#define UDS_FUNC_RECV_MSG_ID (0x7DF)
|
||||
#define UDS_PHYS_RESP_MSG_ID (0x7B2)
|
||||
@ -92,14 +98,33 @@ typedef struct
|
||||
uint8_t rdIdx;
|
||||
} FlexCan_DataInfoType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t sBootloader_Req;
|
||||
uint32_t reboot_times;
|
||||
uint32_t reverse1;
|
||||
uint32_t reverse2;
|
||||
}NO_INIT_DATA_Type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t sAswHeader;
|
||||
uint8_t appBuildTime[12];
|
||||
uint8_t appBuildDate[16];
|
||||
uint8_t appSW_VERSION[16];
|
||||
uint8_t appSW_Debug;
|
||||
uint8_t reverse[15];
|
||||
} app_CfgInfoType;//64 byte
|
||||
|
||||
/*******************************************************************************
|
||||
* the globals
|
||||
******************************************************************************/
|
||||
|
||||
#pragma location = ".no_init"
|
||||
static uint32_t sBootloader_Req;
|
||||
#pragma location = ".no_init"
|
||||
static uint32_t reboot_times;
|
||||
NO_INIT_DATA_Type noInitData;
|
||||
//static uint32_t sBootloader_Req;
|
||||
//#pragma location = ".no_init"
|
||||
//static uint32_t reboot_times;
|
||||
|
||||
#pragma location = ".bootloaderInfo"
|
||||
__root const Bootloade_CfgInfoType sBootloader_Version = {
|
||||
@ -441,6 +466,15 @@ void SysTick_Handler(void)
|
||||
Uds_Tick(&udsObj);
|
||||
}
|
||||
|
||||
uint8_t getAppDebugMode(void)
|
||||
{
|
||||
app_CfgInfoType * pAppInfo;
|
||||
pAppInfo = (app_CfgInfoType *)0x0010400;
|
||||
//memcpy(pdata, &(pAppInfo->HWVersion), sizeof(pAppInfo->HWVersion));
|
||||
//memcpy(pdata, HW_VERSION, );
|
||||
return pAppInfo->appSW_Debug;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CAN0_ERxFIFO_Handler(void)
|
||||
@ -656,14 +690,14 @@ static bool Bootloader_GetBootReq(void)
|
||||
{
|
||||
if(ResetDrv_IsResetCaused(&mcu.resetDrv, RESETDRV_SOURCE_SYS) == true)
|
||||
{
|
||||
if(sBootloader_Req != BOOTLOADER_CFG_REQ_ACTIVE)
|
||||
if(noInitData.sBootloader_Req != BOOTLOADER_CFG_REQ_ACTIVE)
|
||||
{
|
||||
ret = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Clear the no-init ram */
|
||||
sBootloader_Req = 0;
|
||||
noInitData.sBootloader_Req = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -694,7 +728,10 @@ static void Bootloader_JumpToApp(void)
|
||||
static void (*pJumpToApp)(void);
|
||||
|
||||
IrqDrv_DisableGlobalInterrupt();
|
||||
|
||||
SysTick->CTRL = 0;
|
||||
SpiDrv_DeInit(&mcu.spiDrv2);
|
||||
ResetDrv_SoftwareResetModule(&mcu.resetDrv, RESETDRV_SWRESET_SPI2);
|
||||
ResetDrv_SoftwareResetModule(&mcu.resetDrv, RESETDRV_SWRESET_CAN0);
|
||||
/* MSP */
|
||||
appStack = *(uint32_t *)BOOTLOADER_CFG_APP_START_ADDR;
|
||||
/* PC */
|
||||
@ -756,8 +793,82 @@ static void ResetS3Timer(UdsType *obj)
|
||||
uint8_t ExtraBootInitFlag,ExtraBootInitDelay;
|
||||
static void ExtraBootInit(void)
|
||||
{
|
||||
uint32_t tTcr = 0;
|
||||
uint8_t reset_data[8];
|
||||
uint16_t ret;
|
||||
|
||||
ret = SBC_Read_Command(SBC_SUP_STAT_0);
|
||||
if ((ret&0x80) == 0x80)
|
||||
{
|
||||
//POR detected
|
||||
}
|
||||
if (getAppDebugMode() != 0x55)
|
||||
{
|
||||
reset_data[0] = 0xA1;
|
||||
reset_data[1] = ret&0xff;
|
||||
ret = SBC_Read_Command(SBC_SUP_STAT_1);
|
||||
reset_data[2] = ret&0xff;
|
||||
ret = SBC_Read_Command(SBC_DEV_STAT);
|
||||
reset_data[3] = ret&0xff;
|
||||
ret = SBC_Read_Command(SBC_SYS_STATUS_CTRL_0);
|
||||
reset_data[4] = ret&0xff;
|
||||
reset_data[5] = noInitData.reboot_times&0xff;
|
||||
TxTestMsg(reset_data);
|
||||
if (reset_data[4] < 3)
|
||||
{
|
||||
reset_data[4]++;
|
||||
SBC_Write_Reg(SBC_SYS_STATUS_CTRL_0, reset_data[4], NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Bootloader_EventEmergeBootRequest(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
int main(void)
|
||||
{
|
||||
FlexCan_FrameStructureType rxMsg;
|
||||
/* Setup the clock */
|
||||
ClockDrv_ModuleClkConfigType clockConfig;
|
||||
uint32_t ret;
|
||||
uint32_t rollingcounter,temp;
|
||||
uint32_t tTcr = 0;
|
||||
|
||||
if((noInitData.reboot_times>>16) != 0x55AA)
|
||||
{
|
||||
noInitData.reboot_times = 0x55AA0000;
|
||||
}
|
||||
else
|
||||
{
|
||||
noInitData.reboot_times++;
|
||||
}
|
||||
|
||||
ExtraBootInitFlag = 0;
|
||||
ExtraBootInitDelay = 0;
|
||||
IrqDrv_DisableGlobalInterrupt();
|
||||
|
||||
/* Initialize all MCU drivers: flash drv included */
|
||||
Mcu_Init(&mcu);
|
||||
|
||||
WdgDrv_Disable(&mcu.wdgDrv);
|
||||
|
||||
/* CAN init */
|
||||
memset(&flexCan_DataInfo, 0, sizeof(flexCan_DataInfo));
|
||||
memset(&flexCanCfg, 0, sizeof(flexCanCfg));
|
||||
#if (BOOT_DEBUG == 1)
|
||||
SEGGER_RTT_Init();
|
||||
SEGGER_RTT_printf(0,"-----INTO BOOT-----\n");
|
||||
#endif
|
||||
/* Enable the clock for all port peripheral */
|
||||
clockConfig.gating = true;
|
||||
clockConfig.div = 1;
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTA, &clockConfig);
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTB, &clockConfig);
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTC, &clockConfig);
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTD, &clockConfig);
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTE, &clockConfig);
|
||||
|
||||
/* Setup the Pll div2 clock */
|
||||
clockConfig.gating = true;
|
||||
clockConfig.source = CLOCKDRV_PLL;
|
||||
@ -774,56 +885,11 @@ static void ExtraBootInit(void)
|
||||
|
||||
SpiDrv_SetPrescaler(&tTcr,0x03);
|
||||
|
||||
//SEGGER_RTT_printf(0,"ret = %d\n",ret);
|
||||
//SEGGER_RTT_printf(0,"-----SBC_SPI_INIT-----\n");
|
||||
|
||||
SBC_SPI_INIT();
|
||||
|
||||
|
||||
SBC_Init();
|
||||
}
|
||||
int main(void)
|
||||
{
|
||||
FlexCan_FrameStructureType rxMsg;
|
||||
/* Setup the clock */
|
||||
ClockDrv_ModuleClkConfigType clockConfig;
|
||||
uint32_t ret;
|
||||
uint32_t rollingcounter,temp;
|
||||
|
||||
|
||||
if((reboot_times>>16) != 0x55AA)
|
||||
{
|
||||
reboot_times = 0x55AA0000;
|
||||
}
|
||||
else
|
||||
{
|
||||
reboot_times++;
|
||||
}
|
||||
|
||||
ExtraBootInitFlag = 0;
|
||||
ExtraBootInitDelay = 0;
|
||||
IrqDrv_DisableGlobalInterrupt();
|
||||
|
||||
/* Initialize all MCU drivers: flash drv included */
|
||||
Mcu_Init(&mcu);
|
||||
|
||||
WdgDrv_Disable(&mcu.wdgDrv);
|
||||
|
||||
/* CAN init */
|
||||
memset(&flexCan_DataInfo, 0, sizeof(flexCan_DataInfo));
|
||||
memset(&flexCanCfg, 0, sizeof(flexCanCfg));
|
||||
|
||||
SEGGER_RTT_Init();
|
||||
SEGGER_RTT_printf(0,"-----INTO BOOT-----\n");
|
||||
/* Enable the clock for all port peripheral */
|
||||
clockConfig.gating = true;
|
||||
clockConfig.div = 1;
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTA, &clockConfig);
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTB, &clockConfig);
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTC, &clockConfig);
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTD, &clockConfig);
|
||||
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTE, &clockConfig);
|
||||
|
||||
SBC_WD_Trigger();
|
||||
|
||||
//SBC_Mode_Normal();
|
||||
|
||||
@ -856,14 +922,16 @@ int main(void)
|
||||
IrqDrv_EnableIrq(SysTick_IRQn);
|
||||
|
||||
IrqDrv_EnableGlobalInterrupt();
|
||||
|
||||
#if (BOOT_DEBUG == 1)
|
||||
//SEGGER_RTT_printf(0,"gCpuClockFrequency = %d\n",gCpuClockFrequency);
|
||||
SEGGER_RTT_printf(0,"reboot_times = %d\n",(reboot_times&0xff));
|
||||
SEGGER_RTT_printf(0,"reboot_times = %d\n",(noInitData.reboot_times&0xff));
|
||||
uint32_t reset_src = mcu.resetDrv.rcmReg->RST_FLAG;
|
||||
SEGGER_RTT_printf(0,"reset_src = %08x\n",reset_src);
|
||||
if ((reboot_times&0xff) > 5)
|
||||
#endif
|
||||
if ((noInitData.reboot_times&0xff) > 5)
|
||||
{
|
||||
Bootloader_EventEmergeBootRequest(true);
|
||||
ExtraBootInitDelay = 5;
|
||||
}
|
||||
|
||||
while(1)
|
||||
@ -874,7 +942,7 @@ int main(void)
|
||||
gSystick1msCnt++;
|
||||
if (ExtraBootInitFlag == 0)
|
||||
{
|
||||
if (ExtraBootInitDelay < BOOTLOADER_CFG_BOOT_DURATION_MS)
|
||||
if (ExtraBootInitDelay < 5)
|
||||
{
|
||||
ExtraBootInitDelay++;
|
||||
}
|
||||
@ -899,10 +967,14 @@ int main(void)
|
||||
}
|
||||
if (gSystick1msCnt % 1000 == 0)
|
||||
{
|
||||
|
||||
#if (BOOT_DEBUG == 1)
|
||||
ret = SBC_Read_Command(SBC_WD_CTRL);
|
||||
SEGGER_RTT_printf(0,"%04d : SBC_WD_CTRL = %x\n",rollingcounter++,ret);
|
||||
testdata[0] = ret;
|
||||
//FlexCanBoot_TxMessage(UDS_TEXT_TX_MSG_ID,testdata,8);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
3
cva_bootloader_m0146/烧录.bat
Normal file
3
cva_bootloader_m0146/烧录.bat
Normal file
@ -0,0 +1,3 @@
|
||||
::pyocd flash --erase chip --target CVM0144 -f 10m .\Debug_FLASH\Exe\cva_bootloader_m0146.hex --pack=.\SDK\CVA.M01.1.7.1.pack -u 000000800671ff515256656767161348a5a5a5a597969908
|
||||
pyocd flash --erase chip --target CVM0144 -f 10m .\Debug_FLASH\Exe\cva_bootloader_m0146.hex --pack=.\SDK\CVA.M01.1.7.1.pack -W
|
||||
pause
|
Loading…
x
Reference in New Issue
Block a user