nios2-terminal: connected to hardware target using UART on /dev/com1 at 115200 b aud nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate) 这个是nios2-terminal命令行提示啊,没有问题啊。 如果楼主要输出自己的数据,可以使用比如 fprintf(uart, "open flash device failed!!!\n");
int main(void) { alt_flash_fd* flash_handle; FILE *uart; char write_data = 0; char read_data = 0; write_data = 100; uart = fopen(UART_NAME,"w"); flash_handle = alt_flash_open_dev(CFI_FLASH_NAME); fprintf(uart, "open flash device...\n"); usleep(10000); if (flash_handle) { fprintf(uart, "open flash device successed!!!\n"); usleep(10000); alt_write_flash(flash_handle, DATA_OFFSET, &write_data, 1); fprintf(uart, "wirte_data = %d\n", write_data); usleep(10000); alt_read_flash(flash_handle, DATA_OFFSET, &read_data, 1); fprintf(uart, "read_data = %d\n", read_data); usleep(10000); if(read_data == write_data) { fprintf(uart, "flash write and read successed!!!\n"); usleep(10000); } else { fprintf(uart, "flash write or read failed!!!\n"); usleep(10000); } alt_flash_close_dev(flash_handle); fprintf(uart, "close flash device...\n"); usleep(10000); } else { fprintf(uart, "open flash device failed!!!\n"); usleep(10000); } }
|