-
Notifications
You must be signed in to change notification settings - Fork 3
/
platform.txt
179 lines (147 loc) · 10 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
# Copyright (c) 2014-2015 Arduino LLC. All right reserved.
# Copyright (c) 2016 Sandeep Mistry All right reserved.
# Copyright (c) 2017 Adafruit Industries. All rights reserved.
# Copyright (c) 2020 Shenzhen RAKwireless Technology Co., Ltd. All rights 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=RAKwireless RUI nRF Modules
# 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 -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith
# Allow changing optimization settings via platform.local.txt / boards.local.txt
compiler.optimization_flag=-Os
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
compiler.c.cmd=arm-none-eabi-gcc
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD
compiler.c.elf.cmd=arm-none-eabi-gcc
compiler.c.elf.flags={compiler.optimization_flag} -Wl,--gc-sections -save-temps
compiler.S.cmd=arm-none-eabi-gcc
compiler.S.flags=-c -g -x assembler-with-cpp {compiler.warning_flags}
compiler.cpp.cmd=arm-none-eabi-g++
compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -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 --specs=nano.specs --specs=nosys.specs {build.flags.lib_path}
compiler.size.cmd=arm-none-eabi-size
# this can be overriden in boards.txt
build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float
build.debug_flags=-DCFG_DEBUG=0
build.logger_flags=-DCFG_LOGGER=1
build.sysview_flags=-DCFG_SYSVIEW=0
build.nfc_flag=-DCONFIG_NFCT_PINS_AS_GPIOS -USUPPORT_NFC
build.bg96_flag=-DAUTO_DISPLAY_CELLULAR_RESPONSE
build.support_at_flag=-DSUPPORT_AT
build.variant_h=variant.h
build.supportlora=
build.supportlora_p2p=
build.regionAS923=
build.regionAU915=
build.regionCN470=
build.regionCN779=
build.regionEU433=
build.regionEU868=
build.regionKR920=
build.regionIN865=
build.regionUS915=
build.regionRU864=
build.regionLA915=
# common compiler for nrf
rtos.path={build.core.path}/freertos
nordic.path={runtime.platform.path}/cores/nRF5/external/nRF5_SDK/nRF5_SDK_17.0.2_d674dde
lora.path={runtime.platform.path}/cores/{build.core}/external/lora
# build.logger_flags and build.sysview_flags and intentionally empty,
# to allow modification via a user's own boards.local.txt or platform.local.txt files.
build.flags.default= {compiler.optimization_flag} {build.flags.feature} {build.supportlora} {build.supportlora_p2p} {build.regionAS923} {build.regionAU915} {build.regionCN470} {build.regionCN779} {build.regionEU433} {build.regionEU868} {build.regionKR920} {build.regionIN865} {build.regionUS915} {build.regionRU864} {build.regionLA915} {build.debug_flags} {build.logger_flags} {build.sysview_flags} {build.flags.inc_path} {build.nfc_flag} {build.bg96_flag} {build.support_at_flag}
build.info.flags=-DVARIANT_H="{build.variant_h}"
build.info.flags=-D{build.series}
# usb flags
build.flags.usb= -DUSBCON -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
# These can be overridden in platform.local.txt
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
compiler.cpp.extra_flags= -DDEBUG
compiler.S.extra_flags=
compiler.ar.extra_flags=
compiler.libraries.ldflags=
compiler.elf2bin.extra_flags=
compiler.elf2hex.extra_flags=
# 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} -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.c.extra_flags} {build.extra_flags} {build.flags.default} {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} -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.default} {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} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.flags.default} {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{build.core.path}/component/core/soc/nrf52840" "-L{nordic.path}/modules/nrfx/mdk" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} {compiler.libraries.ldflags} -Wl,--start-group -lc -lm -lnosys -lstdc++ "{build.path}/{archive_file}" {build.flags.lib} -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"
recipe.hooks.objcopy.postobjcopy.1.pattern="{runtime.tools.pc-nrfutil.path}/nrfutil" settings generate --family NRF52840 --start-address 0xFF000 --application "{build.path}/{build.project_name}.hex" --application-version 1 --bootloader-version 3 --bl-settings-version 1 "{build.path}/settings.hex"
recipe.hooks.objcopy.postobjcopy.2.pattern="{runtime.tools.nrfjprog.path}/mergehex" -m "{build.path}/settings.hex" "{runtime.platform.path}/prebuilt/bootloader_nrf52840_{build.series}.hex" -o "{build.path}/bootloader_merge.hex"
recipe.hooks.objcopy.postobjcopy.3.pattern="{runtime.tools.nrfjprog.path}/mergehex" -m "{build.path}/bootloader_merge.hex" "{runtime.platform.path}/prebuilt/s140_nrf52_7.2.0_softdevice.hex" "{build.path}/{build.project_name}.hex" -o "{build.path}/{build.project_name}_full.hex"
## Create dfu package zip file
recipe.objcopy.zip.pattern="{runtime.tools.pc-nrfutil.path}/nrfutil" pkg generate --hw-version 52 --application-version 1 --application "{build.path}/{build.project_name}.hex" --sd-req {build.sd_fwid} --key-file "{runtime.platform.path}/security/private.key" "{build.path}/{build.project_name}.zip"
## 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_hexu={build.project_name}.save.hex
## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|)\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
tools.uploader.cmd="{runtime.tools.uploader.path}/uploader.py"
tools.uploader.cmd.windows="{runtime.tools.uploader.path}/uploader.exe"
tools.uploader.cmd.macosx=python3 "{runtime.tools.uploader.path}/uploader.py"
tools.uploader.upload.params.verbose=--verbose
tools.uploader.upload.params.quiet=
tools.uploader.upload.pattern={cmd} -f "{build.path}/{build.project_name}.zip" -p {serial.port} -t "{runtime.tools.pc-nrfutil.path}/nrfutil"
#***************************************************
# prebuild hooks for buildtime
#***************************************************
recipe.hooks.sketch.prebuild.1.pattern=python3 "{runtime.tools.buildtime.path}/buildtime.py" "{runtime.platform.path}/variants/{build.variant}/version.c"
recipe.hooks.sketch.prebuild.1.pattern.windows="{runtime.tools.buildtime.path}/buildtime.exe" "{runtime.platform.path}/variants/{build.variant}/version.c"
#***************************************************
# Burning bootloader with either jlink or nrfutil
#***************************************************
# Bootloader version
tools.bootburn.bootloader.file={runtime.platform.path}/prebuilt/bootloader.hex
tools.bootburn.bootloader.params.verbose=
tools.bootburn.bootloader.params.quiet=
tools.bootburn.bootloader.pattern={program.burn_pattern}
# erase flash page while programming
tools.bootburn.erase.params.verbose=
tools.bootburn.erase.params.quiet=
tools.bootburn.erase.pattern=
version=4.1.2