-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompileMemMapDef.sh
More file actions
executable file
·39 lines (28 loc) · 956 Bytes
/
Copy pathcompileMemMapDef.sh
File metadata and controls
executable file
·39 lines (28 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
pwd
mkdir -p geninc
PLATFORM="uint$2_t"
DIR=geninc
CPPFILE=$DIR/memregmap.cpp
INCFILE=$DIR/memregmap.inc
echo "#include <dsl.h>" > $INCFILE
echo "#include <cstdint>" >> $INCFILE
echo "" >> $INCFILE
echo "using hetarch::dsl::Global;" >> $INCFILE
echo "typedef $PLATFORM RegsPlatform;" >> $INCFILE
echo "" >> $INCFILE
while IFS='' read -r line || [[ -n "$line" ]]; do
ADDR=$(echo $line | cut -d " " -f 1)
NAME=$(echo $line | cut -d " " -f 2)
echo "extern Global<RegsPlatform, uint16_t> $NAME;" >> $INCFILE
done < "$1"
echo "#include \"memregmap.inc\"" > $CPPFILE
echo "" >> $CPPFILE
echo "using hetarch::dsl::Global;" >> $CPPFILE
echo "typedef $PLATFORM RegsPlatform;" >> $CPPFILE
echo "" >> $CPPFILE
while IFS='' read -r line || [[ -n "$line" ]]; do
ADDR=$(echo $line | cut -d " " -f 1)
NAME=$(echo $line | cut -d " " -f 2)
echo "Global<RegsPlatform, uint16_t> $NAME(0x$ADDR);" >> $CPPFILE
done < "$1"