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

Commit

Permalink
Add platform.txt & boards.txt
Browse files Browse the repository at this point in the history
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 <ridha.noomane@wi6labs.com>
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
  • Loading branch information
fpr authored and VVESTM committed Sep 11, 2018
1 parent a740386 commit 4693207
Show file tree
Hide file tree
Showing 2 changed files with 209 additions and 0 deletions.
82 changes: 82 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# See: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification

menu.xserial=Serial interface
menu.upload_method=Upload Method


################################################################################
# Nucleo 8S Board

Nucleo_8S208RB.name=Nucleo_8S208RB

Nucleo_8S208RB.build.core=arduino
Nucleo_8S208RB.build.board=Nucleo_8S208RB
Nucleo_8S208RB.build.extra_flags=-d{build.product_line} {build.xSerial}

# Nucleo_8S208RB board
# Support: Serial1 (USART1 on PA4, PA5) and Serial2 (USART2 on PD6, PD5)
Nucleo_8S208RB=Nucleo 8S208RB
Nucleo_8S208RB.device=STM8S208RB
Nucleo_8S208RB.node=NODE_8S208
Nucleo_8S208RB.upload.maximum_size=131072
Nucleo_8S208RB.upload.maximum_data_size=6144
Nucleo_8S208RB.build.mcu=8-bit
Nucleo_8S208RB.build.board=Nucleo_8S208RB
Nucleo_8S208RB.build.series=STM8Sxx
Nucleo_8S208RB.build.splibraryPrefix=_StdPeriph_Driver
Nucleo_8S208RB.build.product_line=STM8S208
Nucleo_8S208RB.build.variant=NUCLEO_8S208RB
Nucleo_8S208RB.build.f_cpu=16000000

Nucleo_8S208RB.menu.upload_method.MassStorage=Mass Storage
Nucleo_8S208RB.menu.upload_method.MassStorage.upload.protocol=
Nucleo_8S208RB.menu.upload_method.MassStorage.upload.tool=massStorageCopy

Nucleo_8S208RB.menu.upload_method.stm8Flasher=stm8Flasher
Nucleo_8S208RB.menu.upload_method.stm8Flasher.upload.protocol=stm8Tools
Nucleo_8S208RB.menu.upload_method.stm8Flasher.upload.tool=stm8Flasher
################################################################################
# Nucleo 8L Board

Nucleo_8L152R8.name=Nucleo_8L152R8

Nucleo_8L152R8.build.core=arduino
Nucleo_8L152R8.build.board=Nucleo_8L152R8
Nucleo_8L152R8.build.extra_flags=-d{build.product_line} {build.xSerial}

# NUCLEO_8L152R8 board
# Support: Serial1 (USART1 on PA2, PA3), Serial2 (USART2 on PE3, PE4) and Serial3 (USART2 on PG0, PG1)
Nucleo_8L152R8=Nucleo 8L152R8
Nucleo_8L152R8.device=STM8L15xR8
Nucleo_8L152R8.node=NODE_8L152
Nucleo_8L152R8.upload.maximum_size=65536
Nucleo_8L152R8.upload.maximum_data_size=4096
Nucleo_8L152R8.build.mcu=8-bit
Nucleo_8L152R8.build.board=Nucleo_8L152R8
Nucleo_8L152R8.build.series=STM8Lxx
Nucleo_8L152R8.build.splibraryPrefix=_StdPeriph_Driver
Nucleo_8L152R8.build.product_line=STM8L15X_HD
Nucleo_8L152R8.build.variant=NUCLEO_8L152R8
Nucleo_8L152R8.build.f_cpu=16000000

Nucleo_8L152R8.menu.upload_method.MassStorage=Mass Storage
Nucleo_8L152R8.menu.upload_method.MassStorage.upload.protocol=
Nucleo_8L152R8.menu.upload_method.MassStorage.upload.tool=massStorageCopy

Nucleo_8L152R8.menu.upload_method.stm8Flasher=stm8Flasher
Nucleo_8L152R8.menu.upload_method.stm8Flasher.upload.protocol=stm8Tools
Nucleo_8L152R8.menu.upload_method.stm8Flasher.upload.tool=stm8Flasher

################################################################################
# Serialx activation
Nucleo_8S208RB.menu.xserial.generic=Enabled with generic Serial
Nucleo_8S208RB.menu.xserial.none=Enabled without generic Serial
Nucleo_8S208RB.menu.xserial.none.build.xSerial=-dHWSERIAL_NONE
Nucleo_8S208RB.menu.xserial.disabled=Disabled (No Serial)
Nucleo_8S208RB.menu.xserial.disabled.build.xSerial=-dNO_HWSERIAL

