platformio / platform-raspberrypi

Raspberry Pi: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/raspberrypi
Apache License 2.0
72 stars 93 forks source link

Temporary solution for FW uploading in windows #28

Open Gusev-Roman opened 2 years ago

Gusev-Roman commented 2 years ago

platformio.ini [env:pico] platform = raspberrypi board = pico framework = arduino upload_protocol = mbed upload_port = E:

platforms/raspberrypi/builder/main.py

` if upload_protocol == "mbed":

upload_actions = [
    env.VerboseAction(env.AutodetectUploadPort, "Looking for upload disk..."),
    env.VerboseAction(env.UploadToDisk, "Uploading $SOURCE")
]`

must be replaced to

` if upload_protocol == "mbed":

target_firm = join("$BUILD_DIR", "${PROGNAME}.uf2") 
env.Replace(
    UPLOADER="copy",
    UPLOADERFLAGS=target_firm,
    UPLOADCMD="$UPLOADER $UPLOADERFLAGS $UPLOAD_PORT >NUL")
upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]

`

now uploading works!..

oomek commented 2 years ago

Thanks, but now I have to unplug and hold the button. Is there any way to join both actions: forcing the board into bootsel from picotool and copying the file as you described?

maxgerhardt commented 2 years ago

upload_protocol = mbed UF2 upload is fixed by #36.

Is there any way to join both actions: forcing the board into bootsel from picotool and copying the file as you described?

Once a firmware from the Arduino core has been uploaded, it accepts a 1200bps reset-to-bootloader through the USB Serial interface it creates. Just delete any upload_protocol = .. line from the platformio.ini after, it's the default protocol. You don't need to re-plug / reset your board manually.