更新boot

This commit is contained in:
sunbeam 2025-03-11 17:04:18 +08:00
parent f62d27f6f5
commit a954b820a3
14 changed files with 207 additions and 114 deletions

Binary file not shown.

View File

@ -84,7 +84,7 @@
</option> </option>
<option> <option>
<name>OCDynDriverList</name> <name>OCDynDriverList</name>
<state>JLINK_ID</state> <state>CMSISDAP_ID</state>
</option> </option>
<option> <option>
<name>OCLastSavedByProductVersion</name> <name>OCLastSavedByProductVersion</name>
@ -328,7 +328,7 @@
<option> <option>
<name>CMSISDAPResetList</name> <name>CMSISDAPResetList</name>
<version>1</version> <version>1</version>
<state>10</state> <state>4</state>
</option> </option>
<option> <option>
<name>CMSISDAPHWResetDuration</name> <name>CMSISDAPHWResetDuration</name>

View File

@ -2947,6 +2947,9 @@
</group> </group>
<group> <group>
<name>RTT</name> <name>RTT</name>
<excluded>
<configuration>Debug</configuration>
</excluded>
<file> <file>
<name>$PROJ_DIR$\src\RTT\SEGGER_RTT.c</name> <name>$PROJ_DIR$\src\RTT\SEGGER_RTT.c</name>
</file> </file>

View File

@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
@echo on @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 @echo off
goto end goto end
@ -34,7 +34,7 @@ goto end
@echo on @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 @echo off
:end :end

View File

@ -23,9 +23,9 @@
if ($debugfile -eq "") 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 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"
} }

View File

@ -6,25 +6,31 @@
"-p" "-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" "--semihosting"
"--device=CVM0144" "--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"

View File

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

View File

@ -24,7 +24,7 @@
<CStepIntDis>_ 0</CStepIntDis> <CStepIntDis>_ 0</CStepIntDis>
</JLinkDriver> </JLinkDriver>
<DebugChecksum> <DebugChecksum>
<Checksum>3131505811</Checksum> <Checksum>909251498</Checksum>
</DebugChecksum> </DebugChecksum>
<Trace1> <Trace1>
<Enabled>0</Enabled> <Enabled>0</Enabled>
@ -77,11 +77,11 @@
</CallStackStripe> </CallStackStripe>
<PlDriver> <PlDriver>
<FirstRun>0</FirstRun> <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> </PlDriver>
<ArmDriver> <ArmDriver>
<EnableCache>0</EnableCache>
<EnforceMemoryConfiguration>1</EnforceMemoryConfiguration> <EnforceMemoryConfiguration>1</EnforceMemoryConfiguration>
<EnableCache>0</EnableCache>
</ArmDriver> </ArmDriver>
<TerminalIO> <TerminalIO>
<InputSource>1</InputSource> <InputSource>1</InputSource>
@ -160,6 +160,14 @@
<Probe0>I0</Probe0> <Probe0>I0</Probe0>
<ProbeSetup0>2 1 1 2 0 0</ProbeSetup0> <ProbeSetup0>2 1 1 2 0 0</ProbeSetup0>
</PowerProbe> </PowerProbe>
<Jet>
<JetConnSerialNo>CMSIS-DAP v2:000000800671FF515256656767161348A5A5A5A597969908</JetConnSerialNo>
<JetConnFoundProbes />
<DisableInterrupts>0</DisableInterrupts>
<LeaveRunning>0</LeaveRunning>
<MultiCoreRunAll>0</MultiCoreRunAll>
<CpuHaltOnBreakpointSet>0</CpuHaltOnBreakpointSet>
</Jet>
<TermIOLog> <TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled> <LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile> <LogFile>_ ""</LogFile>

File diff suppressed because one or more lines are too long

View File

@ -46,7 +46,7 @@
#define CTRL_HW_CTRL_3 (0x1) /*decimal 1*/ #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*/ #define CTRL_PWM_CTRL (0x0) /*decimal 0*/

View File

