platform-espressif8266 icon indicating copy to clipboard operation
platform-espressif8266 copied to clipboard

Error: pio run -t nobuild -t upload

Open Bighoneypot opened this issue 2 years ago • 3 comments

What kind of issue is this?

  • [ ] PlatformIO IDE. [PlatformIO IDE for VSCode]

  • [ ] Development Platform or Board. [env:nodemcuv2] platform = espressif8266 board = nodemcuv2 framework = arduino upload_speed = 3000000 monitor_speed = 115200 board_build.f_cpu = 160000000L upload_protocol = esptool

  • [ ] Feature Request. New button to upload only sketch without rebuild project, for fast and easy use it

  • [ ] PlatformIO Core. 6.1.5

You can erase any parts of this template not applicable to your Issue.


Configuration

**Windows 10 PRO 22H2 build 19045.2251 **:

PlatformIO Version (6.1.5):

Description of problem

In my case is impossible command pio run -t nobuild -t upload image

Error: Could not find LD Script

Bighoneypot avatar Nov 25 '22 09:11 Bighoneypot

I am also encountering the same error. I would like to add that the same thing happens when the host/remote is Ubuntu 22.

Daiki51 avatar Dec 06 '22 06:12 Daiki51

Also looks like https://github.com/platformio/platform-espressif32/issues/861

We try to call env.GetActualLDScript() to retrieve our flash size info https://github.com/platformio/platformio-core/blob/48655ad728c25c6af67da913c36651e27fdd05ad/platformio/builder/tools/piomisc.py#L42-L84

Which is broken in nobuild case, since there is no env.BuildProgram() and LINKFLAGS is empty. As a workaround, one could do the same thing as suggested in the esp32 issue - populate it manually with the -Wl,-T...ld entry from the currently used board .json https://github.com/platformio/platform-espressif8266/blob/46d25a4f41791cce1b9269da99b7e71e05aa6ba4/builder/main.py#L86 https://github.com/platformio/platform-espressif8266/blob/46d25a4f41791cce1b9269da99b7e71e05aa6ba4/builder/main.py#L93 https://github.com/platformio/platform-espressif8266/blob/46d25a4f41791cce1b9269da99b7e71e05aa6ba4/builder/main.py#L124

Not really sure if nobuild is implemented correctly, though. Perhaps it should still invoke pre-requisite actions but somehow inhibit the PROGRAM .bin regeneration when scons thinks any of the targets need to be built i.e. somehow tell it that all of our dependencies for .bin are up-to-date

mcspr avatar Dec 06 '22 08:12 mcspr

This one worked in my test for pio run -t nobuild -t upload

#
# The script sets the missing "LDSCRIPT_PATH" when using the command `pio run -t nobuild`
# Adopted from https://github.com/platformio/platform-espressif32/issues/861#issuecomment-1241871437
# Possible now to upload the firmware or the filesystem with (when builded already!):
#
# `pio run -t nobuild -t upload` and `pio run -t nobuild -t uploadfs`
#

Import("env")

import os
from SCons.Script import COMMAND_LINE_TARGETS

board_config = env.BoardConfig()
framework_dir = env.PioPlatform().get_package_dir("framework-arduinoespressif8266")
assert os.path.isdir(framework_dir)

if "nobuild" in COMMAND_LINE_TARGETS:
    env.Replace(
        LDSCRIPT_PATH=os.path.join(
            framework_dir,
            "tools",
            "sdk",
            "ld",
            board_config.get("build.arduino.ldscript"),
        )
    )
#    print("Set LDSCRIPT_PATH to: ", os.path.join(framework_dir,"tools","sdk","ld",board_config.get("build.arduino.ldscript")))

Jason2866 avatar Feb 27 '23 22:02 Jason2866