In Windows, go to Start --> Nios V Command Shell and run the following commands on your laptop:
make DE10-Lite
make GDB_SERVER
(alternatively, use make DE1-SoC)
The first command transmits a Nios V computer system to your DE10-Lite board. The second command will start a program on your laptop that you need to leave running -- it continuously communicates between your Nios V computer system and your laptop. If you exit the GDB server by typing Q, the commands below will not longer work. Sometimes things get confused and you need to stop everything, including the GDB server, and start over. Sometimes the GDB server can't find the JTAG server to start -- try starting Quartus and then re-run the command.
Again, go to Start --> Nios V Command Shell and run the following commands on your laptop:
make TERMINAL
This launches a program to listen and display any characters sent by your Nios V computer over the JTAG UART. Leave this program running to capture everything printed by your program. Control-C will exit.
You can merge windows by dragging the tab for the Nios V Command Shell window over the tab from the first window.
Again, go to Start --> Nios V Command Shell and run the following commands on your laptop:
make COMPILE
make RUN
The first command compiles your program, vga.c into an object file,
vga.c.o, and then linking it into an executable, vga.elf. The second
command transfers the vga.elf executable to your Nios V computer and runs it.
This Nios V program will print the message "start" to the TERMINAL window you started earlier, then it will fill the VGA screen with colour bar pattern, then it will print the message "done".
After make COMPILE, you can also launch gdb to debug your program:
make GDB_CLIENT
Note: for some reason, GDB is not working with C code. Use CPUlator instead.
Instead of using GDB and using your FPGA board, you can run things on CPUlator.
To get started:
- select RISC-V RV32 under Architecture
- select RISC-V RV32 DE1-SoC under System
- select Go
- in the Editor window, change Language from RV32 to C
All of your source code has to appear in the one edit window (as a single file).
For this lab, first paste the contents of vga.c into the Editor window. Then,
find the line that says #include "address_map_niosv.h and delete it; in its place,
paste the entire contents of the file address_map_niosv.h.
If you have a DE1-SoC, or are running in CPUlator, modify the beginning of
address_map_niosv.h so it reads #define DE10LITE 0. If you switch from
CPUlator back to DE10-Lite hardware, be sure to change the 0 back to a 1.