# Copyright (c) 2021 Earle F. Philhower, III # # Raspberry Pi RP2040/R2350 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/RP2350 Boards version=4.4.3 # Required discoveries and monitors # --------------------------------- pluggable_discovery.required.0=builtin:serial-discovery pluggable_discovery.required.1=builtin:mdns-discovery pluggable_monitor.required.serial=builtin:serial-monitor runtime.tools.pqt-gcc.path={runtime.platform.path}/system/arm-none-eabi runtime.tools.pqt-gcc-riscv.path={runtime.platform.path}/system/riscv32-unknown-elf 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 runtime.tools.pqt-picotool.path={runtime.platform.path}/system/picotool compiler.path={runtime.tools.{build.toolchainpkg}.path}/bin/ compiler.libraries.ldflags= # Compile variables # ----------------- compiler.warning_flags=-Werror=return-type -Wno-psabi compiler.warning_flags.none=-Werror=return-type -Wno-psabi compiler.warning_flags.default=-Werror=return-type -Wno-psabi compiler.warning_flags.more=-Wall -Werror=return-type -Wno-ignored-qualifiers -Wno-psabi compiler.warning_flags.all=-Wall -Wextra -Werror=return-type -Wno-ignored-qualifiers -Wno-psabi -Wno-unused-parameter -Wno-missing-field-initializers compiler.netdefines={build.libpicowdefs} -DLWIP_IGMP=1 -DLWIP_CHECKSUM_CTRL_PER_NETIF=1 compiler.psramdefines={build.psram_cs} {build.psram_freq} compiler.defines={build.led} {build.usbstack_flags} {build.usbpid} {build.usbvid} {build.usbpwr} {compiler.psramdefines} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' {compiler.netdefines} {build.sdfatdefines} {build.variantdefines} -DARDUINO_VARIANT="{build.variant}" -DPICO_FLASH_SIZE_BYTES={build.flash_total} "@{runtime.platform.path}/lib/{build.chip}/platform_def.txt" compiler.includes="-iprefix{runtime.platform.path}/" "@{runtime.platform.path}/lib/{build.chip}/platform_inc.txt" "@{runtime.platform.path}/lib/core_inc.txt" "-I{runtime.platform.path}/include" compiler.flags={build.toolchainopts} -ffunction-sections -fdata-sections {build.flags.exceptions} {build.flags.stackprotect} {build.picodebugflags} compiler.wrap="@{runtime.platform.path}/lib/{build.chip}/platform_wrap.txt" "@{runtime.platform.path}/lib/core_wrap.txt" compiler.libbearssl="{runtime.platform.path}/lib/{build.chip}/libbearssl.a" compiler.c.cmd={build.toolchain}-gcc compiler.c.flags=-c {compiler.warning_flags} {compiler.defines} {compiler.flags} -MMD {compiler.includes} -std=gnu17 -g -pipe compiler.c.elf.cmd={build.toolchain}-g++ compiler.c.elf.flags={compiler.warning_flags} {compiler.defines} {compiler.flags} {build.flags.optimize} -u _printf_float -u _scanf_float compiler.S.cmd={build.toolchain}-gcc compiler.S.flags=-c {compiler.warning_flags} {compiler.defines} -g -x assembler-with-cpp -MMD {compiler.includes} {build.toolchainopts} -g compiler.cpp.cmd={build.toolchain}-g++ compiler.cpp.flags=-c {compiler.warning_flags} {compiler.defines} {compiler.flags} -MMD {compiler.includes} {build.flags.rtti} {build.flags.profile} -std=gnu++17 -g -pipe compiler.ar.cmd={build.toolchain}-ar compiler.ar.flags=rcs compiler.objcopy.cmd={build.toolchain}-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={build.toolchain}-objcopy compiler.ldflags={compiler.wrap} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--undefined=runtime_init_install_ram_vector_table -Wl,--undefined=__pre_init_runtime_init_clocks -Wl,--undefined=__pre_init_runtime_init_bootrom_reset -Wl,--undefined=__pre_init_runtime_init_early_resets -Wl,--undefined=__pre_init_runtime_init_usb_power_down -Wl,--undefined=__pre_init_runtime_init_clocks -Wl,--undefined=__pre_init_runtime_init_post_clock_resets -Wl,--undefined=__pre_init_runtime_init_spin_locks_reset -Wl,--undefined=__pre_init_runtime_init_boot_locks_reset -Wl,--undefined=__pre_init_runtime_init_bootrom_locking_enable -Wl,--undefined=__pre_init_runtime_init_mutex -Wl,--undefined=__pre_init_runtime_init_default_alarm_pool -Wl,--undefined=__pre_init_first_per_core_initializer -Wl,--undefined=__pre_init_runtime_init_per_core_bootrom_reset -Wl,--undefined=__pre_init_runtime_init_per_core_h3_irq_registers -Wl,--undefined=__pre_init_runtime_init_per_core_irq_priorities compiler.size.cmd={build.toolchain}-size compiler.define=-DARDUINO= compiler.readelf.cmd={build.toolchain}-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_total= build.flash_length= build.psram_length=0 build.psram_cs= build.psram_freq= build.eeprom_start= build.flags.optimize=-Os build.flags.rtti=-fno-rtti build.flags.profile= build.fs_start= build.fs_end= build.usbstack_flags= build.flags.libstdcpp=-lstdc++ build.flags.exceptions=-fno-exceptions build.flags.stackprotect= build.libpico=libpico.a build.libpicow=libipv4.a build.boot2=boot2_generic_03h_4_padded_checksum build.libpicowdefs=-DLWIP_IPV6=0 -DLWIP_IPV4=1 build.wificc=-DWIFICC=CYW43_COUNTRY_WORLDWIDE build.espwifitype= build.debugscript=picoprobe_cmsis_dap.tcl build.picodebugflags= build.variantdefines= build.sdfatdefines=-DFILE_COPY_CONSTRUCTOR_SELECT=FILE_COPY_CONSTRUCTOR_PUBLIC -DUSE_UTF8_LONG_NAMES=1 -DDISABLE_FS_H_WARNING=1 # Allow Pico boards to 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} -DF_CPU={build.f_cpu} {build.espwifitype} -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} -DF_CPU={build.f_cpu} {build.espwifitype} -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} -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/{build.chip}/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} --sub __PSRAM_LENGTH__ {build.psram_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.chip}/{build.boot2}.S" "-I{runtime.platform.path}/pico-sdk/src/{build.chip}/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,--no-warn-rwx-segments -Wl,--start-group {object_files} "{build.path}/{archive_file}" "{build.path}/boot2.o" "{runtime.platform.path}/lib/{build.chip}/ota.o" {compiler.libraries.ldflags} "{runtime.platform.path}/lib/{build.chip}/{build.libpico}" "{runtime.platform.path}/lib/{build.chip}/{build.libpicow}" {compiler.libbearssl} -lm -lc {build.flags.libstdcpp} -lc -Wl,--end-group ## Create output (UF2 file) recipe.objcopy.uf2.pattern="{runtime.tools.pqt-picotool.path}/picotool" uf2 convert "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.uf2" {build.uf2family} ## 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_ram|\.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={build.toolchain}- 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.chip}/{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.picotool.cmd={runtime.tools.pqt-picotool.path} tools.picotool.cmd={runtime.platform.path}/system/picotool tools.picotool.upload.protocol=picotool tools.picotool.upload.params.verbose= tools.picotool.upload.params.quiet= tools.picotool.upload.pattern="{cmd}/picotool" load "{build.path}/{build.project_name}.uf2" -f -x #tools.picoprobe_cmsis_dap.cmd={runtime.tools.pqt-openocd.path} tools.picoprobe_cmsis_dap.cmd={runtime.platform.path}/system/openocd tools.picoprobe_cmsis_dap.upload.protocol=picoprobe_cmsis_dap tools.picoprobe_cmsis_dap.upload.params.verbose= tools.picoprobe_cmsis_dap.upload.params.quiet= tools.picoprobe_cmsis_dap.upload.pattern="{cmd}/bin/openocd" -f "interface/cmsis-dap.cfg" -f "target/{build.chip}.cfg" -s "{cmd}/share/openocd/scripts" -c "init; adapter speed 5000; program {{build.path}/{build.project_name}.elf} verify; reset; exit"