一、代码
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xparameters.h"
#include "xparameters_ps.h"
#include "xil_io.h"
#define DDR_BASEARDDR XPAR_DDR_MEM_BASEADDR + 0x10000000
int main()
{
init_platform();
print("Hello World\n\r");
print("Successfully ran Hello World application");
int i;
int rev;
for (i=0; i<32; i++)
{
Xil_Out32(DDR_BASEARDDR+i*4,i);
}
for (i=0; i<32; i++)
{
rev = Xil_In32(DDR_BASEARDDR+i*4);
xil_printf( "the address at %x data is : %x \n\r" ,DDR_BASEARDDR+i*4, rev);
}
cleanup_platform();
return 0;
}
二、测试结果