Skip to content

Commit c67b2ee

Browse files
committed
wcet analysis added, upgraded based on the new approach of lf's foldering
1 parent 30adc83 commit c67b2ee

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

docs/embedded/patmos.mdx

+26-16
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ execution time (WCET) for reactions.
1212
- DE2-115 Development Kit, which is equipped with Altera Cyclone IV FPGA (optional)
1313
### Getting Started
1414
To know how to install the toolchain for building Patmos, read the Patmos project's readme at https://github.com/t-crest/patmos or study the sixth chapter of its handbook available here: [Patmos Reference Handbook](http://patmos.compute.dtu.dk/patmos_handbook.pdf)
15-
### Compiling and Running Reactors
15+
### Compiling and Running Lingua Franca codes
1616
Patmos can run in an FPGA, but there are also two simulators available:
1717

1818
1. `pasim`: a software ISA simulator that is written in C++.
@@ -41,19 +41,25 @@ SERIAL?=/dev/ttyUSB0
4141
INCS := -I"$(LF_PROJECT_ROOT)/include" \
4242
-I"$(LF_PROJECT_ROOT)/include/api" \
4343
-I"$(LF_PROJECT_ROOT)/include/core" \
44-
-I"$(LF_PROJECT_ROOT)/include/core/platform" \
45-
-I"$(LF_PROJECT_ROOT)/include/core/modal_models" \
46-
-I"$(LF_PROJECT_ROOT)/include/core/utils" \
47-
44+
-I"$(LF_PROJECT_ROOT)/include/$(LF_MAIN_TARGET)" \
45+
-I"$(CURDIR)/include/$(LF_MAIN_TARGET)" \
46+
-I"$(CURDIR)/include/core/modal_models" \
47+
-I"$(CURDIR)/include/core/utils" \
48+
-I"$(CURDIR)/tag/api"\
49+
-I"$(CURDIR)/low_level_platform/api" \
50+
-I"$(CURDIR)/logging/api" \
51+
-I"$(CURDIR)/version/api" \
52+
-I"$(CURDIR)/platform/api" \
53+
4854
CC := patmos-clang
4955
CFLAGS := -O2 $(INCS) -DINITIAL_EVENT_QUEUE_SIZE=10 -DINITIAL_REACT_QUEUE_SIZE=10 -DLF_SINGLE_THREADED=0 -DLF_REACTION_GRAPH_BREADTH=1
5056
SRC_FILES := _$(LF_MAIN_TARGET_LC)_main.c $(LF_MAIN_TARGET).c lib/schedule.c
5157
SRC_FILES += core/reactor_common.c core/lf_token.c core/reactor.c core/tag.c core/environment.c
5258
SRC_FILES += core/utils/util.c core/utils/vector.c
5359
SRC_FILES += core/utils/pqueue.c core/utils/pqueue_tag.c core/utils/pqueue_base.c
5460
SRC_FILES += core/utils/hashset/hashset_itr.c core/utils/hashset/hashset.c
55-
SRC_FILES += core/clock.c core/platform/lf_atomic_patmos.c core/platform/lf_atomic_irq.c
56-
SRC_FILES += core/platform/lf_patmos_support.c
61+
SRC_FILES += core/clock.c low_level_platform/impl/src/lf_atomic_patmos.c
62+
SRC_FILES += low_level_platform/impl/src/lf_patmos_support.c
5763

5864
OBJ_FILES := $(patsubst %.c,%.o,$(SRC_FILES))
5965
EXE_NAME := $(LF_MAIN_TARGET).elf
@@ -64,32 +70,35 @@ all: $(EXE_NAME)
6470

6571
# Target for the executable
6672
$(EXE_NAME): $(OBJ_FILES)
67-
$(CC) $(CFLAGS) -o $@ $^
73+
$(CC) $(CFLAGS) -o $@ $^ -mserialize=$(PML_FILE_NAME).pml
6874
# Rule to compile C files into object files
6975
$(OBJ_FILES): %.o: %.c
7076
$(CC) $(CFLAGS) -c -o $@ $<
7177

7278
clean:
7379
rm -f $(OBJ_FILES) $(EXE_NAME)
7480

81+
wcet: $(EXE_NAME)
82+
platin wcet --disable-ait -i $(PML_FILE_NAME).pml -b $(EXE_NAME) -e _helloworld_mainreaction_function_0 --report report.txt
83+
7584
```
7685

7786
Then move this Makefile inside the `src-gen/HelloWorld` folder and run the following make command:
7887

7988
make -C src-gen/HelloWorld
8089

81-
If you are using an older version of LF that doesn't support Patmos, you need to copy `lf_patmos_support` c and h files in the related folders before executing make command whether manually or by executing the following bash file that automates the copying process (considering those files are located in a folder called `files`)
90+
Since LF still doesn't support Patmos officialy, you need to copy some files inluding `lf_patmos_support` c and h files in the related folders before executing make command whether manually or by executing the following shell file that automates the copying process (considering those files are located in a folder called `files`). If you choose shell file, you can also add Makefile to the list.
8291

83-
```bash
92+
```shell
8493
PROJECT_ROOT="$PWD"
8594
PROJECT_NAME="HelloWorld"
95+
PROJECT_DIR="$PROJECT_ROOT/src-gen/$PROJECT_NAME"
8696

87-
cp "$PROJECT_ROOT/files/lf_patmos_support.h" "$PROJECT_ROOT/src-gen/$PROJECT_NAME/include/core/platform/"
88-
cp "$PROJECT_ROOT/files/platform.h" "$PROJECT_ROOT/src-gen/$PROJECT_NAME/include/core/"
89-
cp "$PROJECT_ROOT/files/lf_patmos_support.c" "$PROJECT_ROOT/src-gen/$PROJECT_NAME/core/platform/"
90-
cp "$PROJECT_ROOT/files/lf_atomic_patmos.c" "$PROJECT_ROOT/src-gen/$PROJECT_NAME/core/platform/"
91-
cp "$PROJECT_ROOT/files/lf_patmos_support.h" "$PROJECT_ROOT/include/core/platform/"
92-
cp "$PROJECT_ROOT/files/platform.h" "$PROJECT_ROOT/include/core"
97+
cp "$PROJECT_ROOT/files/lf_patmos_support.h" "$PROJECT_DIR/low_level_platform/api/platform/"
98+
cp "$PROJECT_ROOT/files/lf_patmos_support.c" "$PROJECT_DIR/low_level_platform/impl/src/"
99+
cp "$PROJECT_ROOT/files/lf_atomic_patmos.c" "$PROJECT_DIR/low_level_platform/impl/src/"
100+
cp "$PROJECT_ROOT/files/low_level_platform.h" "$PROJECT_DIR/low_level_platform/api/"
101+
cp "$PROJECT_ROOT/files/Makefile" "$PROJECT_DIR"
93102
```
94103

95104
If there is no error after making, an HelloWorld.elf file must be generator inside `src-gen\HelloWorld` folder. Then, the reactor can be executed on the SW simulator with the following command:
@@ -115,3 +124,4 @@ Hello World!
115124
---- Elapsed logical time (in nsec): 0
116125
---- Elapsed physical time (in nsec): 3,459,000
117126
```
127+
For doing WCET analysing, you can execute wcet target by running `make wcet` command.

0 commit comments

Comments
 (0)