工作知识点杂记


1、ZYNQ双核试验注意点:

加-DUSE_AMP=1、
lscript.ld文件中更改cpu1的ddr地址、
在fsbl中main.c中增加StartCpu1()代码用于启动CPU1,并添加CPU1STARTMEM启动地址。
实际使用DDR为两个512MB的,共1GB大小。
DDR总地址0x00000000~0x3FFFFFFF()
CPU0使用DDR:0x00100000~0x3CF00000
CPU1使用DDR:0x3D000000~0x3FFF0000
当CPU1启动地址超过512MB,一定要在boot.S中注释掉以下代码,不然无法启动CPU1。

#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

CPU1加入两个软中断函数:

#define CPU1_SW_INTR   0x0e
#define CPU1_SW_INTR12 0x0C

int initSwIntr(){
    
    
	int status;
	Xil_ExceptionInit();
	ScuGicCfgPtr = XScuGic_LookupConfig(GIC_ID);
	status = XScuGic_CfgInitialize(&ScuGic,ScuGicCfgPtr,ScuGicCfgPtr->CpuBaseAddress);
	if(status != XST_SUCCESS){
    
    
		return status;
	}
	Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,(Xil_ExceptionHandler)XScuGic_InterruptHandler,&ScuGic);
	status = XScuGic_Connect(&ScuGic,CPU1_SW_INTR,(Xil_ExceptionHandler)cpu1IntrHandler,&ScuGic);
	status = XScuGic_Connect(&ScuGic,CPU1_SW_INTR12,(Xil_ExceptionHandler)cpu1IntrHandler12,&ScuGic);
	if(status != XST_SUCCESS){
    
    
			return status;
	}
	XScuGic_Enable(&ScuGic,CPU1_SW_INTR);
	XScuGic_Enable(&ScuGic,CPU1_SW_INTR12);
	Xil_ExceptionEnable();
	return XST_SUCCESS;
}


void cpu1IntrHandler(void * callbackref){
    
    
	xil_printf("CPU1:IN cpu1IntrHandler = 0x%08x\r\n",pVdmaQueue);
}

在CPU0中触发CPU1的SGI软中断:

//添加在任意函数内
XScuGic_SoftwareIntr(&xScuGic,CPU1_SW_INTR12,XSCUGIC_SPI_CPU1_MASK);
XScuGic_SoftwareIntr(&xScuGic,CPU1_SW_INTR,XSCUGIC_SPI_CPU1_MASK);

2、SD与EMMC

初始化等函数是不同的。
测试发现EMMC格式化格式选择FM_FAT才能正常使用(不知为何)。
SD、TF、EMMC格式化(一次):f_mount,f_mkfs
SD、TF、EMMC格式化(每次):
f_mount, f_open,f_lseek,f_write, f_close
f_mount, f_open,f_lseek,f_read, f_close

老版fatfs系统,SD卡f_mkfs()失败可能原因:
XSdPs_SdCardInitialize()尾部加上

if (((CSD[3] & CSD_STRUCT_MASK) >> 22U) == 0U) 
{
    
    
	BlkLen = 1 << ((CSD[2] & READ_BLK_LEN_MASK) >> 8U);
	Mult = 1 << (((CSD[1] & C_SIZE_MULT_MASK) >> 7U) + 2U);
	DeviceSize = (CSD[1] & C_SIZE_LOWER_MASK) >> 22U;
	DeviceSize |= (CSD[2] & C_SIZE_UPPER_MASK) << 10U;
	DeviceSize = (DeviceSize + 1U) * Mult;
	DeviceSize =  DeviceSize * BlkLen;
	InstancePtr->SectorCount = (DeviceSize/XSDPS_BLK_SIZE_512_MASK);
	} else if (((CSD[3] & CSD_STRUCT_MASK) >> 22U) == 1U) {
    
    
	InstancePtr->SectorCount = (((CSD[1] & CSD_V2_C_SIZE_MASK) >> 8U) +
	1U) * 1024U;
}

即给InstancePtr->SectorCount赋正确值,f_mkfs()就走通了。

3、ZYNQ UCOSII实验:

axi_timer_0使用Xilinx独立的驱动器,而axi_timer_1使用μC/ OS定制驱动程序。


猜你喜欢

转载自blog.csdn.net/LIU944602965/article/details/104474172
今日推荐