2025-04-26 16:03:23 +08:00

209 lines
5.2 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/** ##########################################################################
** Filename :
** Project :
** Module :
** Processor :
** Version : 1.0
** Compiler :
** Date/Time :
** Abstract :
** Contents :
** Note :
**
** (c) Copyright dmdz Co.,Ltd
** --------------------------------------------------------------------------
** R E V I S I O N H I S T O R Y
** --------------------------------------------------------------------------
** Date Ver Author Description
** -20230602- --V1.0-- --mingyea--- --修改--
** #########################################################################*/
/*---------------------------------------------------------------------------
- I N C L U D E F I L E S
----------------------------------------------------------------------------*/
#if 0
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
#include "common_types.h"
#include "common_cfg.h"
#include "mf_config.h"
#include "fm33lg0xx_fl.h"
#if defined(USE_FULL_ASSERT)
#include "fm33_assert.h"
#endif /* USE_FULL_ASSERT */
#include "nvic.h"
#include "clk.h"
#include "gpio.h"
#include "tim.h"
#include "rmu.h"
#include "svd.h"
//#include "pwm.h"
#include "wdog.h"
//#include "spm.h"
#include "can.h"
#include "ls_nm.h"
#include "nvm.h"
#include "logic_timer.h"
#ifdef CAN_AUTOSAR_EN
#include "CanTrcv.h"
#include "can_drive.h"
#include "CanIf.h"
#include "CanIf_Cfg.h"
#include "Com.h"
#include "CanTp.h"
#include "Dcm.h"
#include "Demm.h"
#include "app_com.h"
#include "app_dcm.h"
#endif
#include "user_init.h"
#include "logic_timer.h"
//#include "lin_app.h"
#include "stack_check.h"
#include "boot_app.h"
#include "bl_timer.h"
#include "bl_can.h"
#include "bl_booting.h"
#include "bl_process_driver.h"
#include "bl_system.h"
#include "bl_logical_block.h"
#include "bl_flash_if.h"
#include "bl_adpt_uds_platform.h"
u8 g_flash_read_flag2 =0xff;
/*---------------------------------------------------------------------------
- D E F I N E S / M A C R O S
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
- T Y P E D E F I N I T I O N S
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
- S T A T I C V A R I A B L E S
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
* G L O B A L V A R I A B L E S
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
- C O N S T A N T S
----------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------
- F U N C T I O N P R O T O T Y P E
----------------------------------------------------------------------------*/
int main(void)
{
u8 i;
bl_BootingFlag_t flag;
bl_BootingFlag_t flag1;
bl_BootingFlag_t flag2;
//__disable_irq();
//__enable_irq();
/*Initialize system*/
Rte_PreInit();
#if 1
#ifdef BOOT_STATE_PROG_DEBUG_EN
adpt_test_init();
#endif
#ifdef FLASH_TEST_ERASE_WRITE
flash_if_test();
#endif
//boot_app_init();
flag = Bootm_CheckBootingRequirement();
flag1 = check_program_valid_nores_is_valid();
flag2 = check_program_valid_to_app_valid();
//再判断,编程会话的无应答模式
if(flag1 == BOOTING_FLAG_REPROGRAM_VALID)
{
flag = BOOTING_FLAG_REPROGRAM_VALID;
}
else
{
//code
}
if (BOOTING_FLAG_APPLICATION_VALID == flag)
{
if(lb_logic_block_read_app_valid1()!=0)
{
#ifdef BOOT_STATE_PROG_DEBUG_EN
#else
//#ifdef FALSH_DRIVER_INIT_EN
//#else
//boot_app_jump();
Bootm_GotoApplication();
//#endif
#endif
flag=0u;
}
else
{
flag=0u;
}
/*never return unless StayInBoot enable and receive a valid SIB frame*/
}
g_flash_read_flag2 = flag;
#endif
rmu_init();
svd_init();
(void)Rte_PostInit();
lb_logic_block_init_flashdrv();
//Dm_WriteDefaultData(1); //flash app
//g_test_flash_app_flag = Dm_IsDefaultData(1);
if(flag2 == BOOTING_FLAG_REPROGRAM_VALID)
{
clear_program_valid_to_app_valid();
//回复,默认会话
Adpt_Res_default_ValidProcess();
}
#if 1
if(flag1==BOOTING_FLAG_REPROGRAM_VALID)
{
Adpt_ReprogramValid_nores_Process(); //
}
else
#endif
{
Rte_ProcessReset(flag); // 跳到這里 flag=0; 或者 BOOTING_FLAG_REPROGRAM_VALID
}
#ifdef NVM_EEPROM_EXT_EN
eeprom_init(); //要在不跳转时初始化EEPROM
#endif
for( ;; )
{
//wdog_task();
//app_task_1ms();
gpio_task();
PROC_SCHEDULE(); // 相當於 Proc_PassiveSchedule(&g_UdsPlatformAdapter)
}
}