ZYNQ :双核裸机例程

vivado 2014.4

特殊情况:总DDR内存大于512MB,且CPU0已经占用了超过512MB,这时按以下步骤CPU1无法启动。
原因:启动入口地址限制。更改方法如下:
打开cpu1_bsp\ps7_cortexa9_1\libsrc\standalone_v4_2\src\boot.S,注释为以下效果即可

#if USE_AMP==1
//	ldr	r3, =0x1ff			/* 512 entries to cover 512MB DDR */
//	ldr	r0, =TblBase			/* MMU Table address in memory */
//	add	r0, r0, #0x800			/* Address of entry in MMU table, for 0x20000000 */
//	ldr	r2, =0x0c02			/* S=b0 TEX=b000 AP=b11, Domain=b0, C=b0, B=b0 */
//mmu_loop:
//	str	r2, [r0]			/* write the entry to MMU table */
//	add	r0, r0, #0x4			/* next entry in the table */
//	add	r2, r2, #0x100000		/* next section */
//	subs	r3, r3, #1
//	bge	mmu_loop			/* loop till 512MB is covered */
#endif

部分所需代码:

#define sev() __asm__("sev")
#define CPU1STARTADR 0xFFFFFFF0 //这个地址是固定的
#define CPU1STARTMEM 0x3D000000 //这个CPU1启动地址是在lscript.ld中设置的

void StartCpu1(void)
{
    #if 1
    fsbl_printf(DEBUG_GENERAL,"FSBL: Write the address of the application for CPU 1 to 0xFFFFFFF0\n\r");
    Xil_Out32(CPU1STARTADR, CPU1STARTMEM);
    dmb(); //waits until write has finished
    fsbl_printf(DEBUG_GENERAL,"FSBL: Execute the SEV instruction to cause CPU 1 to wake up and jump to the application\n\r");
    sev();
    #endif
}

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

-DUSE_AMP=1
#define sev() __asm__("sev")
#define CPU1STARTADR 0xFFFFFFF0
#define CPU1STARTMEM 0x02000000//此处必须与第5步改的cpu1的ddr地址一致
void StartCpu1(void)
{
    #if 1
    fsbl_printf(DEBUG_GENERAL,"FSBL: Write the address of the application for CPU 1 to 0xFFFFFFF0\n\r");
    Xil_Out32(CPU1STARTADR, CPU1STARTMEM);
    dmb(); //waits until write has finished
    fsbl_printf(DEBUG_GENERAL,"FSBL: Execute the SEV instruction to cause CPU 1 to wake up and jump to the application\n\r");
    sev();
    #endif
}
//app_cpu0.c为以下代码
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "sleep.h"
int main()
{
    init_platform();
    while(1)
    {
	print("CPU 0 : Hello World\r\n");
	sleep(2);
    }
    cleanup_platform();
    return 0;
}
//app_cpu1.c为以下代码
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "sleep.h"
int main()
{
    init_platform();
    while(1)
    {
	print("CPU 1 : New World\r\n");
	sleep(3);
    }
    cleanup_platform();
    return 0;
}
posted @   solonj  阅读(536)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
点击右上角即可分享
微信分享提示