Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.

Commit 4693207

Browse files
fprVVESTM
authored andcommitted
Add platform.txt & boards.txt
Use STM8 compiler options and tools. Add first STM8 boards. Add a recipe to generate .bin file Hex file must be generated first as it is used as input to generate bin, that's why a number is to prefix recipe: 1hex 2bin Signed-off-by: Ridha Noomane <[email protected]> Signed-off-by: Frederic Pillon <[email protected]>
1 parent a740386 commit 4693207

File tree

2 files changed

+209
-0
lines changed

2 files changed

+209
-0
lines changed

boards.txt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# See: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
2+
3+
menu.xserial=Serial interface
4+
menu.upload_method=Upload Method
5+
6+
7+
################################################################################
8+
# Nucleo 8S Board
9+
10+
Nucleo_8S208RB.name=Nucleo_8S208RB
11+
12+
Nucleo_8S208RB.build.core=arduino
13+
Nucleo_8S208RB.build.board=Nucleo_8S208RB
14+
Nucleo_8S208RB.build.extra_flags=-d{build.product_line} {build.xSerial}
15+
16+
# Nucleo_8S208RB board
17+
# Support: Serial1 (USART1 on PA4, PA5) and Serial2 (USART2 on PD6, PD5)
18+
Nucleo_8S208RB=Nucleo 8S208RB
19+
Nucleo_8S208RB.device=STM8S208RB
20+
Nucleo_8S208RB.node=NODE_8S208
21+
Nucleo_8S208RB.upload.maximum_size=131072
22+
Nucleo_8S208RB.upload.maximum_data_size=6144
23+
Nucleo_8S208RB.build.mcu=8-bit
24+
Nucleo_8S208RB.build.board=Nucleo_8S208RB
25+
Nucleo_8S208RB.build.series=STM8Sxx
26+
Nucleo_8S208RB.build.splibraryPrefix=_StdPeriph_Driver
27+
Nucleo_8S208RB.build.product_line=STM8S208
28+
Nucleo_8S208RB.build.variant=NUCLEO_8S208RB
29+
Nucleo_8S208RB.build.f_cpu=16000000
30+
31+
Nucleo_8S208RB.menu.upload_method.MassStorage=Mass Storage
32+
Nucleo_8S208RB.menu.upload_method.MassStorage.upload.protocol=
33+
Nucleo_8S208RB.menu.upload_method.MassStorage.upload.tool=massStorageCopy
34+
35+
Nucleo_8S208RB.menu.upload_method.stm8Flasher=stm8Flasher
36+
Nucleo_8S208RB.menu.upload_method.stm8Flasher.upload.protocol=stm8Tools
37+
Nucleo_8S208RB.menu.upload_method.stm8Flasher.upload.tool=stm8Flasher
38+
################################################################################
39+
# Nucleo 8L Board
40+
41+
Nucleo_8L152R8.name=Nucleo_8L152R8
42+
43+
Nucleo_8L152R8.build.core=arduino
44+
Nucleo_8L152R8.build.board=Nucleo_8L152R8
45+
Nucleo_8L152R8.build.extra_flags=-d{build.product_line} {build.xSerial}
46+
47+
# NUCLEO_8L152R8 board
48+
# Support: Serial1 (USART1 on PA2, PA3), Serial2 (USART2 on PE3, PE4) and Serial3 (USART2 on PG0, PG1)
49+
Nucleo_8L152R8=Nucleo 8L152R8
50+
Nucleo_8L152R8.device=STM8L15xR8
51+
Nucleo_8L152R8.node=NODE_8L152
52+
Nucleo_8L152R8.upload.maximum_size=65536
53+
Nucleo_8L152R8.upload.maximum_data_size=4096
54+
Nucleo_8L152R8.build.mcu=8-bit
55+
Nucleo_8L152R8.build.board=Nucleo_8L152R8
56+
Nucleo_8L152R8.build.series=STM8Lxx
57+
Nucleo_8L152R8.build.splibraryPrefix=_StdPeriph_Driver
58+
Nucleo_8L152R8.build.product_line=STM8L15X_HD
59+
Nucleo_8L152R8.build.variant=NUCLEO_8L152R8
60+
Nucleo_8L152R8.build.f_cpu=16000000
61+
62+
Nucleo_8L152R8.menu.upload_method.MassStorage=Mass Storage
63+
Nucleo_8L152R8.menu.upload_method.MassStorage.upload.protocol=
64+
Nucleo_8L152R8.menu.upload_method.MassStorage.upload.tool=massStorageCopy
65+
66+
Nucleo_8L152R8.menu.upload_method.stm8Flasher=stm8Flasher
67+
Nucleo_8L152R8.menu.upload_method.stm8Flasher.upload.protocol=stm8Tools
68+
Nucleo_8L152R8.menu.upload_method.stm8Flasher.upload.tool=stm8Flasher
69+
70+
################################################################################
71+
# Serialx activation
72+
Nucleo_8S208RB.menu.xserial.generic=Enabled with generic Serial
73+
Nucleo_8S208RB.menu.xserial.none=Enabled without generic Serial
74+
Nucleo_8S208RB.menu.xserial.none.build.xSerial=-dHWSERIAL_NONE
75+
Nucleo_8S208RB.menu.xserial.disabled=Disabled (No Serial)
76+
Nucleo_8S208RB.menu.xserial.disabled.build.xSerial=-dNO_HWSERIAL
77+
78+
Nucleo_8L152R8.menu.xserial.generic=Enabled with generic Serial
79+
Nucleo_8L152R8.menu.xserial.none=Enabled without generic Serial
80+
Nucleo_8L152R8.menu.xserial.none.build.xSerial=-dHWSERIAL_NONE
81+
Nucleo_8L152R8.menu.xserial.disabled=Disabled (No Serial)
82+
Nucleo_8L152R8.menu.xserial.disabled.build.xSerial=-dNO_HWSERIAL

