This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

关于cortex-a7 l1 cache初始化顺序

大家好,我的应用场景为:cortex-a7 4核SMP分为两组使用,其中
(1):cpu0开启SMP 模式下运行Linux
(2):cpu1-cpu3开启SMP模式下运行自己开发的RTOS,
采用ARM DStream ST基于Arm Development Studio IDE 调试
IDE版本如下:
Version: 2019.1
Build: 201910912

操作步骤如下:
(1). cpu0在uboot启动运行cpu1,使cpu1运行一个简单死循环
die_loop(void)
{
while(1)
{;}
}
(2). 然后连接DStream仿真器,利用仿真器的脚本下载cpu1的代码到ddr,本设置pc到对应入口地址
(3). 开始调试cpu1的代码
当cpu1开L1指令cache后,仿真器无法进行单步调试
(4). 在ds5 IDE的寄存器窗口,手工修改寄存器SCTLR关闭icache
调试可以继续,否则代码始终停在原地。

(5). cache初始化顺序如下:

void cache_l1_enable_all(void)
{
..... <----此前actlr.SMP位已经置位
alt_cache_l1_instruction_enable();<---L1 ICache使能后仿真器无法向下运行
alt_cache_l1_data_enable();
alt_cache_l1_branch_enable();
....
}
使能L1 ICache代码如下
int alt_cache_l1_instruction_enable(void)
{
uint32_t sctlr;
__asm volatile ("MRC p15, 0, %[sctlr], c1, c0, 0" : [sctlr] "=r" (sctlr));
if ((sctlr & ALT_CPU_SCTLR_I_SET_MSK) == 0)
{
alt_cache_l1_instruction_invalidate();<---无效L1 ICache
sctlr |= ALT_CPU_SCTLR_I_SET_MSK;
__asm volatile ("MCR p15, 0, %[sctlr], c1, c0, 0" : : [sctlr] "r" (sctlr));

}
return 1; <---L1 ICache使能后仿真器无法向下运行
}
无效L1 ICache的代码
void alt_cache_l1_instruction_invalidate(void)
{
/* Issue the ICIALLUIS (Instruction Cache Invalidate ALL to point of
/ Unification Inner Shareable) cache maintenance operation
/ See ARMv7-A,R, section B4.2.1. */
uint32_t dummy = 0;
__asm volatile("MCR p15, 0, %[dummy], c7, c1, 0" : : [dummy] "r" (dummy));
}


如何解决,希望各位专家指教下,在cpu0已启动,如何使能cpu1的L1 ICache