@ -20,7 +20,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "bootloader.h" #include "bootloader.h"
#include "SEGGER_RTT.h" //#include "SEGGER_RTT.h"
#include "uds_service11.h" #include "uds_service11.h"
/******************************************************************************* /*******************************************************************************
@ -418,6 +418,7 @@ static void Bootloader_PgmState(void)
*/ */
static void Bootloader_CheckState(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)) if((sBootloader_Cb.bootSubState == BOOTLOADER_SUB_STATE_NONE) || (sBootloader_Cb.bootSubState == BOOTLOADER_SUB_STATE_DOING))
{ {
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.bootActive = true;
sBootloader_Cb.bootSubState = BOOTLOADER_SUB_STATE_END; sBootloader_Cb.bootSubState = BOOTLOADER_SUB_STATE_END;
sBootloader_Cb.pgmInfo.crcResult = false; sBootloader_Cb.pgmInfo.crcResult = false;
testdata[0] = 0xA2;
TxTestMsg(testdata);
} }
else else
{ {
@ -454,6 +457,8 @@ static void Bootloader_CheckState(void)
sBootloader_Cb.bootActive = true; sBootloader_Cb.bootActive = true;
sBootloader_Cb.bootSubState = BOOTLOADER_SUB_STATE_END; sBootloader_Cb.bootSubState = BOOTLOADER_SUB_STATE_END;
sBootloader_Cb.pgmInfo.crcResult = false; sBootloader_Cb.pgmInfo.crcResult = false;
testdata[0] = 0xA3;
TxTestMsg(testdata);
} }
else 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 the current app is ok and no bootloader process action, then enter into exit state */
if(sBootloader_Cb.bootActive == false) if(sBootloader_Cb.bootActive == false)
{ {
testdata[0] = 0xAA;
TxTestMsg(testdata);
Bootloader_SetBootState(BOOTLOADER_STATE_EXIT); Bootloader_SetBootState(BOOTLOADER_STATE_EXIT);
} }
else else
@ -540,8 +547,6 @@ static void Bootloader_ExitState(void)
{ {
/* Jump to App */ /* Jump to App */
pJumpFunctionPtr jumpFunc = sBootloader_Cb.pCallBackFunctionList->jumpFunction; pJumpFunctionPtr jumpFunc = sBootloader_Cb.pCallBackFunctionList->jumpFunction;
//SEGGER_RTT_Init();
//SEGGER_RTT_printf(0,"Jump to App\n");
Bootloader_DeInit(); Bootloader_DeInit();
jumpFunc(); jumpFunc();
} }

View File

