forked from h2zero/n-able-Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
platform.txt
229 lines (182 loc) · 14.2 KB
/
platform.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# Copyright (c) 2014-2015 Arduino LLC. All right reserved.
# Copyright (c) 2016 Sandeep Mistry All right reserved.
# Copyright (c) 2021 Ryan Powell. All right reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
name=ARM (Nim)BLE Boards
version=0.1.0
# Compile variables
# -----------------
compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
compiler.path={runtime.tools.gcc-arm-none-eabi-9.3.1-1.path}/bin/
compiler.c.cmd=arm-none-eabi-gcc
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} {build.float_flags} -Wno-unused-parameter -Wno-sign-compare -Wno-old-style-declaration -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD
compiler.c.elf.cmd=arm-none-eabi-g++
compiler.c.elf.flags=-Os -Wl,--gc-sections -save-temps
compiler.S.cmd=arm-none-eabi-gcc
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=arm-none-eabi-g++
compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} {build.float_flags} -Wno-unused-parameter -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD
compiler.ar.cmd=arm-none-eabi-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=arm-none-eabi-objcopy
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
compiler.elf2bin.flags=-O binary
compiler.elf2bin.cmd=arm-none-eabi-objcopy
compiler.elf2hex.flags=-O ihex
compiler.elf2hex.cmd=arm-none-eabi-objcopy
compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align
compiler.size.cmd=arm-none-eabi-size
compiler.define=-DARDUINO=
# this can be overriden in boards.txt
build.extra_flags=
build.lfclk_flags=-DUSE_LFRC
build.dfu_pattern=echo Not building DFU package
build.bootloader.file=tools/none_bootloader.hex
build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
nrfutil.dfu_pattern="{tools.nrfutil.cmd}" pkg generate --hw-version 52 --debug-mode --sd-req 0 --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip"
adafruit-nrfutil.dfu_pattern="{tools.adafruit-nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip"
nordic.path={build.core.path}/nordic
compiler.nrf.flags=-DNRF5 -DARDUINO_ARCH_NRF5 "-I{build.core.path}/nimble_config" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{build.core.path}/CMSIS/Include" "-I{build.core.path}/FC_Store" "-I{build.core.path}/BLEBond_nvs" "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src"
# These can be overridden in platform.local.txt
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
compiler.cpp.extra_flags=
compiler.S.extra_flags=
compiler.ar.extra_flags=
compiler.elf2bin.extra_flags=
compiler.elf2hex.extra_flags=
# Custom build options
build.opt.name=build.opt
build.opt.path={build.path}/{build.opt.name}
# Check if custom build options exist in the sketch folder
recipe.hooks.prebuild.1.pattern=bash -c "[ ! -f "{build.source.path}"/build_opt.h ] || cp -f "{build.source.path}"/build_opt.h "{build.path}"/build.opt"
recipe.hooks.prebuild.2.pattern=bash -c "[ -f "{build.path}"/build.opt ] || touch "{build.path}"/build.opt"
recipe.hooks.prebuild.1.pattern.windows=cmd /c if exist "{build.source.path}\build_opt.h" COPY /y "{build.source.path}\build_opt.h" "{build.path}\build.opt"
recipe.hooks.prebuild.2.pattern.windows=cmd /c if not exist "{build.path}\build.opt" type nul > "{build.path}\build.opt"
# Compile patterns
# ----------------
## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} {compiler.c.extra_flags} {build.extra_flags} {compiler.nrf.flags} {build.lfclk_flags} "@{build.opt.path}" {includes} "{source_file}" -o "{object_file}"
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.nrf.flags} {build.lfclk_flags} "@{build.opt.path}" {includes} "{source_file}" -o "{object_file}"
## Compile S files
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} {compiler.S.extra_flags} {build.extra_flags} {build.lfclk_flags} "@{build.opt.path}" {includes} "{source_file}" -o "{object_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.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{nordic.path}/linker/" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group
## Create output (bin file)
recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
## Create output (hex file)
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
## Save bin
recipe.output.tmp_file_bin={build.project_name}.bin
recipe.output.save_file_bin={build.project_name}.save.bin
## Save hex
recipe.output.tmp_file_hex={build.project_name}.hex
recipe.output.save_file_hex={build.project_name}.save.hex
## Create dfu package zip file
recipe.objcopy.zip.pattern={build.dfu_pattern}
## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=\.text\s+([0-9]+).*
recipe.size.regex.data=(\.data|\.bss)\s+([0-9]+).*
## Export Compiled Binary
recipe.output.tmp_file={build.project_name}.hex
recipe.output.save_file={build.project_name}.{build.variant}.hex
#
# JLink sketch upload
#
tools.jlink.cmd=jlink_upload
tools.jlink.cmd.windows=jlink_upload.bat
tools.jlink.path={runtime.platform.path}/tools
tools.jlink.upload.params.verbose=-d
tools.jlink.upload.params.quiet=n
tools.jlink.upload.pattern="{path}/{cmd}" "{build.path}/{build.project_name}.bin" {upload.jlink_device}
tools.jlink.erase_cmd=JLinkExe
tools.jlink.erase_cmd.windows=JLink.exe
tools.jlink.erase.params.verbose=-d
tools.jlink.erase.params.quiet=-n
tools.jlink.erase.pattern={erase_cmd} -device {upload.jlink_device} -if SWD -speed auto -autoconnect 1 -NoGui 1 -CommanderScript "{runtime.platform.path}/tools/erase.jlink"
tools.jlink.bootloader.params.verbose=-d
tools.jlink.bootloader.params.quiet=n
tools.jlink.bootloader.pattern="{path}/{cmd}" "{runtime.platform.path}/{build.bootloader.file}" {upload.jlink_device}
#
# OpenOCD sketch upload
#
tools.openocd.path={runtime.tools.openocd-0.11.0-4.path}/bin/
tools.openocd.cmd=openocd
tools.openocd.cmd.windows=openocd.exe
tools.openocd.upload.params.verbose=-d2
tools.openocd.upload.params.quiet=-d0
tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -f interface/{upload.protocol}.cfg -c "{upload.setup_command}" -f target/{upload.target}.cfg -c "program {{build.path}/{build.project_name}.hex} verify reset; shutdown;"
tools.openocd.program.params.verbose=-d2
tools.openocd.program.params.quiet=-d0
tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} -f interface/{program.protocol}.cfg -c "{program.setup_command}" -f target/{upload.target}.cfg -c "program {{build.path}/{build.project_name}.hex} verify reset; shutdown;"
tools.openocd.erase.params.verbose=-d2
tools.openocd.erase.params.quiet=-d0
tools.openocd.erase.pattern="{path}/{cmd}" {bootloader.verbose} -f interface/{program.protocol}.cfg -c "{program.setup_command}" -f target/{upload.target}.cfg -c "init; halt; nrf5 mass_erase; reset; shutdown;"
tools.openocd.bootloader.params.verbose=-d2
tools.openocd.bootloader.params.quiet=-d0
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -f interface/{program.protocol}.cfg -c "{program.setup_command}" -f target/{upload.target}.cfg -c "init; halt; program {{runtime.platform.path}/{build.bootloader.file}} reset; shutdown;"
#
# blackmagic probe upload
#
tools.blackmagicprobe.path={runtime.tools.gcc-arm-none-eabi-9.3.1-1.path}/bin/
tools.blackmagicprobe.cmd=arm-none-eabi-gdb
tools.blackmagicprobe.upload.speed=230400
tools.blackmagicprobe.erase.params.verbose=
tools.blackmagicprobe.erase.params.quiet=-q --batch-silent
tools.blackmagicprobe.erase.pattern="{path}{cmd}" -quiet -ex "target extended-remote {serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "monitor erase mass" -ex "echo \nErase finished!\n" -ex "detach" -ex "quit"
tools.blackmagicprobe.erase.pattern.windows="{path}{cmd}" -quiet -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "monitor erase mass" -ex "echo \nErase finished!\n" -ex "detach" -ex "quit"
tools.blackmagicprobe.upload.params.verbose=
tools.blackmagicprobe.upload.params.quiet=-q --batch-silent
tools.blackmagicprobe.upload.pattern="{path}{cmd}" -quiet -cd "{build.path}" -b {upload.speed} -l 10 -ex "set debug remote 0" -ex "set target-async off" -ex "set remotetimeout 10" -ex "set mem inaccessible-by-default off" -ex "set confirm off" -ex "set height 0" -ex "target extended-remote {serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "file {build.project_name}.elf" -ex "load" -ex "tbreak main" -ex "run" -ex "echo \nUpload complete!\n" -ex "quit"
tools.blackmagicprobe.upload.pattern.windows="{path}{cmd}" -quiet -cd "{build.path}" -b {upload.speed} -l 10 -ex "set debug remote 0" -ex "set target-async off" -ex "set remotetimeout 10" -ex "set mem inaccessible-by-default off" -ex "set confirm off" -ex "set height 0" -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "file {build.project_name}.elf" -ex "load" -ex "tbreak main" -ex "run" -ex "echo \nUpload complete!\n" -ex "quit"
tools.blackmagicprobe.program.params.verbose=
tools.blackmagicprobe.program.params.quiet=-q --batch-silent
tools.blackmagicprobe.program.pattern="{path}{cmd}" -quiet -cd "{build.path}" -b {upload.speed} -l 10 -ex "set debug remote 0" -ex "set target-async off" -ex "set remotetimeout 10" -ex "set mem inaccessible-by-default off" -ex "set confirm off" -ex "set height 0" -ex "target extended-remote {serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "file {build.project_name}.elf" -ex "load" -ex "tbreak main" -ex "run" -ex "echo \nProgram complete!\n" -ex "quit"
tools.blackmagicprobe.program.pattern.windows="{path}{cmd}" -quiet -cd "{build.path}" -b {upload.speed} -l 10 -ex "set debug remote 0" -ex "set target-async off" -ex "set remotetimeout 10" -ex "set mem inaccessible-by-default off" -ex "set confirm off" -ex "set height 0" -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "file {build.project_name}.elf" -ex "load" -ex "tbreak main" -ex "run" -ex "echo \nProgram complete!\n" -ex "quit"
tools.blackmagicprobe.bootloader.params.verbose=
tools.blackmagicprobe.bootloader.params.quiet=-q --batch-silent
tools.blackmagicprobe.bootloader.pattern="{path}{cmd}" -quiet -ex "target extended-remote {serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "load {runtime.platform.path}/{build.bootloader.file}" -ex "echo \nBootloader flash complete!\n" -ex "detach" -ex "quit"
tools.blackmagicprobe.bootloader.pattern.windows="{path}{cmd}" -quiet -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex load {runtime.platform.path}\{build.bootloader.file} -ex "echo \nBootloader flash complete!\n" -ex "detach" -ex "quit"
#
# nrfutil upload
#
tools.nrfutil.cmd=nrfutil
tools.nrfutil.upload.params.verbose=
tools.nrfutil.upload.params.quiet=
tools.nrfutil.upload.pattern="{cmd}" dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200
tools.nrfutil.program.params.verbose=
tools.nrfutil.program.params.quiet=
tools.nrfutil.program.pattern="{cmd}" dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200
#***************************************************
# adafruit-nrfutil for uploading
# https://github.com/adafruit/Adafruit_nRF52_nrfutil
# pre-built binaries are provided for macos and windows
#***************************************************
tools.adafruit-nrfutil.cmd=adafruit-nrfutil
tools.adafruit-nrfutil.upload.params.verbose=--verbose
tools.adafruit-nrfutil.upload.params.quiet=
tools.adafruit-nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank
tools.adafruit-nrfutil.program.params.verbose=--verbose
tools.adafruit-nrfutil.program.params.quiet=
tools.adafruit-nrfutil.program.pattern="{cmd}" {program.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank