Page 1 of 1

ROM Serial Bootlader

Posted: Thu May 09, 2019 8:58 am
by fgerenli
Hi to all.

There is a ROM serial bootloader residing in the ROM of the SoC as i know. It is triggered during the power on by the configuraiton of bootstrapping pins.
I wonder if it is possible to trigger ROM serial bootlader from flash application. I mean of course for the first time i will flash my appplication by using ROM serial bootlader and bootstrapping pins. But for the next time, i will call ROM serial bootlader from my application if i receive a special BLE message for example, without a need of bootstrapping pin configuration. Is it possible?

Regards.

Re: ROM Serial Bootlader

Posted: Thu May 09, 2019 11:51 am
by ESP_igrr
No, this is not possible. ROM download mode can only be triggered by strapping pins configuration. It can also not be entered from IDF using a function call, as the ROM bootloader uses static memory range which is used in IDF for the heap.

You can however use the esp_ota_* APIs to perform an update. The source of the update can be anything: downloading a binary file over HTTPS, reading it from the UART via Ymodem protocol, loading it from an SD card, etc.

Re: ROM Serial Bootlader

Posted: Thu May 09, 2019 2:03 pm
by fgerenli
Thank you Ivan.

It is a good idea to use OTA API with an "alternative data input port".
Below is a part of the esp_https_ota source under "esp-idf/components". Examining the the whole source, it seems it is possible to make it working.

Code: Select all

while (1) {
	int data_read = esp_http_client_read(client, upgrade_data_buf, alloc_size);
	if (data_read == 0) {
		ESP_LOGI(TAG, "Connection closed, all data received");
		break;
	}
	if (data_read < 0) {
		ESP_LOGE(TAG, "Error: SSL data read error");
		break;
	}
	if (data_read > 0) {
		ota_write_err = esp_ota_write(update_handle, (const void *) upgrade_data_buf, data_read);
		if (ota_write_err != ESP_OK) {
			break;
		}
		binary_file_len += data_read;
		ESP_LOGD(TAG, "Written image length %d", binary_file_len);
	}
}
We will give a try with a new function to read the new binary from UART instead of HTTP server. Of course editing the rest.

Regards.

Re: ROM Serial Bootlader

Posted: Mon Jun 10, 2019 9:22 am
by tangqingcai
hello fgerenli ;
you say you will "give a try with a new function to read the new binary from UART " ?
is there achieved?
i have an idea about esp32 connect to MCU(like STM32) via UART;
then i want to upgrade esp32 firmware by STM32 via UART in bootloader step;
perhaps it is same to your function;