@ -33,9 +33,9 @@ extern "C" {
* the defines * the defines
******************************************************************************/ ******************************************************************************/
/* If want to Generate flash driver code in ram, enable the configuration; if not, disable the configuration */ /* 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 */ /* 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 */ /* Indication value with boot loader request from asw */
#define BOOTLOADER_CFG_REQ_ACTIVE (0x55AAAA55ul) #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) #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 */ /* 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 */ /* Erased all sector */
#define BOOTLOADER_CFG_ERASE_ALL (0xFFFFFFFF) #define BOOTLOADER_CFG_ERASE_ALL (0xFFFFFFFF)

View File

@ -28,12 +28,18 @@
#include "bootloader.h" #include "bootloader.h"
#include "fls.h" #include "fls.h"
#include "private_driver/uds/user/uds_user.h" #include "private_driver/uds/user/uds_user.h"
#include "SEGGER_RTT.h"
#include "TLE94x1.h" #include "TLE94x1.h"
/******************************************************************************* /*******************************************************************************
* the defines * the defines
******************************************************************************/ ******************************************************************************/
#define BOOT_DEBUG 0
#if (BOOT_DEBUG == 1)
#include "SEGGER_RTT.h"
#endif
#define UDS_PHYS_RECV_MSG_ID (0x732) #define UDS_PHYS_RECV_MSG_ID (0x732)
#define UDS_FUNC_RECV_MSG_ID (0x7DF) #define UDS_FUNC_RECV_MSG_ID (0x7DF)
#define UDS_PHYS_RESP_MSG_ID (0x7B2) #define UDS_PHYS_RESP_MSG_ID (0x7B2)
@ -92,14 +98,33 @@ typedef struct
uint8_t rdIdx; uint8_t rdIdx;
} FlexCan_DataInfoType; } 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 * the globals
******************************************************************************/ ******************************************************************************/
#pragma location = ".no_init" #pragma location = ".no_init"
static uint32_t sBootloader_Req; NO_INIT_DATA_Type noInitData;
#pragma location = ".no_init" //static uint32_t sBootloader_Req;
static uint32_t reboot_times; //#pragma location = ".no_init"
//static uint32_t reboot_times;
#pragma location = ".bootloaderInfo" #pragma location = ".bootloaderInfo"
__root const Bootloade_CfgInfoType sBootloader_Version = { __root const Bootloade_CfgInfoType sBootloader_Version = {
@ -441,6 +466,15 @@ void SysTick_Handler(void)
Uds_Tick(&udsObj); 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) void CAN0_ERxFIFO_Handler(void)
@ -656,14 +690,14 @@ static bool Bootloader_GetBootReq(void)
{ {
if(ResetDrv_IsResetCaused(&mcu.resetDrv, RESETDRV_SOURCE_SYS) == true) 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; ret = false;
} }
else else
{ {
/* Clear the no-init ram */ /* Clear the no-init ram */
sBootloader_Req = 0; noInitData.sBootloader_Req = 0;
} }
} }
else else
@ -694,7 +728,10 @@ static void Bootloader_JumpToApp(void)
static void (*pJumpToApp)(void); static void (*pJumpToApp)(void);
IrqDrv_DisableGlobalInterrupt(); IrqDrv_DisableGlobalInterrupt();
SysTick->CTRL = 0;
SpiDrv_DeInit(&mcu.spiDrv2);
ResetDrv_SoftwareResetModule(&mcu.resetDrv, RESETDRV_SWRESET_SPI2);
ResetDrv_SoftwareResetModule(&mcu.resetDrv, RESETDRV_SWRESET_CAN0);
/* MSP */ /* MSP */
appStack = *(uint32_t *)BOOTLOADER_CFG_APP_START_ADDR; appStack = *(uint32_t *)BOOTLOADER_CFG_APP_START_ADDR;
/* PC */ /* PC */
@ -756,31 +793,38 @@ static void ResetS3Timer(UdsType *obj)
uint8_t ExtraBootInitFlag,ExtraBootInitDelay; uint8_t ExtraBootInitFlag,ExtraBootInitDelay;
static void ExtraBootInit(void) static void ExtraBootInit(void)
{ {
uint32_t tTcr = 0; uint8_t reset_data[8];
ClockDrv_ModuleClkConfigType clockConfig; uint16_t ret;
/* Setup the Pll div2 clock */
clockConfig.gating = true;
clockConfig.source = CLOCKDRV_PLL;
clockConfig.div = 1;
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PLL_DIV2, &clockConfig);
ret = SBC_Read_Command(SBC_SUP_STAT_0);
/* Setup the SPI clock */ if ((ret&0x80) == 0x80)
clockConfig.gating = true; {
clockConfig.source = CLOCKDRV_PLL_DIV2; //POR detected
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_SPI2, &clockConfig); }
if (getAppDebugMode() != 0x55)
tTcr = SpiReg_GetTcr((const SpiRegType *)&mcu.spiDrv2.reg); {
reset_data[0] = 0xA1;
SpiDrv_SetPrescaler(&tTcr,0x03); reset_data[1] = ret&0xff;
ret = SBC_Read_Command(SBC_SUP_STAT_1);
//SEGGER_RTT_printf(0,"ret = %d\n",ret); reset_data[2] = ret&0xff;
//SEGGER_RTT_printf(0,"-----SBC_SPI_INIT-----\n"); ret = SBC_Read_Command(SBC_DEV_STAT);
reset_data[3] = ret&0xff;
SBC_SPI_INIT(); ret = SBC_Read_Command(SBC_SYS_STATUS_CTRL_0);
reset_data[4] = ret&0xff;
reset_data[5] = noInitData.reboot_times&0xff;
SBC_Init(); 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) int main(void)
{ {
@ -789,15 +833,15 @@ int main(void)
ClockDrv_ModuleClkConfigType clockConfig; ClockDrv_ModuleClkConfigType clockConfig;
uint32_t ret; uint32_t ret;
uint32_t rollingcounter,temp; uint32_t rollingcounter,temp;
uint32_t tTcr = 0;
if((reboot_times>>16) != 0x55AA) if((noInitData.reboot_times>>16) != 0x55AA)
{ {
reboot_times = 0x55AA0000; noInitData.reboot_times = 0x55AA0000;
} }
else else
{ {
reboot_times++; noInitData.reboot_times++;
} }
ExtraBootInitFlag = 0; ExtraBootInitFlag = 0;
@ -812,9 +856,10 @@ int main(void)
/* CAN init */ /* CAN init */
memset(&flexCan_DataInfo, 0, sizeof(flexCan_DataInfo)); memset(&flexCan_DataInfo, 0, sizeof(flexCan_DataInfo));
memset(&flexCanCfg, 0, sizeof(flexCanCfg)); memset(&flexCanCfg, 0, sizeof(flexCanCfg));
#if (BOOT_DEBUG == 1)
SEGGER_RTT_Init(); SEGGER_RTT_Init();
SEGGER_RTT_printf(0,"-----INTO BOOT-----\n"); SEGGER_RTT_printf(0,"-----INTO BOOT-----\n");
#endif
/* Enable the clock for all port peripheral */ /* Enable the clock for all port peripheral */
clockConfig.gating = true; clockConfig.gating = true;
clockConfig.div = 1; clockConfig.div = 1;
@ -824,7 +869,28 @@ int main(void)
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTD, &clockConfig); ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTD, &clockConfig);
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTE, &clockConfig); ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PORTE, &clockConfig);
/* Setup the Pll div2 clock */
clockConfig.gating = true;
clockConfig.source = CLOCKDRV_PLL;
clockConfig.div = 1;
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_PLL_DIV2, &clockConfig);
/* Setup the SPI clock */
clockConfig.gating = true;
clockConfig.source = CLOCKDRV_PLL_DIV2;
ClockDrv_ConfigureClock(&mcu.clockDrv, CLOCKDRV_SPI2, &clockConfig);
tTcr = SpiReg_GetTcr((const SpiRegType *)&mcu.spiDrv2.reg);
SpiDrv_SetPrescaler(&tTcr,0x03);
SBC_SPI_INIT();
SBC_Init();
SBC_WD_Trigger();
//SBC_Mode_Normal(); //SBC_Mode_Normal();
/* get CAN controller default configuration */ /* get CAN controller default configuration */
@ -856,14 +922,16 @@ int main(void)
IrqDrv_EnableIrq(SysTick_IRQn); IrqDrv_EnableIrq(SysTick_IRQn);
IrqDrv_EnableGlobalInterrupt(); IrqDrv_EnableGlobalInterrupt();
#if (BOOT_DEBUG == 1)
//SEGGER_RTT_printf(0,"gCpuClockFrequency = %d\n",gCpuClockFrequency); //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; uint32_t reset_src = mcu.resetDrv.rcmReg->RST_FLAG;
SEGGER_RTT_printf(0,"reset_src = %08x\n",reset_src); 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); Bootloader_EventEmergeBootRequest(true);
ExtraBootInitDelay = 5;
} }
while(1) while(1)
@ -874,7 +942,7 @@ int main(void)
gSystick1msCnt++; gSystick1msCnt++;
if (ExtraBootInitFlag == 0) if (ExtraBootInitFlag == 0)
{ {
if (ExtraBootInitDelay < BOOTLOADER_CFG_BOOT_DURATION_MS) if (ExtraBootInitDelay < 5)
{ {
ExtraBootInitDelay++; ExtraBootInitDelay++;
} }
@ -899,10 +967,14 @@ int main(void)
} }
if (gSystick1msCnt % 1000 == 0) if (gSystick1msCnt % 1000 == 0)
{ {
#if (BOOT_DEBUG == 1)
ret = SBC_Read_Command(SBC_WD_CTRL); ret = SBC_Read_Command(SBC_WD_CTRL);
SEGGER_RTT_printf(0,"%04d : SBC_WD_CTRL = %x\n",rollingcounter++,ret); SEGGER_RTT_printf(0,"%04d : SBC_WD_CTRL = %x\n",rollingcounter++,ret);
testdata[0] = ret; testdata[0] = ret;
//FlexCanBoot_TxMessage(UDS_TEXT_TX_MSG_ID,testdata,8); //FlexCanBoot_TxMessage(UDS_TEXT_TX_MSG_ID,testdata,8);
#endif
} }

View 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