Skip to content

Commit 4c588db

Browse files
committed
add board manager capabilities
* use only Arduino-supplied path variables in platform.txt * unify the syntax of all *.path variables in platform.txt * add skript for automatic repacking of SDCC snapshot files * add skript for automatic generation of the package*.json file * add a preliminary platform*.json file for testing
1 parent 9698974 commit 4c588db

4 files changed

Lines changed: 305 additions & 38 deletions

File tree

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
#!/bin/bash
2+
3+
PACKAGE_NAME=Sduino-test
4+
5+
packages_begin() {
6+
cat << EOF
7+
{
8+
"packages": [
9+
{
10+
"name": "$PACKAGE_NAME",
11+
"maintainer": "Michael Mayer",
12+
"websiteURL": "https://tenbaht.github.io/sduino/",
13+
"email": "[email protected]",
14+
"help": {
15+
"online": "http://www.stm32duino.com/viewforum.php?f=52"
16+
},
17+
EOF
18+
}
19+
20+
packages_end() {
21+
cat << EOF
22+
}
23+
]
24+
}
25+
EOF
26+
}
27+
28+
29+
30+
platforms_begin() {
31+
cat << EOF
32+
"platforms" : [
33+
{
34+
"name": "Board manager test core",
35+
"architecture": "stm8",
36+
"version": "0.3.0",
37+
"category": "Contributed",
38+
EOF
39+
}
40+
41+
platforms_end() {
42+
cat << EOF
43+
}
44+
],
45+
EOF
46+
}
47+
48+
49+
50+
51+
# list of supported boards
52+
list_boards() {
53+
echo " \"boards\": ["
54+
n=0
55+
sed -n "s/.*\.name=//p" ../sduino/hardware/sduino/stm8/boards.txt |\
56+
while read line; do
57+
if [ $n -ne 0 ]; then
58+
echo " },"
59+
fi
60+
echo " {"
61+
echo " \"name\": \"$line\""
62+
n=$((n+1))
63+
done
64+
echo " }"
65+
echo " ],"
66+
}
67+
68+
69+
70+
print_filedata() {
71+
URL=file://$(realpath $1)
72+
FILENAME=$1
73+
SIZE=$(stat --printf="%s" $FILENAME)
74+
CHKSUM=$(shasum -a 256 $FILENAME|cut "-d " -f1)
75+
cat << EOF
76+
"url": "$URL",
77+
"archiveFileName": "$FILENAME",
78+
"checksum": "SHA-256:$CHKSUM",
79+
"size": "$SIZE"
80+
EOF
81+
}
82+
83+
84+
# tools section
85+
86+
list_tools() {
87+
cat << EOF
88+
"tools" : [
89+
{
90+
"name": "STM8Tools",
91+
"version": "2017.10.20",
92+
"systems": [
93+
{
94+
"host": "x86_64-pc-linux-gnu",
95+
EOF
96+
print_filedata test-tools-ohne.tar.gz
97+
cat << EOF
98+
}
99+
]
100+
},
101+
{
102+
"name": "sdcc",
103+
"version": "build.9998",
104+
"systems": [
105+
{
106+
"host": "x86_64-pc-linux-gnu",
107+
EOF
108+
print_filedata sdcc-stm8-amd64-unknown-linux2.5-20170919-9998.tar.bz2
109+
cat << EOF
110+
}
111+
]
112+
}
113+
]
114+
EOF
115+
}
116+
117+
118+
119+
print_footer() {
120+
cat << EOF
121+
]
122+
}
123+
]
124+
}
125+
EOF
126+
}
127+
128+
list_dependencies() {
129+
cat << EOF
130+
"toolsDependencies": [
131+
{
132+
"name": "STM8Tools",
133+
"version": "2017.10.20",
134+
"packager": "$PACKAGE_NAME"
135+
},
136+
{
137+
"name": "sdcc",
138+
"version": "build.9998",
139+
"packager": "$PACKAGE_NAME"
140+
}
141+
],
142+
EOF
143+
}
144+
145+
146+
# shasum -a 256 test-core.tar.gz
147+
148+
packages_begin
149+
150+
platforms_begin
151+
list_boards
152+
list_dependencies
153+
print_filedata test-core.tar.gz
154+
platforms_end
155+
156+
list_tools
157+
packages_end

