|
| 1 | +# Copyright (c) 2021 Earle F. Philhower, III |
| 2 | +# |
| 3 | +# Raspberry Pi RP2040 Core platform file |
| 4 | +# |
| 5 | +# This library is free software; you can redistribute it and/or |
| 6 | +# modify it under the terms of the GNU Lesser General Public |
| 7 | +# License as published by the Free Software Foundation; either |
| 8 | +# version 2.1 of the License, or (at your option) any later version. |
| 9 | +# |
| 10 | +# This library is distributed in the hope that it will be useful, |
| 11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | +# See the GNU Lesser General Public License for more details. |
| 14 | +# |
| 15 | +# You should have received a copy of the GNU Lesser General Public |
| 16 | +# License along with this library; if not, write to the Free Software |
| 17 | +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | + |
| 19 | +# For more info: |
| 20 | +# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification |
| 21 | + |
| 22 | +name=Raspberry Pi RP2040 Boards(1.2.2) |
| 23 | +version=1.2.2 |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +compiler.path={runtime.tools.pqt-gcc.path}/bin/ |
| 31 | + |
| 32 | +# Compile variables |
| 33 | +# ----------------- |
| 34 | + |
| 35 | +compiler.warning_flags=-w |
| 36 | +compiler.warning_flags.none=-w |
| 37 | +compiler.warning_flags.default= |
| 38 | +compiler.warning_flags.more=-Wall |
| 39 | +compiler.warning_flags.all=-Wall -Wextra |
| 40 | + |
| 41 | +compiler.defines={build.led} |
| 42 | +compiler.includes="-iprefix{runtime.platform.path}/" "@{runtime.platform.path}/lib/platform_inc.txt" |
| 43 | +compiler.flags=-Os -march=armv6-m -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections -fno-exceptions |
| 44 | +compiler.wrap="@{runtime.platform.path}/lib/platform_wrap.txt" |
| 45 | + |
| 46 | +compiler.c.cmd=arm-none-eabi-gcc |
| 47 | +compiler.c.flags=-c {compiler.defines} {compiler.flags} {compiler.includes} -std=gnu17 -g |
| 48 | +compiler.c.elf.cmd=arm-none-eabi-g++ |
| 49 | +compiler.c.elf.flags={compiler.defines} {compiler.flags} -Wl,--gc-sections -u _printf_float -u _scanf_float |
| 50 | +compiler.S.cmd=arm-none-eabi-gcc |
| 51 | +compiler.S.flags=-c -g -x assembler-with-cpp -MMD {compiler.includes} -g |
| 52 | +compiler.cpp.cmd=arm-none-eabi-g++ |
| 53 | +compiler.cpp.flags=-c {compiler.defines} {compiler.flags} {compiler.includes} -fno-rtti -std=gnu++17 -g |
| 54 | + |
| 55 | +compiler.ar.cmd=arm-none-eabi-ar |
| 56 | +compiler.ar.flags=rcs |
| 57 | +compiler.objcopy.cmd=arm-none-eabi-objcopy |
| 58 | +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 |
| 59 | +compiler.elf2hex.bin.flags=-O binary |
| 60 | +compiler.elf2hex.hex.flags=-O ihex -R .eeprom |
| 61 | +compiler.elf2hex.cmd=arm-none-eabi-objcopy |
| 62 | +compiler.ldflags={compiler.wrap} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common |
| 63 | +compiler.size.cmd=arm-none-eabi-size |
| 64 | +compiler.define=-DARDUINO= |
| 65 | +compiler.readelf.cmd=arm-none-eabi-readelf |
| 66 | + |
| 67 | +# this can be overriden in boards.txt |
| 68 | +build.extra_flags= |
| 69 | + |
| 70 | +# These can be overridden in platform.local.txt |
| 71 | +compiler.c.extra_flags= |
| 72 | +compiler.c.elf.extra_flags= |
| 73 | +compiler.cpp.extra_flags= |
| 74 | +compiler.S.extra_flags= |
| 75 | +compiler.ar.extra_flags= |
| 76 | +compiler.elf2hex.extra_flags= |
| 77 | + |
| 78 | +# Board configuration, set in boards.txt. Present here to ensure substitution works |
| 79 | +build.flash_length= |
| 80 | +build.eeprom_start= |
| 81 | +build.fs_start= |
| 82 | +build.fs_end= |
| 83 | + |
| 84 | +build.boot2=boot2_generic_03h_4_padded_checksum |
| 85 | + |
| 86 | +# Allow Pico boards do be auto-discovered by the IDE |
| 87 | +discovery.rp2040.pattern="{runtime.tools.pqt-python3.path}/python3" "{runtime.platform.path}/tools/discovery.py" |
| 88 | + |
| 89 | + |
| 90 | +# Compile patterns |
| 91 | +# ---------------- |
| 92 | + |
| 93 | +## Compile c files |
| 94 | +## KH Add -DBOARD_NAME="{build.board}" |
| 95 | +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} {build.usbpid} -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} {includes} "{source_file}" -o "{object_file}" |
| 96 | + |
| 97 | +## Compile c++ files |
| 98 | +## KH Add -DBOARD_NAME="{build.board}" |
| 99 | +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {build.usbpid} -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} {includes} "{source_file}" -o "{object_file}" |
| 100 | + |
| 101 | +## Compile S files |
| 102 | +## KH Add -DBOARD_NAME="{build.board}" |
| 103 | +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} {build.usbpid} -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}" |
| 104 | + |
| 105 | +## Create archives |
| 106 | +# archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value |
| 107 | +archive_file_path={build.path}/{archive_file} |
| 108 | +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" |
| 109 | + |
| 110 | +## Combine gc-sections, archives, and objects |
| 111 | +recipe.hooks.linking.prelink.1.pattern="{runtime.tools.pqt-python3.path}/python3" "{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} |
| 112 | +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-Wl,--script={build.path}/memmap_default.ld" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nosys.specs -Wl,--start-group {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "{runtime.platform.path}/lib/libpico.a" -lm "-I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/" "-I{runtime.platform.path}/pico-sdk/src/common/pico_binary_info/include" "{runtime.platform.path}/assembly/{build.boot2}.S" -lc -lstdc++ -Wl,--end-group |
| 113 | + |
| 114 | +## Create output (UF2 file) |
| 115 | +recipe.objcopy.uf2.pattern="{runtime.tools.pqt-elf2uf2.path}/elf2uf2" "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.uf2" |
| 116 | + |
| 117 | +build.preferred_out_format=uf2 |
| 118 | + |
| 119 | +## Save hex |
| 120 | +recipe.output.tmp_file={build.project_name}.{build.preferred_out_format} |
| 121 | +recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_out_format} |
| 122 | + |
| 123 | +## Compute size |
| 124 | +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" |
| 125 | +recipe.size.regex=^(?:\.boot2|\.text|\.rodata|\.ARM\.extab|\.ARM\.exidx)\s+([0-9]+).* |
| 126 | +recipe.size.regex.data=^(?:\.data|\.bss|\.ram_vector_table|\.uninitialized_data)\s+([0-9]+).* |
| 127 | + |
| 128 | +tools.uf2conv.path= |
| 129 | +# Because the variable expansion doesn't allow one tool to find another, the following lines |
| 130 | +# will point to "{runtime.platform.path}/tools/python3/python3" in GIT and |
| 131 | +# "{runtime.tools.pqt-python3.path}/python3" for JSON board manager releases. |
| 132 | +tools.uf2conv.cmd={runtime.tools.pqt-python3.path}/python3 |
| 133 | + |
| 134 | +tools.uf2conv.upload.protocol=uf2 |
| 135 | +tools.uf2conv.upload.params.verbose= |
| 136 | +tools.uf2conv.upload.params.quiet= |
| 137 | +tools.uf2conv.upload.pattern="{cmd}" "{runtime.platform.path}/tools/uf2conv.py" --serial "{serial.port}" --family RP2040 --deploy "{build.path}/{build.project_name}.uf2" |
| 138 | + |
| 139 | + |
| 140 | +tools.picoprobe.cmd={runtime.tools.pqt-openocd.path} |
| 141 | + |
| 142 | +tools.picoprobe.upload.protocol=picoprobe |
| 143 | +tools.picoprobe.upload.params.verbose= |
| 144 | +tools.picoprobe.upload.params.quiet= |
| 145 | +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" |
0 commit comments