203 lines
12 KiB
Text
203 lines
12 KiB
Text
# Copyright (c) 2021 Earle F. Philhower, III
|
|
#
|
|
# Raspberry Pi RP2040 Core platform file
|
|
#
|
|
# 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
|
|
|
|
# For more info:
|
|
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
|
|
|
|
name=Raspberry Pi RP2040 Boards
|
|
version=2.6.2
|
|
|
|
runtime.tools.pqt-gcc.path={runtime.platform.path}/system/arm-none-eabi
|
|
runtime.tools.pqt-python3.path={runtime.platform.path}/system/python3
|
|
runtime.tools.pqt-mklittlefs.path={runtime.platform.path}/system/mklittlefs
|
|
runtime.tools.pqt-pioasm.path={runtime.platform.path}/system/pioasm
|
|
runtime.tools.pqt-elf2uf2.path={runtime.platform.path}/system/elf2uf2
|
|
runtime.tools.pqt-openocd.path={runtime.platform.path}/system/openocd
|
|
compiler.path={runtime.tools.pqt-gcc.path}/bin/
|
|
|
|
compiler.libraries.ldflags=
|
|
|
|
# Compile variables
|
|
# -----------------
|
|
|
|
compiler.warning_flags=-Werror=return-type
|
|
compiler.warning_flags.none=-Werror=return-type
|
|
compiler.warning_flags.default=-Werror=return-type
|
|
compiler.warning_flags.more=-Wall -Werror=return-type -Wno-ignored-qualifiers
|
|
compiler.warning_flags.all=-Wall -Wextra -Werror=return-type -Wno-ignored-qualifiers
|
|
|
|
compiler.netdefines=-DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 -DCYW43_LWIP=0 {build.lwipdefs} -DLWIP_IGMP=1 -DLWIP_CHECKSUM_CTRL_PER_NETIF=1
|
|
compiler.defines={build.led} {build.usbstack_flags} -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' {compiler.netdefines} -DARDUINO_VARIANT="{build.variant}" -DTARGET_RP2040
|
|
compiler.includes="-iprefix{runtime.platform.path}/" "@{runtime.platform.path}/lib/platform_inc.txt" "-I{runtime.platform.path}/include"
|
|
compiler.flags=-march=armv6-m -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections {build.flags.exceptions} {build.flags.stackprotect} {build.flags.cmsis}
|
|
compiler.wrap="@{runtime.platform.path}/lib/platform_wrap.txt"
|
|
compiler.libbearssl="{runtime.platform.path}/lib/libbearssl.a"
|
|
|
|
compiler.c.cmd=arm-none-eabi-gcc
|
|
compiler.c.flags=-c {compiler.warning_flags} {compiler.defines} {compiler.flags} -MMD {compiler.includes} -std=gnu17 -g -pipe
|
|
compiler.c.elf.cmd=arm-none-eabi-g++
|
|
compiler.c.elf.flags={compiler.warning_flags} {compiler.defines} {compiler.flags} {build.flags.optimize} -u _printf_float -u _scanf_float
|
|
compiler.S.cmd=arm-none-eabi-gcc
|
|
compiler.S.flags=-c {compiler.warning_flags} -g -x assembler-with-cpp -MMD {compiler.includes} -g {build.flags.cmsis}
|
|
compiler.cpp.cmd=arm-none-eabi-g++
|
|
compiler.cpp.flags=-c {compiler.warning_flags} {compiler.defines} {compiler.flags} -MMD {compiler.includes} {build.flags.rtti} -std=gnu++17 -g -pipe
|
|
|
|
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.elf2hex.bin.flags=-O binary
|
|
compiler.elf2hex.hex.flags=-O ihex -R .eeprom
|
|
compiler.elf2hex.cmd=arm-none-eabi-objcopy
|
|
compiler.ldflags={compiler.wrap} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common
|
|
compiler.size.cmd=arm-none-eabi-size
|
|
compiler.define=-DARDUINO=
|
|
compiler.readelf.cmd=arm-none-eabi-readelf
|
|
|
|
# this can be overridden in boards.txt
|
|
build.extra_flags=
|
|
|
|
# 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.elf2hex.extra_flags=
|
|
|
|
# Board configuration, set in boards.txt. Present here to ensure substitution works
|
|
build.flash_length=
|
|
build.eeprom_start=
|
|
build.flags.optimize=-Os
|
|
build.flags.rtti=-fno-rtti
|
|
build.fs_start=
|
|
build.fs_end=
|
|
build.usbstack_flags=
|
|
build.flags.cmsis=-DARM_MATH_CM0_FAMILY -DARM_MATH_CM0_PLUS
|
|
build.flags.libstdcpp=-lstdc++
|
|
build.flags.exceptions=-fno-exceptions
|
|
build.flags.stackprotect=
|
|
build.libpico=libpico.a
|
|
build.boot2=boot2_generic_03h_4_padded_checksum
|
|
build.lwipdefs=-DLWIP_IPV6=0 -DLWIP_IPV4=1
|
|
build.wificc=-DWIFICC=CYW43_COUNTRY_WORLDWIDE
|
|
build.debugscript=picoprobe.tcl
|
|
|
|
# Allow Pico boards do be auto-discovered by the IDE
|
|
#discovery.rp2040.pattern={runtime.tools.pqt-python3.path}/python3 -I "{runtime.platform.path}/tools/pluggable_discovery.py"
|
|
discovery.rp2040.pattern={runtime.platform.path}/system/python3/python3 -I "{runtime.platform.path}/tools/pluggable_discovery.py"
|
|
#pluggable_discovery.rp2040.pattern="{runtime.tools.pqt-python3.path}/python3" -I "{runtime.platform.path}/tools/pluggable_discovery.py"
|
|
pluggable_discovery.rp2040.pattern="{runtime.platform.path}/system/python3/python3" -I "{runtime.platform.path}/tools/pluggable_discovery.py"
|
|
|
|
|
|
# Compile patterns
|
|
# ----------------
|
|
|
|
## Generate signing header
|
|
recipe.hooks.sketch.prebuild.pattern="{runtime.tools.pqt-python3.path}/python3" -I "{runtime.platform.path}/tools/signing.py" --mode header --publickey "{build.source.path}/public.key" --out "{build.path}/core/Updater_Signing.h"
|
|
|
|
## Compile c files
|
|
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} {build.usbpid} {build.usbpwr} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {build.flags.optimize} {includes} "{source_file}" -o "{object_file}"
|
|
|
|
## Compile c++ files
|
|
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" -I "{build.path}/core" {compiler.cpp.flags} {build.usbpid} {build.usbpwr} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {build.flags.optimize} {build.wificc} {includes} "{source_file}" -o "{object_file}"
|
|
|
|
## Compile S files
|
|
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} {build.usbpid} {build.usbpwr} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {includes} "{source_file}" -o "{object_file}"
|
|
|
|
## Create archives
|
|
# archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value
|
|
archive_file_path={build.path}/{archive_file}
|
|
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
|
|
|
|
## Generate the linker map with specific flash sizes/locations
|
|
recipe.hooks.linking.prelink.1.pattern="{runtime.tools.pqt-python3.path}/python3" -I "{runtime.platform.path}/tools/simplesub.py" --input "{runtime.platform.path}/lib/memmap_default.ld" --out "{build.path}/memmap_default.ld" --sub __FLASH_LENGTH__ {build.flash_length} --sub __EEPROM_START__ {build.eeprom_start} --sub __FS_START__ {build.fs_start} --sub __FS_END__ {build.fs_end} --sub __RAM_LENGTH__ {build.ram_length}
|
|
|
|
## Compile the boot stage 2 blob
|
|
recipe.hooks.linking.prelink.2.pattern="{compiler.path}{compiler.S.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -c "{runtime.platform.path}/boot2/{build.boot2}.S" "-I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/" "-I{runtime.platform.path}/pico-sdk/src/common/pico_binary_info/include" -o "{build.path}/boot2.o"
|
|
|
|
## 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} {compiler.ldflags} "-Wl,--script={build.path}/memmap_default.ld" "-Wl,-Map,{build.path}/{build.project_name}.map" -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{build.path}/{archive_file}" "{build.path}/boot2.o" "{runtime.platform.path}/lib/ota.o" {compiler.libraries.ldflags} "{runtime.platform.path}/lib/{build.libpico}" {compiler.libbearssl} -lm -lc {build.flags.libstdcpp} -lc -Wl,--end-group
|
|
|
|
## Create output (UF2 file)
|
|
recipe.objcopy.uf2.pattern="{runtime.tools.pqt-elf2uf2.path}/elf2uf2" "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.uf2"
|
|
|
|
## Create output BIN (for OTA)
|
|
recipe.objcopy.bin.1.pattern="{compiler.path}/{compiler.objcopy.cmd}" -Obinary "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
|
|
recipe.objcopy.bin.2.pattern="{runtime.tools.pqt-python3.path}/python3" -I "{runtime.platform.path}/tools/signing.py" --mode sign --privatekey "{build.source.path}/private.key" --bin "{build.path}/{build.project_name}.bin" --out "{build.path}/{build.project_name}.bin.signed"
|
|
|
|
|
|
build.preferred_out_format=uf2
|
|
|
|
## Save hex
|
|
recipe.output.tmp_file={build.project_name}.{build.preferred_out_format}
|
|
recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_out_format}
|
|
|
|
## Compute size
|
|
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
|
|
recipe.size.regex=^(?:\.boot2|\.text|\.rodata|\.ARM\.extab|\.ARM\.exidx)\s+([0-9]+).*
|
|
recipe.size.regex.data=^(?:\.data|\.bss|\.ram_vector_table|\.uninitialized_data)\s+([0-9]+).*
|
|
|
|
|
|
# Debugging
|
|
debug.executable={build.path}/{build.project_name}.elf
|
|
debug.toolchain=gcc
|
|
debug.toolchain.path={runtime.tools.pqt-gcc.path}/bin/
|
|
debug.toolchain.prefix=arm-none-eabi-
|
|
debug.server=openocd
|
|
debug.server.openocd.path={runtime.tools.pqt-openocd.path}/bin/openocd
|
|
debug.server.openocd.scripts_dir={runtime.tools.pqt-openocd.path}/share/openocd/scripts/
|
|
debug.server.openocd.script={runtime.platform.path}/lib/{build.debugscript}
|
|
|
|
|
|
|
|
tools.uf2conv.path=
|
|
# Because the variable expansion doesn't allow one tool to find another, the following lines
|
|
# will point to "{runtime.platform.path}/tools/python3/python3" in GIT and
|
|
# "{runtime.tools.pqt-python3.path}/python3" for JSON board manager releases.
|
|
#tools.uf2conv.cmd={runtime.tools.pqt-python3.path}/python3
|
|
#tools.uf2conv.network_cmd={runtime.tools.pqt-python3.path}/python3
|
|
tools.uf2conv.cmd={runtime.platform.path}/system/python3/python3
|
|
tools.uf2conv.network_cmd={runtime.platform.path}/system/python3/python3
|
|
tools.uf2conv.upload.protocol=uf2
|
|
tools.uf2conv.upload.params.verbose=
|
|
tools.uf2conv.upload.params.quiet=
|
|
tools.uf2conv.upload.pattern="{cmd}" -I "{runtime.platform.path}/tools/uf2conv.py" --serial "{serial.port}" --family RP2040 --deploy "{build.path}/{build.project_name}.uf2"
|
|
tools.uf2conv.upload.network_pattern="{network_cmd}" -I "{runtime.platform.path}/tools/espota.py" -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin"
|
|
|
|
#tools.uf2conv-network.cmd={runtime.tools.pqt-python3.path}/python3
|
|
tools.uf2conv-network.cmd={runtime.platform.path}/system/python3/python3
|
|
tools.uf2conv-network.upload.protocol=uf2
|
|
tools.uf2conv-network.upload.params.verbose=
|
|
tools.uf2conv-network.upload.params.quiet=
|
|
tools.uf2conv-network.upload.pattern="{cmd}" -I "{runtime.platform.path}/tools/espota.py" -i "{upload.port.address}" -p "{upload.port.properties.port}" "--auth={upload.field.password}" -f "{build.path}/{build.project_name}.bin"
|
|
|
|
|
|
#tools.picoprobe.cmd={runtime.tools.pqt-openocd.path}
|
|
tools.picoprobe.cmd={runtime.platform.path}/system/openocd
|
|
tools.picoprobe.upload.protocol=picoprobe
|
|
tools.picoprobe.upload.params.verbose=
|
|
tools.picoprobe.upload.params.quiet=
|
|
tools.picoprobe.upload.pattern="{cmd}/bin/openocd" -f "interface/picoprobe.cfg" -f "target/rp2040.cfg" -s "{cmd}/share/openocd/scripts" -c "program {{build.path}/{build.project_name}.elf} verify reset exit"
|
|
|
|
#tools.picodebug.cmd={runtime.tools.pqt-openocd.path}
|
|
tools.picodebug.cmd={runtime.platform.path}/system/openocd
|
|
tools.picodebug.upload.protocol=pico-debug
|
|
tools.picodebug.upload.params.verbose=
|
|
tools.picodebug.upload.params.quiet=
|
|
tools.picodebug.upload.pattern="{cmd}/bin/openocd" -f "board/pico-debug.cfg" -s "{cmd}/share/openocd/scripts" -c "program {{build.path}/{build.project_name}.elf} verify reset exit"
|