|
| 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