|
| 1 | +name=Adafruit nRF52 Boards |
| 2 | +version=0.19.0 |
| 3 | + |
| 4 | +# Compile variables |
| 5 | +# ----------------- |
| 6 | + |
| 7 | +compiler.warning_flags=-w |
| 8 | +compiler.warning_flags.none=-w |
| 9 | +compiler.warning_flags.default= |
| 10 | +compiler.warning_flags.more=-Wall |
| 11 | +compiler.warning_flags.all=-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith |
| 12 | + |
| 13 | +compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/ |
| 14 | +compiler.c.cmd=arm-none-eabi-gcc |
| 15 | +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 |
| 16 | +compiler.c.elf.cmd=arm-none-eabi-gcc |
| 17 | +compiler.c.elf.flags=-Ofast -Wl,--gc-sections -save-temps |
| 18 | +compiler.S.cmd=arm-none-eabi-gcc |
| 19 | +compiler.S.flags=-c -g -x assembler-with-cpp |
| 20 | +compiler.cpp.cmd=arm-none-eabi-g++ |
| 21 | +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 |
| 22 | +compiler.ar.cmd=arm-none-eabi-ar |
| 23 | +compiler.ar.flags=rcs |
| 24 | +compiler.objcopy.cmd=arm-none-eabi-objcopy |
| 25 | +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 |
| 26 | +compiler.elf2bin.flags=-O binary |
| 27 | +compiler.elf2bin.cmd=arm-none-eabi-objcopy |
| 28 | +compiler.elf2hex.flags=-O ihex |
| 29 | +compiler.elf2hex.cmd=arm-none-eabi-objcopy |
| 30 | +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 --specs=nano.specs --specs=nosys.specs |
| 31 | +compiler.size.cmd=arm-none-eabi-size |
| 32 | + |
| 33 | +# this can be overriden in boards.txt |
| 34 | +build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float |
| 35 | +build.debug_flags=-DCFG_DEBUG=0 |
| 36 | +build.logger_flags=-DCFG_LOGGER=1 |
| 37 | +build.sysview_flags=-DCFG_SYSVIEW=0 |
| 38 | + |
| 39 | +# common compiler for nrf |
| 40 | +rtos.path={build.core.path}/freertos |
| 41 | +nordic.path={build.core.path}/nordic |
| 42 | + |
| 43 | +# build.logger_flags and build.sysview_flags and intentionally empty, |
| 44 | +# to allow modification via a user's own boards.local.txt or platform.local.txt files. |
| 45 | +build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DLFS_NAME_MAX=64 -Ofast {build.debug_flags} {build.logger_flags} {build.sysview_flags} "-I{build.core.path}/cmsis/include" "-I{nordic.path}" "-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{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src" |
| 46 | + |
| 47 | +# usb flags |
| 48 | +build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' |
| 49 | + |
| 50 | +# These can be overridden in platform.local.txt |
| 51 | +compiler.c.extra_flags= |
| 52 | +compiler.c.elf.extra_flags= |
| 53 | +compiler.cpp.extra_flags= |
| 54 | +compiler.S.extra_flags= |
| 55 | +compiler.ar.extra_flags= |
| 56 | +compiler.elf2bin.extra_flags= |
| 57 | +compiler.elf2hex.extra_flags= |
| 58 | + |
| 59 | + |
| 60 | +# Compile patterns |
| 61 | +# ---------------- |
| 62 | + |
| 63 | +## Compile c files |
| 64 | +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.nrf} {includes} "{source_file}" -o "{object_file}" |
| 65 | + |
| 66 | +## Compile c++ files |
| 67 | +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.nrf} {includes} "{source_file}" -o "{object_file}" |
| 68 | + |
| 69 | +## Compile S files |
| 70 | +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.nrf} {includes} "{source_file}" -o "{object_file}" |
| 71 | + |
| 72 | +## Create archives |
| 73 | +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" |
| 74 | + |
| 75 | +## Combine gc-sections, archives, and objects |
| 76 | +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}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group -lm "{build.path}/{archive_file}" -Wl,--end-group |
| 77 | + |
| 78 | +## Create output (bin file) |
| 79 | +#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" |
| 80 | + |
| 81 | +## Create output (hex file) |
| 82 | +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" |
| 83 | + |
| 84 | +## Create dfu package zip file |
| 85 | +recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip" |
| 86 | + |
| 87 | +## Create uf2 file |
| 88 | +#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" |
| 89 | + |
| 90 | +## Save bin |
| 91 | +recipe.output.tmp_file_bin={build.project_name}.bin |
| 92 | +recipe.output.save_file_bin={build.project_name}.save.bin |
| 93 | + |
| 94 | +## Save hex |
| 95 | +recipe.output.tmp_file_hex={build.project_name}.hex |
| 96 | +recipe.output.save_file_hexu={build.project_name}.save.hex |
| 97 | + |
| 98 | +## Compute size |
| 99 | +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" |
| 100 | +recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* |
| 101 | +recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* |
| 102 | + |
| 103 | +## Export Compiled Binary |
| 104 | +recipe.output.tmp_file={build.project_name}.hex |
| 105 | +recipe.output.save_file={build.project_name}.{build.variant}.hex |
| 106 | + |
| 107 | +#*************************************************** |
| 108 | +# adafruit-nrfutil for uploading |
| 109 | +# https://github.com/adafruit/Adafruit_nRF52_nrfutil |
| 110 | +# pre-built binaries are provided for macos and windows |
| 111 | +#*************************************************** |
| 112 | +tools.nrfutil.cmd=adafruit-nrfutil |
| 113 | +tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe |
| 114 | +tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil |
| 115 | + |
| 116 | +tools.nrfutil.upload.params.verbose=--verbose |
| 117 | +tools.nrfutil.upload.params.quiet= |
| 118 | +tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank |
| 119 | + |
| 120 | +#*************************************************** |
| 121 | +# Burning bootloader with either jlink or nrfutil |
| 122 | +#*************************************************** |
| 123 | + |
| 124 | +# Bootloader version |
| 125 | +tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.3.2_{build.sd_name}_{build.sd_version} |
| 126 | + |
| 127 | +tools.bootburn.bootloader.params.verbose= |
| 128 | +tools.bootburn.bootloader.params.quiet= |
| 129 | +tools.bootburn.bootloader.pattern={program.burn_pattern} |
| 130 | + |
| 131 | +# erase flash page while programming |
| 132 | +tools.bootburn.erase.params.verbose= |
| 133 | +tools.bootburn.erase.params.quiet= |
| 134 | +tools.bootburn.erase.pattern= |
0 commit comments