TC27x启动过程(3)-TC277

接上文,继续分析TC277多核启动过程

目录

main函数分析

Os_InitMemory->Step1

Os_Init->Os_Api_Init:执行step2

BswInit_InitializeOne

BswInit_InitializeTwo


main函数分析

该main函数在Bswinit.c中

main函数包含内容如下:

void BswInit_PreInitPowerOn(void)

{

Os_InitMemory();

Os_Init();

}

Os_InitMemory->Step1

Os_InitMemory最终调用Os_Api_InitMemory

实际里面没有内容,这个是静态代码,不会变的

Os_Init->Os_Api_Init:执行step2

core = Os_CoreGetCurrentCore();//获取当前coreid,根据ID得到核信息,是否为autosar核,是否为自启动核,都在core信息中。

Os_CoreGetCurrentCore->Os_Hal_CoreGetId->Os_Hal_Mfcr(OS_HAL_CORE_ID_REGISTER)

Os_Hal_Mfcr即 _mfcr

# define OS_HAL_CORE_ID_REGISTER 0xFE1CUL(和CSFR中的coreid一致)

systemCfg = Os_SystemGet();//获取OS配置信息,version,核心数,中断信息等

/* #10 If called on the hardware initialization core. */判断是否是硬件初始化核,TC277定义核0为硬件初始化核

if(core->IsHardwareInitCore == TRUE)

{

/* #20 Perform hardware specific initialization on the Hardware Initialization Core. */初始化特殊硬件



/* #30 Initialize system wide interrupt handling */初始化系统中断



/* #40 Initialize system's memory protection. */初始化内存保护



}

/* #50 If called on master core. */判断是否为主核

if(core->Id == OS_CORE_ID_MASTER) /* COV_OS_HALPLATFORMMULTICOREUNSUPPORTED */

{

/* #60 Perform the boot synchronization. */执行引导同步



/* #70 Initialize the system data. */初始化系统数据

Os_SystemInit();

}

/* #100 Perform the boot synchronization on this slave core. */

Os_CoreEmulateSlaveWaitForHardwareInit(core->Id);在此从内核上执行引导同步



/* #110 Perform the boot synchronization on this slave core until StartCore is called by the master. */

Os_CoreEmulateSlaveWaitForStartCore(core->Id);在此从内核上执行引导同步,直到主内核调用StartCore



/* #120 Determine the startup mode. */确定启动模式

Os_CoreDetermineStartStatus(core); /* SBSW_OS_CORE_COREDETERMINESTARTSTATUS_001 */

}

/* #130 Initialize core specific interrupt handling. */初始化核特殊中断处理

Os_CoreInterruptHandlingInit(core);



/* #140 If we are an AUTOSAR core: */判断是否为autosar核

if(core->IsAsrCore == TRUE) /* COV_OS_HALPLATFORMMULTICOREUNSUPPORTED */

{

P2CONST(Os_CoreAsrConfigType, AUTOMATIC, OS_CONST) asrCore;



asrCore = Os_Core2AsrCore(core); /* SBSW_OS_CORE_CORE2ASRCORE_001 */



/* #150 Initialize thread class object */初始化线程类对象

Os_ThreadClassInit(asrCore->ThreadClass); /* SBSW_OS_CORE_THREADCLASSINIT_001 */



/* #160 If we are the master core. */判断是否为主核

if(core->Id == OS_CORE_ID_MASTER)

{

/* #170 Attach to the barrier. */


}



/* #180 Perform reduced initialization that allows usage of interrupt API. */




/* #190 Initialize stacks. */初始化栈区

}

}

以上OS_init()函数就执行完了,Autosar OS相关的配置只有和CORE相关的有部分体现,大部分OS的内容应该在后面才体现。

Basic Runtime System(BRS)

接着:

BswInit_InitializeOne

void BswInit_InitializeOne(void)

{

/* some calls are only necessary on master core */

if(GetCoreID()==ECUM_CORE_ID_STARTUP)

{

# if !defined (_MICROSOFT_C_VTT_)

BrsAsrMainInit();//主初始化例程。*包含BRS模块的初始化和BRS主要特定的初始化

#endif /*!_MICROSOFT_C_VTT_*/



#if !defined (BRS_ENABLE_HLPTEST_SUPPORT)

/* UserDefined ExclusiveArea handling for CAN channels, according to AN-ISC-8-1149_ErrorHook_E_OS_DISABLED_INT.pdf */用户自定义专属区域处理can通道

BrsAsrApplCanInterruptLockCtr = 0u;

#endif



}

}

BswInit_InitializeTwo

实际为空

void BswInit_InitializeTwo(void)

{

//Can be used for additional necessary initialization calls.可以用于其他必要的初始化调用。

}

以上还没有启动其他核的过程。

后面跳转到EcuM_Init

EcuM是ECU状态管理,主要用来ECU上下电的管理。

  • 0
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

赞哥哥s

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值