Skip to content

gen_bin_file() breaks when project path contains a space (unquoted objcopy command) #32

Description

@psxbox

Summary

pio run fails at the firmware.bin generation step (after a successful link) when the project directory path contains a space:

Usage: arm-none-eabi-objcopy [option(s)] in-file [out-file]
...
*** Error 1
*** [.pio\build\sim800\firmware.bin] ...\temp.bin: The system cannot find the file specified

Root cause

builder/framework/logicromsdk.py, gen_bin_file():

cmd = ["$OBJCOPY"]
...
cmd.extend(["-O", "binary"])
cmd.append(target_elf.get_abspath())
cmd.append(temp_firm)
env.Execute(env.VerboseAction(" ".join(cmd), " "))

The command is built as a plain space-joined string and executed as a shell command, with no quoting around the elf/output paths. If the project directory (or any ancestor directory) contains a space — e.g. E:\Projects\Foo\SIM800 DEV\.pio\build\sim800\firmware.elf — the shell splits it into two arguments, objcopy receives a malformed argument list, prints its usage text, and temp.bin is never created, causing the next build step to fail with "the system cannot find the file specified".

Repro

Any project whose path contains a space, building with framework = logicromsdk.

Fix

Quote the path arguments before joining, e.g.:

cmd.append('"%s"' % target_elf.get_abspath())
cmd.append('"%s"' % temp_firm)

(Verified locally — this resolves the issue and produces a correct firmware.bin.)

Environment

  • platform-logicrom 1.1.0
  • framework-logicromsdk 1.2.0
  • Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions