Skip to content

Commit 8544881

Browse files
committed
loop in build.sh
1 parent 74dc986 commit 8544881

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

examples/patmos/s4noc_fed_lf/build.sh

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
LF_MAIN=S4NoCFedLF
33
BIN_DIR=bin
4+
CC=patmos-clang
45
# Generate configuration templates
56
rm -rf $LF_MAIN $BIN_DIR
67
$REACTOR_UC_PATH/lfc/bin/lfc-dev --gen-fed-templates src/$LF_MAIN.lf
@@ -12,18 +13,27 @@ pushd ./$LF_MAIN/r1
1213
make all
1314
popd
1415

15-
# Generate and build r2 sources
16-
pushd ./$LF_MAIN/r2
17-
REACTOR_PATH=$(pwd)/src-gen/$LF_MAIN/r2
18-
./run_lfc.sh
19-
sed -i 's/_lf_environment/_lf_environment_2/g; s/lf_exit/lf_exit_2/g; s/lf_start/lf_start_2/g' $REACTOR_PATH/lf_start.c
20-
sed -i 's/(Federate/(Federate2/g; s/FederateStartupCoordinator/Federate2StartupCoordinator/g; s/FederateClockSynchronization/Federate2ClockSynchronization/g; s/Reactor_S4NoCFedLF/Reactor_S4NoCFedLF_2/g; s/S4NoCFedLF_r1/S4NoCFedLF_r1_2/g' $REACTOR_PATH/lf_federate.h $REACTOR_PATH/lf_federate.c
21-
make all OBJECTS="$REACTOR_PATH/lf_federate.bc $REACTOR_PATH/$LF_MAIN/Dst.bc $REACTOR_PATH/lf_start.bc"
22-
popd
16+
N=2
17+
# Generate and build other sources
18+
for i in $(seq 2 $N); do
19+
pushd ./$LF_MAIN/r$i
20+
REACTOR_PATH=$(pwd)/src-gen/$LF_MAIN/r$i
21+
./run_lfc.sh
22+
sed -i "s/_lf_environment/_lf_environment_$i/g; s/lf_exit/lf_exit_$i/g; s/lf_start/lf_start_$i/g" $REACTOR_PATH/lf_start.c
23+
sed -i "s/(Federate/(Federate$i/g; s/FederateStartup/Federate${i}Startup/g; s/FederateClock/Federate${i}Clock/g; s/Reactor_${LF_MAIN}/Reactor_${LF_MAIN}_$i/g; s/${LF_MAIN}_r1/${LF_MAIN}_r1_$i/g" $REACTOR_PATH/lf_federate.h $REACTOR_PATH/lf_federate.c
24+
make all OBJECTS="$REACTOR_PATH/lf_federate.bc $REACTOR_PATH/$LF_MAIN/Dst.bc $REACTOR_PATH/lf_start.bc"
25+
popd
26+
done
2327

2428
mkdir -p $BIN_DIR
2529

26-
patmos-clang -O2 -Wall -Wextra main.c ./$LF_MAIN/r1/bin/$LF_MAIN.a ./$LF_MAIN/r2/bin/$LF_MAIN.a -o $BIN_DIR/$LF_MAIN
30+
A_FILES=""
31+
for i in $(seq 1 $N); do
32+
A_FILES="$A_FILES ./$LF_MAIN/r$i/bin/$LF_MAIN.a"
33+
done
34+
35+
$CC -O2 -Wall -Wextra main.c $A_FILES -o $BIN_DIR/$LF_MAIN
36+
2737
read -n 1 -t 10 -p "Choose action: [e]mulate or [f]pga? (default: e) " action
2838
action=${action:-e}
2939
if [[ "$action" == "e" ]]; then

examples/patmos/s4noc_fed_lf/src/S4NoCFedLF.lf

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
target uC {
2-
platform: PATMOS,
3-
timeout: 20 sec
2+
platform: PATMOS
43
}
54

65
reactor Src(id: int = 0) {
76
output out: int
87

98
reaction(startup) -> out{=
10-
printf("Hello from Src!\n");
9+
printf("Hello Patmos from Src!\n");
1110
lf_set(out, self->id);
1211
=}
1312
}
@@ -17,11 +16,11 @@ reactor Dst {
1716
state check: bool = false
1817

1918
reaction(startup) {=
20-
printf("Hello from Dst!\n");
19+
printf("Hello Patmos from Dst!\n");
2120
=}
2221

2322
reaction(in) {=
24-
printf("Received %d from Src\n", in->value);
23+
printf("Patmos:Received %d from Src\n", in->value);
2524
validate(in->value == 42);
2625
self->check = true;
2726
env->request_shutdown(env);

src/platform/patmos/s4noc_channel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void S4NOCPollChannel_poll(NetworkChannel *untyped_self) {
8080
volatile _IODEV int *s4noc_source = (volatile _IODEV int *)(PATMOS_IO_S4NOC + 8);
8181

8282
if (((*s4noc_status) & 0x02) == 0) {
83-
S4NOC_CHANNEL_INFO("S4NOCPollChannel_poll: No data is available"); //if i remove it platform-test doesn't work
83+
S4NOC_CHANNEL_INFO("S4NOCPollChannel_poll: No data is available"); // if i remove it platform-test doesn't work
8484
return;
8585
}
8686

0 commit comments

Comments
 (0)