board-manager/minimize-sdcc.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
if [ $# -lt 1 ]; then
4+
echo "Minimize a SDCC snapshot build by leaving out all non-STM8 files."
5+
echo
6+
echo "usage: $0 sdcc-snapshot-filename"
7+
exit 1
8+
fi
9+
10+
11+
#FILE=~/Downloads/sdcc-snapshot-amd64-unknown-linux2.5-20170919-9998.tar.bz2
12+
FILE=$1
13+
14+
case "$FILE" in
15+
*.tar.bz2, *.tbz)
16+
TARFLAG=j
17+
;;
18+
*.tar.gz, *.tgz)
19+
TARFLAG=z
20+
esac
21+
22+
NAME=$(basename "$FILE")
23+
NAME=${NAME/snapshot/stm8}
24+
25+
tar xv${TARFLAG}f "$FILE" \
26+
--exclude=doc --exclude=src --exclude=non-free \
27+
--exclude=stlcs --exclude=ds80c390.h \
28+
"--exclude=pic*" \
29+
"--exclude=*00" "--exclude=*08" "--exclude=*2k" \
30+
"--exclude=*51" "--exclude=*80" "--exclude=*90" \
31+
"--exclude=*gb" "--exclude=*ka" "--exclude=*.info" \
32+
"--exclude=large*" "--exclude=medium" "--exclude=small*"
33+
34+
tar cv${TARFLAG}f "$NAME" sdcc
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"packages": [
3+
{
4+
"name": "Sduino",
5+
"maintainer": "Michael Mayer",
6+
"websiteURL": "https://tenbaht.github.io/sduino/",
7+
"email": "[email protected]",
8+
"help": {
9+
"online": "http://www.stm32duino.com/viewforum.php?f=52"
10+
},
11+
"platforms" : [
12+
{
13+
"name": "Board manager test core",
14+
"architecture": "stm8",
15+
"version": "0.3.0",
16+
"category": "Contributed",
17+
"boards": [
18+
{
19+
"name": "STM8S103F3 Breakout Board"
20+
},
21+
{
22+
"name": "STM8S105C6 Discovery Board"
23+
}
24+
],
25+
"toolsDependencies": [
26+
{
27+
"name": "STM8Tools",
28+
"version": "2017.10.20",
29+
"packager": "Sduino"
30+
},
31+
{
32+
"name": "sdcc",
33+
"version": "build.9998",
34+
"packager": "Sduino"
35+
}
36+
],
37+
"url": "file:///home/mmayer/rsync/stm8/board-manager/test-core.tar.gz",
38+
"archiveFileName": "test-core.tar.gz",
39+
"checksum": "SHA-256:9dd62acb6e44b42abc4f192d8a926b8a258531ece892dbb4dca1969afdaadf10",
40+
"size": "6924270"
41+
}
42+
],
43+
"tools" : [
44+
{
45+
"name": "STM8Tools",
46+
"version": "2017.10.20",
47+
"systems": [
48+
{
49+
"host": "x86_64-pc-linux-gnu",
50+
"url": "file:///home/mmayer/rsync/stm8/board-manager/test-tools-ohne.tar.gz",
51+
"archiveFileName": "test-tools-ohne.tar.gz",
52+
"checksum": "SHA-256:89311df0021dc123b311fcaf265ec72a15b855b63b4d7ccc6ec3077192b7cc60",
53+
"size": "2032102"
54+
}
55+
]
56+
},
57+
{
58+
"name": "sdcc",
59+
"version": "build.9998",
60+
"systems": [
61+
{
62+
"host": "x86_64-pc-linux-gnu",
63+
"url": "file:///home/mmayer/rsync/stm8/board-manager/sdcc-stm8-amd64-unknown-linux2.5-20170919-9998.tar.bz2",
64+
"archiveFileName": "sdcc-stm8-amd64-unknown-linux2.5-20170919-9998.tar.bz2",
65+
"checksum": "SHA-256:de5a44dc3ff85ce2aa03117a2c270643b9365600ea833e7cfa8a026efded2632",
66+
"size": "2479706"
67+
}
68+
]
69+
}
70+
]
71+
}
72+
]
73+
}

0 commit comments

Comments
 (0)