platform.txt

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
2+
# STM8 Core and platform.
3+
# ------------------------------
4+
#
5+
# For more info:
6+
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
7+
8+
name = STM8 Boards
9+
version=1.0.0
10+
11+
# STM compile variables
12+
# ----------------------
13+
compiler.stm.extra_include=-I "{build.source.path}" -I "{build.system.path}\Drivers\{build.series_path}" -I "{build.system.path}\Drivers\{build.series_path}\inc\" -I "{build.system.path}\Drivers\{build.series_path}\src\" -I "{build.core.path}\stm8\"
14+
15+
compiler.warning_flags=
16+
compiler.warning_flags.none=-pw
17+
compiler.warning_flags.default=-pw
18+
compiler.warning_flags.more=
19+
compiler.warning_flags.all=
20+
21+
compiler.path={runtime.tools.cxppstm8.path}\
22+
23+
compiler.c.cmd=cxppstm8.exe
24+
compiler.c.sm8.cmd=clnk.exe
25+
compiler.S.cmd=castm8.exe
26+
compiler.cpp.cmd=cxppstm8.exe
27+
compiler.ar.cmd=clib.exe
28+
compiler.sm82hex.cmd=chex.exe
29+
compiler.hex2bin.cmd=hex2bin.exe
30+
compiler.size.cmd=cmd.exe
31+
32+
compiler.libcpp={compiler.path}\lib
33+
34+
compiler.extra_flags=-gh -si -sd +proto +split
35+
36+
compiler.c.flags= {compiler.extra_flags} -I "{compiler.path}\hstm8" -I "{compiler.path}\hstm8++" {compiler.stm.extra_include}
37+
compiler.c.sm8.flags=
38+
compiler.S.flags=
39+
compiler.cpp.flags= {compiler.extra_flags} -I "{compiler.path}\hstm8++" -c"i{compiler.path}\hstm8" {compiler.stm.extra_include} {compiler.warning_flags}
40+
compiler.ar.flags=-e -r -p
41+
compiler.sm82hex.flags=-fi
42+
compiler.hex2bin.flags=-b
43+
compiler.ldflags=
44+
compiler.define=-dARDUINO=
45+
46+
system.path=C:\windows\system32\
47+
48+
# This can be overriden in boards.txt
49+
build.extra_flags=
50+
51+
# These can be overridden in platform.local.txt
52+
compiler.c.extra_flags=-d__arm__
53+
compiler.c.sm8.extra_flags=
54+
compiler.cpp.extra_flags=-d__arm__
55+
compiler.S.extra_flags=
56+
compiler.ar.extra_flags=
57+
compiler.sm82hex.extra_flags=
58+
59+
# USB Flags
60+
# ---------
61+
build.usb_flags=-dUSB_VID={build.vid} -dUSB_PID={build.pid} -dUSBCON '-dUSB_MANUFACTURER={build.usb_manufacturer}' '-dUSB_PRODUCT={build.usb_product}'
62+
63+
# Default usb manufacturer will be replaced at compile time using
64+
# numeric vendor ID if available or by board's specific value.
65+
build.usb_manufacturer="Unknown"
66+
# Define standard peripheral library path
67+
build.series_path={build.series}{build.splibraryPrefix}
68+
# Build information's
69+
build.info.flags=-d{build.series} -dF_CPU={build.f_cpu} -dARDUINO={runtime.ide.version} -dARDUINO_{build.board} -dARDUINO_ARCH_{build.arch} -dBOARD_NAME="{build.board}"
70+
71+
# Defaults config
72+
build.xSerial=
73+
74+
75+
# compile patterns
76+
# ---------------------
77+
78+
## Preprocessor
79+
# These must be kept empty to erase Arduino preprocessor flags
80+
preproc.includes.flags=
81+
recipe.preproc.includes=
82+
preproc.macros.flags=
83+
recipe.preproc.macros="{compiler.path}{compiler.cpp.cmd}" {preproc.macros.flags} {compiler.cpp.flags} {build.info.flags} {compiler.c.extra_flags} {build.extra_flags} {includes} -sp -o "{preprocessed_file_path}" "{source_file}"
84+
85+
## Compile c files
86+
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} {build.info.flags} {compiler.c.extra_flags} {build.extra_flags} -o "{object_file}" {includes} "{source_file}"
87+
88+
## Compile c++ files
89+
recipe.cpp.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpp.flags} {build.info.flags} {compiler.cpp.extra_flags} {build.extra_flags} -o "{object_file}" {includes} "{source_file}"
90+
91+
## Compile S files
92+
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} {build.info.flags} {compiler.S.extra_flags} {build.extra_flags} {includes} -o "{object_file}" "{source_file}"
93+
94+
## Create archives
95+
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
96+
97+
## Combine gc-sections, archives, and objects
98+
recipe.c.combine.pattern="{compiler.path}{compiler.c.sm8.cmd}" {compiler.c.sm8.flags} -o "{build.path}\{build.project_name}.sm8" -m "{build.path}\{build.project_name}.map" -l "{compiler.libcpp}" "{build.variant.path}\lkfscript.lkf" {object_files} "{archive_file_path}"
99+
100+
## Create output (.hex file)
101+
recipe.objcopy.1hex.pattern="{compiler.path}{compiler.sm82hex.cmd}" {compiler.sm82hex.flags} {compiler.sm82hex.extra_flags} -o "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.sm8"
102+
103+
## Create output (.bin file)
104+
recipe.objcopy.2bin.pattern="{runtime.tools.STM8Tools.path}/tools/win/{compiler.hex2bin.cmd}" {compiler.hex2bin.flags} "{build.path}/{build.project_name}.hex"
105+
106+
## Compute size
107+
recipe.size.pattern="{system.path}{compiler.size.cmd}" /C type "{build.path}\\{build.project_name}.map"
108+
recipe.size.regex=code:\s+([0-9]+)
109+
recipe.size.regex.data=data:\s+([0-9]+)
110+
111+
# Uploader tool
112+
# -------------------
113+
114+
#Upload via MassStorage
115+
tools.massStorageCopy.path={runtime.tools.STM8Tools.path}/tools/win
116+
tools.massStorageCopy.cmd.windows=massStorageCopy.bat
117+
tools.massStorageCopy.upload.params.verbose=
118+
tools.massStorageCopy.upload.params.quiet=
119+
tools.massStorageCopy.upload.pattern="{path}/{cmd}" {upload.verbose} -I "{build.path}/{build.project_name}.bin" -O "{node}"
120+
121+
#Upload via stm8Tools
122+
tools.stm8Flasher.path={runtime.tools.STM8Tools.path}/tools/win
123+
tools.stm8Flasher.cmd.windows=stm8Flasher.bat
124+
tools.stm8Flasher.upload.params.verbose=
125+
tools.stm8Flasher.upload.params.quiet=
126+
tools.stm8Flasher.upload.pattern="{path}/{cmd}" "{build.path}/{build.project_name}.hex" "{device}"
127+

0 commit comments

Comments
 (0)