Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esptool reset mode #351

Closed
andriyadi opened this issue Dec 3, 2015 · 9 comments
Closed

esptool reset mode #351

andriyadi opened this issue Dec 3, 2015 · 9 comments
Assignees

Comments

@andriyadi
Copy link

Would be great if we can change the reset mode to be used by esptool, for uploading firmware to esp8266. As we know, esptool supports 2 reset modes now via -cd option: ck and nodemcu.

I check in this file platformio/platformio/builder/scripts/espressif.py, the -cd option is hardcoded to ck. Can I change that via platform.ini, or I should the source code of that espressif.py file?

Anyway, great progress so far! Definitely gonna keep using platformio.
Thanks.

@ivankravets ivankravets self-assigned this Dec 3, 2015
@ivankravets
Copy link
Member

Take a look on http://docs.platformio.org/en/latest/projectconf.html#extra-script

See related #247 (comment)

extra_script allows you to change behaviour of PlatformIO builder.

@ivankravets
Copy link
Member

@andriyadi
Copy link
Author

It would be great if you could provide an example for adding additional options, as my Python skill is very low. But that extra_script should do it for now.

If it's not too much for asking, the Arduino for esp8266 framework comes with boards.txt file. Is it possible to respect the settings in it? For example:

generic.upload.tool=esptool
generic.upload.speed=115200
generic.upload.resetmethod=ck
generic.upload.maximum_size=434160
generic.upload.maximum_data_size=81920
generic.upload.wait_for_upload_port=true
generic.serial.disableDTR=true
generic.serial.disableRTS=true

Thanks!

@ivankravets
Copy link
Member

  • Create platformio_extra_script.py in the project near platformio.ini with the content:
from SCons.Script import DefaultEnvironment

env = DefaultEnvironment()

env.Replace(
    MYUPLOADERFLAGS=[
        "-vv",
        "-cd", "nodemcu",
        "-cb", "$UPLOAD_SPEED",
        "-cp", "$UPLOAD_PORT",
        "-ca", "0x00000",
        "-cf", "$SOURCE"
    ],
    UPLOADCMD='$UPLOADER $MYUPLOADERFLAGS',
)
  • Specify extra_script in platformio.ini, for example
[env:esp01]
platform = espressif
framework = arduino
board = esp01
extra_script = platformio_extra_script.py

Did it help you?

@andriyadi
Copy link
Author

Wow... Super helpful! Thanks man!

I'll try tonight. Will confirm the result.

@ivankravets
Copy link
Member

Please re-open this issue if you still need help.

@andriyadi
Copy link
Author

Sorry for late update. I can confirm that your guidance works. Thanks!

@liangzelang
Copy link

@ivankravets could you explain the meaning of the platformio_extra_script.py because i don't learn Python.

@valeros
Copy link
Member

valeros commented May 11, 2016

Hi @andriyadi
Why do you need extra script option?
In two words it's just a python code snippet that can interact with build environment.
You can specify reset method in platformio.ini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants