Skip to content

Commit a6f569f

Browse files
Fix: cannot build after #7060 on Win64
* add double-quotes to `compiler.S.flags` * fix windows-specific processes (`recipe.hooks.linking.prelink.[12].pattern.windows`) * rewrite processing of "mkdir" and "cp" in python because of platform-independence
1 parent 4566400 commit a6f569f

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

platform.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ runtime.tools.signing={runtime.platform.path}/tools/signing.py
1717
runtime.tools.elf2bin={runtime.platform.path}/tools/elf2bin.py
1818
runtime.tools.sizes={runtime.platform.path}/tools/sizes.py
1919
runtime.tools.makecorever={runtime.platform.path}/tools/makecorever.py
20+
runtime.tools.mkdir={runtime.platform.path}/tools/mkdir.py
21+
runtime.tools.cp={runtime.platform.path}/tools/cp.py
2022
runtime.tools.eboot={runtime.platform.path}/bootloaders/eboot/eboot.elf
2123

2224
compiler.warning_flags=-w
@@ -60,7 +62,7 @@ compiler.c.cmd=xtensa-lx106-elf-gcc
6062
compiler.c.flags=-c {compiler.warning_flags} -std=gnu17 {build.stacksmash_flags} -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags} {build.waveform} {build.mmuflags} {build.non32xferflags}
6163

6264
compiler.S.cmd=xtensa-lx106-elf-gcc
63-
compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls -I{runtime.tools.xtensa-lx106-elf-gcc.path}/include/
65+
compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls "-I{runtime.tools.xtensa-lx106-elf-gcc.path}/include/"
6466

6567
compiler.c.elf.flags= -g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u app_entry {build.float} -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/lib/{build.sdk}" "-L{build.path}" "-L{compiler.libc.path}/lib" "-Tlocal.eagle.flash.ld" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read
6668

@@ -99,10 +101,8 @@ recipe.hooks.sketch.prebuild.pattern="{runtime.tools.python3.path}/python3" "{ru
99101
recipe.hooks.prebuild.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.makecorever}" --build_path "{build.path}" --platform_path "{runtime.platform.path}" --version "unix-{version}"
100102

101103
## Build the app.ld linker file
102-
recipe.hooks.linking.prelink.1.pattern=mkdir -p "{build.path}/ld_h/"
103-
recipe.hooks.linking.prelink.1.pattern.windows=cmd /v:on /e:on /c "if not exist {build.path}\ld_h\ (mkdir {build.path}\ld_h\ )"
104-
recipe.hooks.linking.prelink.2.pattern=cp "{runtime.platform.path}/tools/sdk/ld/{build.flash_ld}" "{build.path}/ld_h/local.eagle.flash.ld.h"
105-
recipe.hooks.linking.prelink.2.pattern.windows=cmd /v:on /e:on /c "copy {runtime.platform.path}\tools\sdk\ld\{build.flash_ld}" "{build.path}\ld_h\local.eagle.flash.ld.h"
104+
recipe.hooks.linking.prelink.1.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.mkdir}" -p "{build.path}/ld_h/"
105+
recipe.hooks.linking.prelink.2.pattern="{runtime.tools.python3.path}/python3" "{runtime.tools.cp}" "{runtime.platform.path}/tools/sdk/ld/{build.flash_ld}" "{build.path}/ld_h/local.eagle.flash.ld.h"
106106
recipe.hooks.linking.prelink.3.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} {build.mmuflags} "{build.path}/ld_h/local.eagle.flash.ld.h" -o "{build.path}/local.eagle.flash.ld"
107107
recipe.hooks.linking.prelink.4.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} {build.mmuflags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld"
108108

tools/cp.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env python3
2+
3+
# Platform-independent single-file `cp`
4+
5+
import argparse
6+
import shutil
7+
import sys
8+
9+
def main():
10+
parser = argparse.ArgumentParser(description="Platform-independent single-file `cp`")
11+
parser.add_argument("src", action="store")
12+
parser.add_argument("dst", action="store")
13+
ns = parser.parse_args()
14+
shutil.copyfile(ns.src, ns.dst)
15+
return 0
16+
17+
if __name__ == '__main__':
18+
sys.exit(main())

tools/mkdir.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python3
2+
3+
# Platform-independent 'mkdir'
4+
5+
import argparse
6+
import pathlib
7+
import sys
8+
9+
def main():
10+
parser = argparse.ArgumentParser(description="Platform-independent 'mkdir'")
11+
parser.add_argument("-p", "--parents", action="store_true", required=False, help="no error if existing, make parent directories as needed")
12+
parser.add_argument("dir", action="store", nargs="+")
13+
ns = parser.parse_args()
14+
for p in ns.dir:
15+
pathlib.Path(p).mkdir(parents=ns.parents, exist_ok=True)
16+
return 0
17+
18+
if __name__ == '__main__':
19+
sys.exit(main())

0 commit comments

Comments
 (0)