From c892443b5b41be825fe190c73971bbc7c097460c Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Wed, 17 Mar 2021 08:33:51 -0700 Subject: [PATCH] Adjust directories for cleaner use w/Arduino /system is only downloaded tools /tools is all scripts/submodules that are part of the main core /lib is the linker libs --- .gitmodules | 2 +- {system/libs => lib}/pico.a | Bin platform.txt | 8 ++++---- system/placeholder | 1 + {system => tools}/discovery.py | 0 {system => tools}/get.py | 9 ++++++--- {system => tools}/pyserial | 0 {system => tools}/uf2conv.py | 0 8 files changed, 12 insertions(+), 8 deletions(-) rename {system/libs => lib}/pico.a (100%) create mode 100644 system/placeholder rename {system => tools}/discovery.py (100%) rename {system => tools}/get.py (96%) rename {system => tools}/pyserial (100%) rename {system => tools}/uf2conv.py (100%) diff --git a/.gitmodules b/.gitmodules index 901300a0..c4645e23 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,5 +5,5 @@ path = pico-sdk url = https://github.com/raspberrypi/pico-sdk.git [submodule "system/pyserial"] - path = system/pyserial + path = tools/pyserial url = https://github.com/pyserial/pyserial.git diff --git a/system/libs/pico.a b/lib/pico.a similarity index 100% rename from system/libs/pico.a rename to lib/pico.a diff --git a/platform.txt b/platform.txt index e074853d..19b19b58 100644 --- a/platform.txt +++ b/platform.txt @@ -78,7 +78,7 @@ compiler.S.extra_flags= compiler.ar.extra_flags= compiler.elf2hex.extra_flags= -discovery.rp2040.pattern="{runtime.tools.pqt-python3.path}/python3" "{runtime.platform.path}/system/discovery.py" +discovery.rp2040.pattern="{runtime.tools.pqt-python3.path}/python3" "{runtime.platform.path}/tools/discovery.py" # USB Flags # --------- @@ -106,7 +106,7 @@ 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}" ## 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} "-Wl,--script={build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {runtime.platform.path}/system/libs/pico.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/bs2_default_padded_checksummed.S +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.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {runtime.platform.path}/lib/pico.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/bs2_default_padded_checksummed.S ## 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" @@ -133,6 +133,6 @@ tools.uf2conv.upload.protocol=uf2 tools.uf2conv.upload.params.verbose= tools.uf2conv.upload.params.quiet= -tools.uf2conv.upload.pattern="{cmd}" "{runtime.platform.path}/system/uf2conv.py" --serial "{serial.port}" --family RP2040 --deploy "{build.path}/{build.project_name}.uf2" -tools.uf2conv.upload.network_pattern="{cmd}" "{runtime.platform.path}/system/uf2conv.py" --serial "{serial.port}" --family RP2040 --deploy "{build.path}/{build.project_name}.uf2" +tools.uf2conv.upload.pattern="{cmd}" "{runtime.platform.path}/tools/uf2conv.py" --serial "{serial.port}" --family RP2040 --deploy "{build.path}/{build.project_name}.uf2" +tools.uf2conv.upload.network_pattern="{cmd}" "{runtime.platform.path}/tools/uf2conv.py" --serial "{serial.port}" --family RP2040 --deploy "{build.path}/{build.project_name}.uf2" diff --git a/system/placeholder b/system/placeholder new file mode 100644 index 00000000..48cdce85 --- /dev/null +++ b/system/placeholder @@ -0,0 +1 @@ +placeholder diff --git a/system/discovery.py b/tools/discovery.py similarity index 100% rename from system/discovery.py rename to tools/discovery.py diff --git a/system/get.py b/tools/get.py similarity index 96% rename from system/get.py rename to tools/get.py index 137080b0..f1b80160 100755 --- a/system/get.py +++ b/tools/get.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 -# This script will download and extract required tools into the current directory. -# Tools list is obtained from package/package_esp8266com_index.template.json file. -# Written by Ivan Grokhotkov, 2015. +# This script will download and extract required tools into the system directory. +# Originally written by Ivan Grokhotkov, 2015. # from __future__ import print_function import os @@ -49,14 +48,17 @@ def report_progress(count, blockSize, totalSize): sys.stdout.flush() def unpack(filename, destination): + here = os.getcwd() dirname = '' print('Extracting {0}'.format(filename)) if filename.endswith('tar.gz'): tfile = tarfile.open(filename, 'r:gz') + os.chdir("../system/") tfile.extractall(destination) dirname= tfile.getnames()[0] elif filename.endswith('zip'): zfile = zipfile.ZipFile(filename) + os.chdir("../system/") zfile.extractall(destination) dirname = zfile.namelist()[0] else: @@ -69,6 +71,7 @@ def unpack(filename, destination): if os.path.isdir(rename_to): shutil.rmtree(rename_to) shutil.move(dirname, rename_to) + os.chdir(here) def get_tool(tool): archive_name = tool['archiveFileName'] diff --git a/system/pyserial b/tools/pyserial similarity index 100% rename from system/pyserial rename to tools/pyserial diff --git a/system/uf2conv.py b/tools/uf2conv.py similarity index 100% rename from system/uf2conv.py rename to tools/uf2conv.py