Skip to content

Commit ee3cda6

Browse files
fpistmVVESTM
authored andcommitted
Introduce STM8 packaging
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 561ca22 commit ee3cda6

File tree

6 files changed

+171
-1
lines changed

6 files changed

+171
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
*.swp
2+
STM8/src/*.json
3+
STM8/src/*.tar.bz2
24
STM32/src/*.json
35
STM32/src/*.tar.bz2
46
STM32/src/download

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# BoardManagerFiles
2-
Storage for Arduino Boards Manager JSON and package files for the [STM32 core](https://github.com/stm32duino/Arduino_Core_STM32) support.
2+
Storage for Arduino Boards Manager JSON and package files for the [STM32](https://github.com/stm32duino/Arduino_Core_STM32) and [STM8](https://github.com/stm32duino/Arduino_Core_STM8) cores support.
33

44
**Warning**: release versioning has been changed from date versioning to semantic one. See [Release Versioning change](https://github.com/stm32duino/wiki/wiki/Release-Versioning-change)
55

STM8/package_stm8_index.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"packages": [
3+
{
4+
"name": "STM8",
5+
"maintainer": "STMicroelectronics",
6+
"websiteURL": "http://www.st.com/en/microcontrollers.html",
7+
"email": "",
8+
"help": {
9+
"online": "http://www.stm32duino.com/"
10+
},
11+
"platforms": [
12+
],
13+
"tools": [
14+
{
15+
"name": "cxppstm8",
16+
"version": "4.1.1",
17+
"systems": [
18+
{
19+
"host": "i686-mingw32",
20+
"url": "http://cosmicsoftware.com/Arduino/cxppstm8.tar.bz2",
21+
"archiveFileName": "cxppstm8.tar.bz2",
22+
"checksum": "SHA-256:aac35551f128a0edb175ba89b12a992bfc707eceb3fcc205896c2a4872c66732",
23+
"size": "29135748"
24+
}
25+
]
26+
}
27+
]
28+
}
29+
]
30+
}

STM8/src/Makefile

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
SHELL = /bin/sh
2+
3+
.SUFFIXES: .tar.bz2
4+
5+
ROOT_PATH := .
6+
TOOLS_PATH := ../tools
7+
CORE_PATH := ../packages
8+
9+
OS ?=$(shell uname -s)
10+
11+
# -----------------------------------------------------------------------------
12+
ifeq (postpackaging_core,$(findstring $(MAKECMDGOALS),postpackaging_core))
13+
PACKAGE_FILENAME=$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.bz2
14+
PACKAGE_CHKSUM := $(firstword $(shell shasum -a 256 "$(PACKAGE_FILENAME)"))
15+
PACKAGE_SIZE := $(firstword $(shell wc -c "$(PACKAGE_FILENAME)"))
16+
endif
17+
18+
ifeq (postpackaging_tools,$(findstring $(MAKECMDGOALS),postpackaging_tools))
19+
PACKAGE_WIN_FILENAME=$(PACKAGE_NAME)-$(PACKAGE_VERSION)-windows.tar.bz2
20+
PACKAGE_WIN_CHKSUM := $(firstword $(shell shasum -a 256 "$(PACKAGE_WIN_FILENAME)"))
21+
PACKAGE_WIN_SIZE := $(firstword $(shell wc -c "$(PACKAGE_WIN_FILENAME)"))
22+
endif
23+
# -----------------------------------------------------------------------------
24+
25+
.PHONY: all clean tools print_info postpackaging
26+
27+
all: core tools
28+
29+
core: PACKAGE_NAME := STM8
30+
core: PACKAGE_FOLDER := Arduino_Core_STM8
31+
core: PACKAGE_VERSION := $(shell git --git-dir=$(PACKAGE_FOLDER)/.git describe --tags)
32+
core: PACKAGE_DATE := $(firstword $(shell git --git-dir=$(PACKAGE_FOLDER)/.git log -1 --pretty=format:%ci))
33+
core: clean print_info
34+
@echo ----------------------------------------------------------
35+
@echo "Packaging $@..."
36+
@git --git-dir=$(PACKAGE_FOLDER)/.git show HEAD --pretty=short --no-patch > $(PACKAGE_FOLDER)/package_version.txt
37+
@tar --mtime='$(PACKAGE_DATE)' \
38+
--exclude=.git \
39+
--exclude=.gitattributes \
40+
--exclude=.github \
41+
--exclude=.gitignore \
42+
--transform "s|$(PACKAGE_FOLDER)|$(PACKAGE_NAME)|" \
43+
-cjf "$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.bz2" "$(PACKAGE_FOLDER)"
44+
@-$(RM) $(PACKAGE_FOLDER)/package_version.txt
45+
"$(MAKE)" PACKAGE_NAME=$(PACKAGE_NAME) PACKAGE_VERSION=$(PACKAGE_VERSION) PACKAGE_FOLDER="$(PACKAGE_FOLDER)" --no-builtin-rules postpackaging_core -C .
46+
@echo ----------------------------------------------------------
47+
48+
tools: PACKAGE_NAME := STM8Tools
49+
tools: PACKAGE_FOLDER := Arduino_Tools_STM8
50+
tools: PACKAGE_VERSION := $(shell git --git-dir=$(PACKAGE_FOLDER)/.git describe --tags)
51+
tools: PACKAGE_DATE := $(firstword $(shell git --git-dir=$(PACKAGE_FOLDER)/.git log -1 --pretty=format:%ci))
52+
tools: clean print_info
53+
@echo ----------------------------------------------------------
54+
@echo "Packaging $@..."
55+
@git --git-dir=$(PACKAGE_FOLDER)/.git show HEAD --pretty=short --no-patch > $(PACKAGE_FOLDER)/package_version.txt
56+
@tar --mtime='$(PACKAGE_DATE)' \
57+
--exclude=.git \
58+
--exclude=.gitattributes \
59+
--exclude=.github \
60+
--exclude=.gitignore \
61+
--transform "s|$(PACKAGE_FOLDER)|$(PACKAGE_NAME)/tools|" \
62+
-cjf "$(PACKAGE_NAME)-$(PACKAGE_VERSION)-windows.tar.bz2" "$(PACKAGE_FOLDER)"
63+
@-$(RM) $(PACKAGE_FOLDER)/package_version.txt
64+
"$(MAKE)" PACKAGE_NAME=$(PACKAGE_NAME) PACKAGE_VERSION=$(PACKAGE_VERSION) --no-builtin-rules postpackaging_tools -C .
65+
@echo ----------------------------------------------------------
66+
67+
clean:
68+
@echo ----------------------------------------------------------
69+
@echo Cleanup
70+
-$(RM) *.tar.bz2 package_*.json
71+
@echo ----------------------------------------------------------
72+
73+
print_info:
74+
@echo ----------------------------------------------------------
75+
@echo Building $(PACKAGE_NAME) using
76+
@echo "CURDIR = $(CURDIR)"
77+
@echo "OS = $(OS)"
78+
@echo "SHELL = $(SHELL)"
79+
@echo "PACKAGE_NAME = $(PACKAGE_NAME)"
80+
@echo "PACKAGE_FOLDER = $(PACKAGE_FOLDER)"
81+
@echo "PACKAGE_VERSION = $(PACKAGE_VERSION)"
82+
83+
postpackaging_core:
84+
@echo "PACKAGE_CHKSUM = $(PACKAGE_CHKSUM)"
85+
@echo "PACKAGE_SIZE = $(PACKAGE_SIZE)"
86+
@echo "PACKAGE_FILENAME = $(PACKAGE_FILENAME)"
87+
@BOARDS_LIST=`grep -E ".+\.name=" $(PACKAGE_FOLDER)/boards.txt | cut -d'=' -f2 | awk '{print " {\"name\": \""$$0"\"},"}'`; \
88+
BOARDS_LIST=$${BOARDS_LIST::-1}; \
89+
cat templates/package_core_index.json | sed s/%%VERSION%%/$(PACKAGE_VERSION)/ | sed s/%%FILENAME%%/$(PACKAGE_FILENAME)/ | sed s/%%CHECKSUM%%/$(PACKAGE_CHKSUM)/ | sed s/%%SIZE%%/$(PACKAGE_SIZE)/ | sed -e "s/%%BOARDSLIST%%/$${BOARDS_LIST//$$'\n'/\\n}/" > package_$(PACKAGE_NAME)_$(PACKAGE_VERSION)_index.json
90+
@mv $(PACKAGE_FILENAME) $(CORE_PATH)/
91+
@echo "package_$(PACKAGE_NAME)_$(PACKAGE_VERSION)_index.json created"
92+
93+
postpackaging_tools:
94+
@echo "PACKAGE_WIN_FILENAME = $(PACKAGE_WIN_FILENAME)"
95+
@echo "PACKAGE_WIN_SIZE = $(PACKAGE_WIN_SIZE)"
96+
@echo "PACKAGE_WIN_CHKSUM = $(PACKAGE_WIN_CHKSUM)"
97+
@cat templates/package_tools_index.json | sed s/%%PACKAGENAME%%/$(PACKAGE_NAME)/ | sed s/%%VERSION%%/$(PACKAGE_VERSION)/ | sed s/%%FILENAMEWIN%%/$(PACKAGE_WIN_FILENAME)/ | sed s/%%CHECKSUMWIN%%/$(PACKAGE_WIN_CHKSUM)/ | sed s/%%SIZEWIN%%/$(PACKAGE_WIN_SIZE)/ > package_$(PACKAGE_NAME)_$(PACKAGE_VERSION)_index.json
98+
@mv $(PACKAGE_WIN_FILENAME) $(TOOLS_PATH)/
99+
@echo "package_$(PACKAGE_NAME)_$(PACKAGE_VERSION)_index.json created"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "STM8 Cores",
3+
"architecture": "stm8",
4+
"version": "%%VERSION%%",
5+
"category": "Contributed",
6+
"url": "https://github.com/stm32duino/BoardManagerFiles/raw/master/STM8/packages/%%FILENAME%%",
7+
"archiveFileName": "%%FILENAME%%",
8+
"checksum": "SHA-256:%%CHECKSUM%%",
9+
"size": "%%SIZE%%",
10+
"boards": [
11+
%%BOARDSLIST%%
12+
],
13+
"toolsDependencies": [
14+
{
15+
"packager": "STM8",
16+
"name": "cxppstm8",
17+
"version": "4.1.1"
18+
},
19+
{
20+
"packager": "STM8",
21+
"name": "STM8Tools",
22+
"version": "1.0.2"
23+
}
24+
]
25+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "%%PACKAGENAME%%",
3+
"version": "%%VERSION%%",
4+
"systems":
5+
[
6+
{
7+
"host": "i686-mingw32",
8+
"url": "https://github.com/stm32duino/BoardManagerFiles/raw/master/STM8/tools/%%FILENAMEWIN%%",
9+
"archiveFileName": "%%FILENAMEWIN%%",
10+
"checksum": "SHA-256:%%CHECKSUMWIN%%",
11+
"size": "%%SIZEWIN%%"
12+
}
13+
]
14+
}

0 commit comments

Comments
 (0)