Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add script to simulate all apps #341

Merged
merged 30 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
72511f0
Added two new targets in the topmost makefile to simulate apps, and a…
JuanSapriza Jul 6, 2023
c7230c8
Check whether the compiler/simulator is installed before trying
JuanSapriza Jul 6, 2023
7e6e035
WIP: Always simulating the same app.
JuanSapriza Jul 6, 2023
6eac0ef
Blacklist of apps that are not simulated
JuanSapriza Jul 6, 2023
ad8ed3b
--amend
JuanSapriza Jul 6, 2023
b100b26
--amend
JuanSapriza Jul 6, 2023
54ac2a3
returned pdm2pcm to its default value
JuanSapriza Jul 6, 2023
b5f3b89
Tests that are not passed show as errors. Option to revert changed fi…
JuanSapriza Jul 6, 2023
f9c80f5
Minor reordering
JuanSapriza Jul 6, 2023
4de5946
Re-formatted messages and added compilers in loop
JuanSapriza Jul 10, 2023
40edfbf
Reduced the output of the building and skipped apps that fail building
JuanSapriza Jul 10, 2023
4e15276
Further comments added
JuanSapriza Jul 10, 2023
03e9ac7
Added a timeout to kill apps. Report differentiated between killed by…
JuanSapriza Jul 10, 2023
d819b1b
Added a check in the app-clean target so it does not crash if the bui…
JuanSapriza Jul 19, 2023
eb4edf2
Removed old verification script
JuanSapriza Jul 20, 2023
0f2b99d
Removed the compiler existence check
JuanSapriza Jul 20, 2023
af7857f
Modified the Makefile to check if the sw/Makefile exists before perfo…
JuanSapriza Jul 20, 2023
15d8644
Added default linker and removed debug mode
JuanSapriza Jul 20, 2023
feb9642
Configured for questasim simulation choosing the right boot and flash…
JuanSapriza Jul 20, 2023
f261385
When simulating with questasim looks for the phrase Errors: 0
JuanSapriza Jul 20, 2023
042f9ed
Updated README file to include the new script
JuanSapriza Jul 20, 2023
c073e80
Added the possibility of changing the time and whether to run on debu…
JuanSapriza Jul 20, 2023
22490b1
Updated readme
JuanSapriza Jul 20, 2023
85d97ac
Removed the automatic conda activation
JuanSapriza Jul 20, 2023
d44418f
Changed the readme to execute the script isntead of sourcing
JuanSapriza Jul 20, 2023
e290d0f
fixed typo
JuanSapriza Jul 27, 2023
ad7dddb
Updated the error finding for verilator. Changed the readme to force …
JuanSapriza Jul 27, 2023
00e838e
removed unneccessary echo
JuanSapriza Jul 27, 2023
16f3609
Re corrected typo
JuanSapriza Jul 27, 2023
e4dde31
Modified the error message at which we detect an questasim failure
JuanSapriza Jul 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ run-blinkyfreertos: mcu-gen verilator-sim
cat uart0.log; \
cd ../../..;

## Uses verilator to simulate the HW model and run the FW
## First builds the app and then uses verilator to simulate the HW model and run the FW
## UART Dumping in uart0.log to show recollected results
run-app-sim: app
run-app-verilator: app
cd ./build/openhwgroup.org_systems_core-v-mini-mcu_0/sim-verilator; \
./Vtestharness +firmware=../../../sw/build/main.hex; \
cat uart0.log; \
Expand Down Expand Up @@ -230,7 +230,11 @@ gdb_connect:

## Clean the CMake build folder
app-clean:
$(MAKE) -C sw/build clean
if [ -f "sw/build/Makefile" ]; then\
$(MAKE) -C sw/build clean;\
else\
$(MAKE) app-restore;\
fi

## Removes the CMake build folder
app-restore:
Expand Down
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,50 @@ cd ./build/openhwgroup.org_systems_core-v-mini-mcu_0/sim-verilator
./Vtestharness +firmware=../../../sw/build/main.hex
cat uart0.log
```

## Automatic testing

X-HEEP includes two tools to perform automatic tests over your modifications.

### Github CIs

Upon push, tests are run on Github runners, these include:
* The generated `.sv` files pushed are equal to those generated in the runner (the code does not depend on the modification of generated files)
* Vendor is up to date (the code does not depend on the modification of vendorized files)
* All applications can be built successfully using both gcc and clang

All test must be successful before PRs can be merged.

### Simulation script

Additionally, a `test_all.sh` script is provided. Apart from compiling all apps with both gcc and clang, it will simulate them and check the result.

You can choose:
* Simulator: `verilator` (default) or `questasim`.
* Linker: `on_chip`(default), `flash_load` or `flash_exec`.
* Timeout: Integer number of seconds (defualt 120)

#### Usage

You can **SOURCE** the script as
```bash
. test_all.sh flash_load verilator
```
*Pay special attention to the first period in the command!*
You will be killing simulations that take too long, if you **EXECUTE** (`./test_all.sh`) this action kills the script.
The order or capitalization of the arguments is irrelevant.

> Note: Be sure to commit all your changes before running the script!

* Applications that fail being built with gcc will not be simulated (skipped).
* Some applications are skipped by default for not being suitable for simulation.
* If a simulation takes too long (>timeout), it is killed.

* Upon starting, the script will modify the `mcu_cfg.hjson` file to include all peripherals (so the largest number of apps can be run), re-generates the mcu and re-builds the simulation model for the chosen tool.
These changes can be reverted at the end of the execution (default). If changes were not commited, accepting this operation will revert them!

The success of the script is not required for merging of a PR.

## Debug

Follow the [Debug](./Debug.md) guide to debug core-v-mini-mcu.
Expand Down
Loading