|
| 1 | + |
| 2 | +# Arduino AVR 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 Testboards |
| 9 | +version=1.6.15 |
| 10 | + |
| 11 | +# AVR compile variables |
| 12 | +# --------------------- |
| 13 | + |
| 14 | +compiler.warning_flags= |
| 15 | +compiler.warning_flags.none=--less-pedantic |
| 16 | +compiler.warning_flags.default= |
| 17 | +compiler.warning_flags.more=-Wall |
| 18 | +compiler.warning_flags.all=-Wall -Wextra |
| 19 | + |
| 20 | +# Default "compiler.path" is correct, change only if you want to override the initial value |
| 21 | +compiler.path={runtime.hardware.path}/tools/sdcc/bin/ |
| 22 | +compiler.tools.path=/usr/bin/ |
| 23 | +#compiler.tools.path={runtime.hardware.path}/tools/bin/ |
| 24 | +compiler.path.emu={runtime.hardware.path}/tools/linux/ |
| 25 | +compiler.path.emu.windows={runtime.hardware.path}/tools/win/ |
| 26 | +compiler.path.emu.macos={runtime.hardware.path}/tools/macos/ |
| 27 | +#/home/mmayer/stm8/abuild/ |
| 28 | + |
| 29 | +compiler.c.cmd=sdcc-pseudo-g++ |
| 30 | +compiler.c.cmd.windows=sdcc-pseudo-g++.bat |
| 31 | +compiler.c.flags=-c -Ddouble=float -D__PROG_TYPES_COMPAT__ {compiler.warning_flags} |
| 32 | +compiler.c.elf.flags=--code-size {upload.maximum_size} --iram-size {upload.maximum_data_size} |
| 33 | + |
| 34 | +compiler.c.elf.cmd=sdcc-link |
| 35 | +compiler.c.elf.cmd.windows=sdcc-link.bat |
| 36 | +compiler.S.flags=-c -g -x assembler-with-cpp -flto |
| 37 | + |
| 38 | +compiler.cpp.cmd=sdcc-pseudo-g++ |
| 39 | +compiler.cpp.cmd.windows=sdcc-pseudo-g++.bat |
| 40 | +compiler.cpp.flags=-c -Ddouble=float -D__PROG_TYPES_COMPAT__ {compiler.warning_flags} |
| 41 | + |
| 42 | +compiler.ar.cmd=sdar |
| 43 | +compiler.ar.cmd.windows=sdar.exe |
| 44 | +compiler.ar.flags=rcs |
| 45 | + |
| 46 | +compiler.objcopy.cmd=objcopy |
| 47 | +#compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 |
| 48 | +#compiler.objcopy.eep.flags=-O ihex -j EEPROM EEPROM=0 |
| 49 | + |
| 50 | +compiler.elf2hex.cmd=objcopy |
| 51 | +compiler.elf2hex.flags=-O ihex -R DATA -R INITIALIZED -R SSEG |
| 52 | + |
| 53 | +compiler.syslibs.stdlib.path={runtime.hardware.path}/tools/sdcc/share/sdcc/ |
| 54 | +compiler.syslibs.spl.path={runtime.platform.path}/STM8S_StdPeriph_Driver/ |
| 55 | + |
| 56 | +compiler.ldflags= |
| 57 | +#compiler.ld.stdlib=lib/stm8/ |
| 58 | + |
| 59 | +compiler.size.cmd=size |
| 60 | +compiler.size.cmd.windows=size.exe |
| 61 | + |
| 62 | +# Meine Ergänzungen, müssen irgendwie automatisiert werden: |
| 63 | +#compiler.systemincludes=-I/home/mmayer/rsync/stm8/STM8S_StdPeriph_Driver/inc -I/opt/sdcc/share/sdcc/include |
| 64 | +#compiler.systemincludes=-I/home/mmayer/rsync/stm8/STM8S_StdPeriph_Driver/inc "-I{runtime.hardware.path}/tools/sdcc/share/sdcc/include" |
| 65 | +#compiler.systemincludes="-I{runtime.platform.path}/STM8S_StdPeriph_Driver/inc" "-I{runtime.hardware.path}/tools/sdcc/share/sdcc/include" |
| 66 | +compiler.systemincludes="-I{compiler.syslibs.spl.path}inc" "-I{compiler.syslibs.stdlib.path}include" |
| 67 | + |
| 68 | +# This can be overridden in boards.txt |
| 69 | +build.extra_flags= |
| 70 | + |
| 71 | +# These can be overridden in platform.local.txt |
| 72 | +compiler.c.extra_flags= |
| 73 | +compiler.c.elf.extra_flags= |
| 74 | +compiler.S.extra_flags= |
| 75 | +compiler.cpp.extra_flags= |
| 76 | +compiler.ar.extra_flags= |
| 77 | +compiler.objcopy.eep.extra_flags= |
| 78 | +compiler.elf2hex.extra_flags= |
| 79 | + |
| 80 | +# AVR compile patterns |
| 81 | +# -------------------- |
| 82 | + |
| 83 | +## Compile c files (re1) |
| 84 | +#recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" re1 {compiler.c.flags} -mstm8 -D{build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" |
| 85 | +recipe.c.o.pattern="{compiler.path.emu}{compiler.c.cmd}" "{source_file}" "{object_file}" re2 "-Wp-MMD {object_file}.d" {compiler.c.flags} -mstm8 -D{build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} {compiler.systemincludes} |
| 86 | + |
| 87 | +## Compile c++ files (re2) |
| 88 | +#recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" re2 {compiler.cpp.flags} -mstm8 -D{build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" |
| 89 | +recipe.cpp.o.pattern="{compiler.path.emu}{compiler.cpp.cmd}" "{source_file}" "{object_file}" re2 "-Wp-MMD {object_file}.d" {compiler.cpp.flags} -mstm8 -D{build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} {compiler.systemincludes} |
| 90 | + |
| 91 | +# Soll-Aufruf .c.o: |
| 92 | +#/opt/sdcc/bin/sdcc "-Wp-MMD build-stm8sblue/Blink.c.d" -c -Ddouble=float -I. |
| 93 | +#-I/home/mmayer/rsync/stm8/sduino/../STM8S_StdPeriph_Driver/inc |
| 94 | +#-I/opt/sdcc/share/sdcc/include/ -mstm8 -DSTM8S103 -DF_CPU=16000000L |
| 95 | +#-DARDUINO=160 -DARDUINO_ARCH_STM8 -D__PROG_TYPES_COMPAT__ |
| 96 | +#-I/home/mmayer/rsync/stm8/sduino/hardware/sduino/stm8/cores/sduino |
| 97 | +#-I/home/mmayer/rsync/stm8/sduino/hardware/sduino/stm8/variants/standard |
| 98 | +#Blink.c -o build-stm8sblue/Blink.c.rel |
| 99 | + |
| 100 | +##FIXME Compile S files |
| 101 | +recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" re3 {compiler.S.flags} -mstm8 -D{build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" |
| 102 | + |
| 103 | +## Create archives (re4) |
| 104 | +# archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value |
| 105 | +archive_file_path={build.path}/{archive_file} |
| 106 | +#recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" |
| 107 | +recipe.ar.pattern="{compiler.path.emu}{compiler.ar.cmd}" "{archive_file_path}" "{object_file}" re4 {compiler.ar.flags} {compiler.ar.extra_flags} |
| 108 | + |
| 109 | +## Combine gc-sections, archives, and objects (re5) |
| 110 | +#recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" re5 {compiler.c.elf.flags} -mstm8 -D{build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm |
| 111 | +# produziert ihx: |
| 112 | +#recipe.c.combine.pattern="{compiler.path.emu}{compiler.c.elf.cmd}" "-L{runtime.platform.path}/STM8S_StdPeriph_Driver/lib" "-L{build.path}" "-L{compiler.ld.stdlib}" {compiler.c.elf.flags} -mstm8 -D{build.mcu} {compiler.c.elf.extra_flags} {object_files} "{build.path}/{archive_file}" "{build.path}/core/main.c.rel" -l{build.mcu} -lstm8 -o "{build.path}/{build.project_name}.ihx" |
| 113 | +# produziert elf: |
| 114 | +#recipe.c.combine.pattern="{compiler.path.emu}{compiler.c.elf.cmd}" "-L{runtime.platform.path}/STM8S_StdPeriph_Driver/lib" "-L{build.path}" "-L{compiler.ld.stdlib}" {compiler.c.elf.flags} -mstm8 -D{build.mcu} {compiler.c.elf.extra_flags} {object_files} "{build.path}/{archive_file}" "{build.path}/core/main.c.rel" -l{build.mcu} -lstm8 --out-fmt-elf -o "{build.path}/{build.project_name}.elf" |
| 115 | +recipe.c.combine.pattern="{compiler.path.emu}{compiler.c.elf.cmd}" "-L{compiler.syslibs.spl.path}lib" "-L{build.path}" "-L{compiler.syslibs.stdlib.path}lib/stm8" {compiler.c.elf.flags} -mstm8 -D{build.mcu} {compiler.c.elf.extra_flags} {object_files} "{build.path}/{archive_file}" "{build.path}/core/main.c.rel" -l{build.mcu} -lstm8 --out-fmt-elf -o "{build.path}/{build.project_name}.elf" |
| 116 | + |
| 117 | +# Soll-Wert: |
| 118 | +#/opt/sdcc/bin/sdcc |
| 119 | +# -L /home/mmayer/rsync/stm8/sduino/../STM8S_StdPeriph_Driver/lib |
| 120 | +# -L/opt/sdcc/share/sdcc/lib/stm8 |
| 121 | +# -mstm8 -DSTM8S103 |
| 122 | +# build-stm8sblue/Blink.c.rel build-stm8sblue/libcore.lib \ |
| 123 | +# build-stm8sblue/core/main.c.rel \ |
| 124 | +# -lSTM8S103 -lstm8 -o build-stm8sblue/Blink.ihx |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | +## Create output files (.eep and .hex) |
| 129 | +#recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" re6 {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep" |
| 130 | +#recipe.objcopy.eep.pattern="{compiler.tools.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep" |
| 131 | +#recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" re7 {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" |
| 132 | +recipe.objcopy.hex.pattern="{compiler.tools.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" |
| 133 | + |
| 134 | +## Save hex |
| 135 | +recipe.output.tmp_file={build.project_name}.hex |
| 136 | +recipe.output.save_file={build.project_name}.{build.variant}.hex |
| 137 | + |
| 138 | +## Compute size |
| 139 | +#recipe.size.pattern="{compiler.path}{compiler.size.cmd}" re10 -A "{build.path}/{build.project_name}.elf" |
| 140 | +recipe.size.pattern="{compiler.tools.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" |
| 141 | +#recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).* |
| 142 | +#recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).* |
| 143 | +#recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).* |
| 144 | +# flash usage = HOME + GSINIT + GSFINAL + CODE + INITIALIZER |
| 145 | +# RAM usage = DATA + INITIALIZED |
| 146 | +recipe.size.regex=^(?:HOME|GSINIT|GSFINAL|CODE|INITIALIZER)\s+([0-9]+).* |
| 147 | +recipe.size.regex.data=^(?:DATA|INITIALIZED)\s+([0-9]+).* |
| 148 | +recipe.size.regex.eeprom=^(?:EEPROM)\s+([0-9]+).* |
| 149 | + |
| 150 | +## Preprocessor |
| 151 | +#preproc.includes.flags=-w -x c++ -M -MG -MP |
| 152 | +preproc.includes.flags=-M -MG -MP |
| 153 | +recipe.preproc.includes="{compiler.path.emu}{compiler.cpp.cmd}" re11 {compiler.cpp.flags} {preproc.includes.flags} -mstm8 -D{build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" |
| 154 | + |
| 155 | +#preproc.macros.flags=-w -x c++ -E -CC |
| 156 | +preproc.macros.flags=-E -MC |
| 157 | +#recipe.preproc.macros="{compiler.path}{compiler.cpp.cmd}" re12 {compiler.cpp.flags} {preproc.macros.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{preprocessed_file_path}" |
| 158 | +#recipe.preproc.macros="avr-g++" {compiler.cpp.flags} {preproc.macros.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{preprocessed_file_path}" |
| 159 | +#recipe.preproc.macros="{compiler.path}{compiler.cpp.cmd}" re12 {compiler.cpp.flags} {preproc.macros.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{preprocessed_file_path}" |
| 160 | +recipe.preproc.macros="{compiler.path.emu}{compiler.cpp.cmd}" "{source_file}" "{preprocessed_file_path}" re12 {compiler.cpp.flags} {preproc.macros.flags} -mstm8 -D{build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} {compiler.systemincludes} |
| 161 | + |
| 162 | + |
| 163 | +# STlink/v2 Uploader |
| 164 | +# ------------------ |
| 165 | + |
| 166 | +tools.stm8flash.cmd=stm8flash |
| 167 | +tools.stm8flash.cmd.windows=stm8flash.exe |
| 168 | +tools.stm8flash.path={runtime.hardware.path}/tools/win |
| 169 | +tools.stm8flash.path.macosx={runtime.hardware.path}/tools/macosx |
| 170 | +tools.stm8flash.path.linux={runtime.hardware.path}/tools/linux |
| 171 | +#tools.stm8flash.path.linux64={runtime.hardware.path}/tools/linux64 |
| 172 | + |
| 173 | +#tools.stm8flash.upload.params.verify= |
| 174 | +tools.stm8flash.upload.params.verbose= |
| 175 | +tools.stm8flash.upload.params.quiet= |
| 176 | +tools.stm8flash.upload.pattern="{path}/{cmd}" -c{upload.protocol} -p{upload.mcu} -s flash -w "{build.path}/{build.project_name}.hex" |
| 177 | +# -cstlinkv2 -pstm8s103?3 -s flash -w build-stm8sblue/Blink.ihx |
| 178 | +#"-C{config.path}" {upload.verbose} {upload.verify} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i" |
0 commit comments