How to implement a simple UART bootloader
Posted: Sat Dec 08, 2018 2:41 pm
Hello everyone,
I'm in need of some clarification and suggestions about a future project.
This project involves an ESP32 powered board connected via a 485 serial cable to a master. It should be possible for both devices' firmware to be upgradable, so I would be killing two birds with one stone if I was able to connect to the master and then flash the ESP32 board through the UART connection.
Now, the perfect solution would be to simply use the default flashing UART port for both programming and communicating. This however poses two problems:
1. The bootloader serial protocol looks cumbersome to implement. It should be implemented in a similar MCU-powered board from scratch.
2. I should add two signals to the serial cable to manage IO0 and reset.
Additionally I would like to avoid flashing the whole binary every time (libraries, FreeRTOS and such). The firmware itself should be pretty simple.
Assuming my understanding up until now is correct, what I would need is to receive the firmware update as part of the normal communication protocol, store it somewhere (possibly NVS flash), check it and then overwrite my own flash.
In many ways it's similar to this question https://www.esp32.com/viewtopic.php?t=2655 which has an answer from Kolban himself. Starting from that I studied a bit and at this point I'm not sure how I should proceed. Can I split my binary firmware into "framework" and "app"? The esp-idf makefile environment has an "app-flash" option, is it what I need?
I guess the official solution to this is the whole OTA section of the esp-idf, but here I am not using either WiFi or Bluetooth, just plain UART.
I'm in need of some clarification and suggestions about a future project.
This project involves an ESP32 powered board connected via a 485 serial cable to a master. It should be possible for both devices' firmware to be upgradable, so I would be killing two birds with one stone if I was able to connect to the master and then flash the ESP32 board through the UART connection.
Now, the perfect solution would be to simply use the default flashing UART port for both programming and communicating. This however poses two problems:
1. The bootloader serial protocol looks cumbersome to implement. It should be implemented in a similar MCU-powered board from scratch.
2. I should add two signals to the serial cable to manage IO0 and reset.
Additionally I would like to avoid flashing the whole binary every time (libraries, FreeRTOS and such). The firmware itself should be pretty simple.
Assuming my understanding up until now is correct, what I would need is to receive the firmware update as part of the normal communication protocol, store it somewhere (possibly NVS flash), check it and then overwrite my own flash.
In many ways it's similar to this question https://www.esp32.com/viewtopic.php?t=2655 which has an answer from Kolban himself. Starting from that I studied a bit and at this point I'm not sure how I should proceed. Can I split my binary firmware into "framework" and "app"? The esp-idf makefile environment has an "app-flash" option, is it what I need?
I guess the official solution to this is the whole OTA section of the esp-idf, but here I am not using either WiFi or Bluetooth, just plain UART.