|
16 | 16 |
|
17 | 17 | The directory structure is explained below: |
18 | 18 |
|
19 | | -> hw- necessary hardware files (.qpf, .qsf, .sv, .v, .ip) of the design |
| 19 | +- hw - necessary hardware files (.qpf, .qsf, .sv, .v, .ip) of the design |
20 | 20 |
|
21 | | -> sw- This folder contains software application files |
| 21 | +- sw - This folder contains software application files |
22 | 22 |
|
23 | | -> scripts- This folder consists of scripts to build the design |
| 23 | +- scripts - This folder consists of scripts to build the design |
24 | 24 |
|
25 | 25 | ### 2. Using existing files to run the design on hardware |
26 | 26 |
|
27 | | -> The sof and elf files required to run the design can be found in "ready_to_test" folder |
| 27 | +- The sof and elf files required to run the design can be found in "ready_to_test" folder |
28 | 28 |
|
29 | | -> Refer the Hardware validation section (3.d) for the steps |
| 29 | +- Refer the Hardware validation section (3.d) for the steps |
30 | 30 |
|
31 | 31 | ### 3. Building the design from scratch |
32 | 32 |
|
33 | 33 | The steps to build the project from scratch are mentioned below: |
34 | 34 |
|
35 | 35 | a. Required directory structure |
36 | | - - The top-level project folder should have directory structure as mentioned in Section 1 (Directory Structure). |
| 36 | +- The top-level project folder should have directory structure as mentioned in Section 1 (Directory Structure). |
37 | 37 |
|
38 | 38 | b. Using build_sof.py to compile the design |
39 | | - - Invoke the quartus_py shell in the terminal |
40 | | - - Run the following command in the terminal from top level project directory: |
41 | | - > quartus_py ./scripts/build_sof.py |
42 | | - - The quartus tool will compile the design and generate the output files |
| 39 | +- Invoke the quartus_py shell in the terminal |
| 40 | + |
| 41 | +- Run the following command in the terminal from top level project directory: |
| 42 | +quartus_py ./scripts/build_sof.py |
| 43 | + |
| 44 | +- The quartus tool will compile the design and generate the output files |
43 | 45 |
|
44 | 46 | c. Creating the bsp, build software sources and download elf |
45 | | - - To create software app, run the following commands in the terminal: |
46 | | - Note: clean the app build project before regenerating elf |
47 | | - |
48 | | - > niosv-bsp -c --quartus-project=hw/top.qpf --qsys=hw/qsys_top.qsys --type=hal sw/bsp/settings.bsp |
49 | | - |
50 | | - > niosv-app --bsp-dir=sw/bsp --app-dir=sw/app --srcs=sw/app/main.c |
51 | | - |
52 | | - > niosv-shell |
53 | | - |
54 | | - > cmake -S ./sw/app -B sw/app/build -G "Unix Makefiles" |
55 | | - |
56 | | - > make -C sw/app/build |
57 | | - |
58 | | - > elf2hex sw/app/build/app.elf -b 0x0 -w 32 -e 0x9ffff sw/app/build/onchip_mem.hex -r4 |
59 | | - |
60 | | - |
61 | | -Note: Reduce the JTAG clock frequency to 6MHz before programming the application .elf file on the board. |
62 | | -command: jtagconfig --setparam 1 JtagClock 6M |
| 47 | +- To create software app, run the following commands in the terminal: |
| 48 | + |
| 49 | +- Clean the app build project before regenerating elf |
| 50 | +``` |
| 51 | +niosv-bsp -c --quartus-project=hw/top.qpf --qsys=hw/qsys_top.qsys --type=hal sw/bsp/settings.bsp |
| 52 | +niosv-app --bsp-dir=sw/bsp --app-dir=sw/app --srcs=sw/app/main.c |
| 53 | +niosv-shell |
| 54 | +cmake -S ./sw/app -B sw/app/build -G "Unix Makefiles" |
| 55 | +make -C sw/app/build |
| 56 | +elf2hex sw/app/build/app.elf -b 0x0 -w 32 -e 0x9ffff sw/app/build/onchip_mem.hex -r4 |
| 57 | +``` |
| 58 | + |
63 | 59 |
|
64 | 60 | d. Hardware Validation |
65 | | - - Program the generated sof and then download the elf file on the board |
66 | | - |
67 | | - > quartus_pgm --cable=1 -m jtag -o 'p;ready_to_test/top.sof' |
68 | | - |
69 | | - - Download the elf file on the board |
70 | | - |
71 | | - > niosv-download -g ready_to_test/app.elf -c 1 |
72 | | - |
73 | | - - Verify the output on the terminal by using the following command in the terminal: |
74 | | - |
75 | | - > juart-terminal -d 1 -c 1 -i 0 |
| 61 | +- Program the generated sof and then download the elf file on the board |
| 62 | +``` |
| 63 | +quartus_pgm --cable=1 -m jtag -o 'p;ready_to_test/top.sof' |
| 64 | +``` |
| 65 | +- Reduce the JTAG clock frequency to 6MHz before programming the application .elf file on the board. |
| 66 | +``` |
| 67 | +jtagconfig --setparam 1 JtagClock 6M |
| 68 | +``` |
| 69 | +- Download the elf file on the board |
| 70 | +``` |
| 71 | +niosv-download -g ready_to_test/app.elf -c 1 |
| 72 | +``` |
| 73 | +- Verify the output on the terminal by using the following command in the terminal: |
| 74 | +``` |
| 75 | +juart-terminal -d 1 -c 1 -i 0 |
| 76 | +``` |
76 | 77 |
|
77 | 78 | ### 4. Running simulation |
78 | 79 |
|
79 | 80 | Simulation is enabled for this design where the memory is initialized with the application hex. Use the following commands to run the simulation: |
80 | | - |
81 | | - > Generate Testbench from Platform Designer. Generate -> Generate Testbench System |
82 | | - |
83 | | - > cp ./sw/app/build/onchip_mem.hex ./*_tb/*_tb/sim/mentor |
84 | | - |
85 | | - > cd hw/*_tb/*_tb/sim/mentor/ |
86 | | - |
87 | | - > vsim & |
88 | | - |
89 | | - > source msim_setup.tcl |
90 | | - |
91 | | - > ld_debug |
92 | | - |
93 | | - > run -all |
| 81 | + |
| 82 | +- Generate Testbench from Platform Designer. Generate -> Generate Testbench System |
| 83 | + |
| 84 | +``` |
| 85 | +cp ./sw/app/build/onchip_mem.hex ./qsys_top_tb/qsys_top_tb/sim/mentor |
| 86 | +cd hw/qsys_top_tb/qsys_top_tb/sim/mentor/ |
| 87 | +vsim & |
| 88 | +source msim_setup.tcl |
| 89 | +ld_debug |
| 90 | +run -all |
| 91 | +``` |
0 commit comments