Nucleo_8L152R8.menu.xserial.generic=Enabled with generic Serial
Nucleo_8L152R8.menu.xserial.none=Enabled without generic Serial
Nucleo_8L152R8.menu.xserial.none.build.xSerial=-dHWSERIAL_NONE
Nucleo_8L152R8.menu.xserial.disabled=Disabled (No Serial)
Nucleo_8L152R8.menu.xserial.disabled.build.xSerial=-dNO_HWSERIAL
127 changes: 127 additions & 0 deletions platform.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@

# STM8 Core and platform.
# ------------------------------
#
# For more info:
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification

name = STM8 Boards
version=1.0.0

# STM compile variables
# ----------------------
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\"

compiler.warning_flags=
compiler.warning_flags.none=-pw
compiler.warning_flags.default=-pw
compiler.warning_flags.more=
compiler.warning_flags.all=

compiler.path={runtime.tools.cxppstm8.path}\

compiler.c.cmd=cxppstm8.exe
compiler.c.sm8.cmd=clnk.exe
compiler.S.cmd=castm8.exe
compiler.cpp.cmd=cxppstm8.exe
compiler.ar.cmd=clib.exe
compiler.sm82hex.cmd=chex.exe
compiler.hex2bin.cmd=hex2bin.exe
compiler.size.cmd=cmd.exe

compiler.libcpp={compiler.path}\lib

compiler.extra_flags=-gh -si -sd +proto +split

compiler.c.flags= {compiler.extra_flags} -I "{compiler.path}\hstm8" -I "{compiler.path}\hstm8++" {compiler.stm.extra_include}
compiler.c.sm8.flags=
compiler.S.flags=
compiler.cpp.flags= {compiler.extra_flags} -I "{compiler.path}\hstm8++" -c"i{compiler.path}\hstm8" {compiler.stm.extra_include} {compiler.warning_flags}
compiler.ar.flags=-e -r -p
compiler.sm82hex.flags=-fi
compiler.hex2bin.flags=-b
compiler.ldflags=
compiler.define=-dARDUINO=

system.path=C:\windows\system32\

# This can be overriden in boards.txt
build.extra_flags=

# These can be overridden in platform.local.txt
compiler.c.extra_flags=-d__arm__
compiler.c.sm8.extra_flags=
compiler.cpp.extra_flags=-d__arm__
compiler.S.extra_flags=
compiler.ar.extra_flags=
compiler.sm82hex.extra_flags=

# USB Flags
# ---------
build.usb_flags=-dUSB_VID={build.vid} -dUSB_PID={build.pid} -dUSBCON '-dUSB_MANUFACTURER={build.usb_manufacturer}' '-dUSB_PRODUCT={build.usb_product}'

# Default usb manufacturer will be replaced at compile time using
# numeric vendor ID if available or by board's specific value.
build.usb_manufacturer="Unknown"
# Define standard peripheral library path
build.series_path={build.series}{build.splibraryPrefix}
# Build information's
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}"

# Defaults config
build.xSerial=


# compile patterns
# ---------------------

## Preprocessor
# These must be kept empty to erase Arduino preprocessor flags
preproc.includes.flags=
recipe.preproc.includes=
preproc.macros.flags=
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}"

## Compile c files
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}"

## Compile c++ files
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}"

## Compile S files
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}"

## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"

## Combine gc-sections, archives, and objects
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}"

## Create output (.hex file)
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"

## Create output (.bin file)
recipe.objcopy.2bin.pattern="{runtime.tools.STM8Tools.path}/tools/win/{compiler.hex2bin.cmd}" {compiler.hex2bin.flags} "{build.path}/{build.project_name}.hex"

## Compute size
recipe.size.pattern="{system.path}{compiler.size.cmd}" /C type "{build.path}\\{build.project_name}.map"
recipe.size.regex=code:\s+([0-9]+)
recipe.size.regex.data=data:\s+([0-9]+)

# Uploader tool
# -------------------

#Upload via MassStorage
tools.massStorageCopy.path={runtime.tools.STM8Tools.path}/tools/win
tools.massStorageCopy.cmd.windows=massStorageCopy.bat
tools.massStorageCopy.upload.params.verbose=
tools.massStorageCopy.upload.params.quiet=
tools.massStorageCopy.upload.pattern="{path}/{cmd}" {upload.verbose} -I "{build.path}/{build.project_name}.bin" -O "{node}"

#Upload via stm8Tools
tools.stm8Flasher.path={runtime.tools.STM8Tools.path}/tools/win
tools.stm8Flasher.cmd.windows=stm8Flasher.bat
tools.stm8Flasher.upload.params.verbose=
tools.stm8Flasher.upload.params.quiet=
tools.stm8Flasher.upload.pattern="{path}/{cmd}" "{build.path}/{build.project_name}.hex" "{device}"

0 comments on commit 4693207

Please sign in to comment.