#include #include "platform.h" #include "xil_printf.h" #include "xil_io.h" #include "sleep.h" int main() { init_platform(); print("Hello World\n\r"); Xil_Out32(XPAR_SLAVE_AXI_LITE_V1_0_0_BASEADDR, 1);//点亮LED u32 led = 1; u32 button = 0; while (1) { usleep(100000); button = Xil_In32(XPAR_SLAVE_AXI_LITE_V1_0_0_BASEADDR+4); if (button == 0xFFFFFFFF) { //打印消息 print("button pressed\n\r"); //复位 button = 0; //按钮按下 if (led == 0) { led = 1; } else { led = 0; } Xil_Out32(XPAR_SLAVE_AXI_LITE_V1_0_0_BASEADDR, led); } } cleanup_platform(); return 0; }