Use esp tool to pass a value to firmware?

mzincali
Posts: 46
Joined: Wed Jun 08, 2022 7:23 am

Use esp tool to pass a value to firmware?

Postby mzincali » Wed Sep 13, 2023 7:46 pm

Is there a way to inject data for the firmware's use with esp tool?

Two scenarios:

1. uploading the firmware, and at the same time I want to upload some data that the firmware can use on next reboot
2. firmware is already running, and I want to use esptool to inject some data for the firmware to use

The first one could be data that is written to flash or non-volatile RAM, or somewhere else in flash.

The second one, I'm not sure if you can have esptool uploading or making changes while the firmware is running at the same time.

Either possible?

MicroController
Posts: 1552
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Use esp tool to pass a value to firmware?

Postby MicroController » Wed Sep 13, 2023 8:24 pm

1. can be straight forward by uploading/flashing (only) the data for a dedicated partition w/o touching the application's partition. For convenient access, you can also flash to an NVS partition and read the value(s) via the NVS API.

2. when the application is running, you can use the UART used for flashing for any purpose you want, sending and receiving any data you like or even provide a console over serial. However, I think esptool won't be the right tool for the job, as it's made to speak the 'bootloader' protocol with the ESP (and normally resetting the chip first). Any other program capable of sending some data over a serial interface should be usable though (unless it insists on doing certain 'things' with the DTR and RTS signals of the virtual UART...).
If desired, the application can then store the received value(s) to NVS to be still available after future reboots/power cycling.

mzincali
Posts: 46
Joined: Wed Jun 08, 2022 7:23 am

Re: Use esp tool to pass a value to firmware?

Postby mzincali » Fri Sep 15, 2023 10:02 am

Thank you. I will look into #1. Would I be able to write to the same namespaces and use the same keys when I write with esptool or do I have to map things based on offsets or ?

As for #2, I have never been able to get my custom ESP32 to read the serial port, since I don't have an onboard FTDI?

Who is online

Users browsing this forum: Bing [Bot] and 83 guests