Custom Partition Table

gregstewart90
Posts: 59
Joined: Thu Jan 19, 2017 5:17 pm

Custom Partition Table

Postby gregstewart90 » Thu Jun 08, 2017 4:24 pm

I'm working on a project that uses wifi, ble, and an external library called libssh2. After everything is compiled my .bin file is over 1007504 in size. This is a problem for OTA updates. I decided to create a custom partition table which I have below.

Code: Select all

# Name,   Type, SubType, Offset,   Size
nvs,      data, nvs,     0x9000,  0x4000
otadata,  data, ota,     0xd000,  0x2000
phy_init, data, phy,     0xf000,  0x1000
ota_0,    app,  ota_0,   0x10000,  1500K
ota_1,    app,  ota_1,   ,         1500K
The problem is when I start an OTA update, I get some error which causes a reboot.

Code: Select all

void init_ota(){
	esp_err_t err;
	/* update handle : set by esp_ota_begin(), must be freed via esp_ota_end() */
	update_handle = 0 ;
	update_partition = NULL;

	ESP_LOGI(TAG, "Starting OTA Update...");

	const esp_partition_t *configured = esp_ota_get_boot_partition();
	const esp_partition_t *running = esp_ota_get_running_partition();

	assert(configured == running); /* fresh from reset, should be running from configured boot partition */
	ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)",
			configured->type, configured->subtype, configured->address);



	update_partition = esp_ota_get_next_update_partition(NULL);
	ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%x",
			update_partition->subtype, update_partition->address);
	assert(update_partition != NULL);

	err = esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle);
	if (err != ESP_OK) {
		ESP_LOGE(TAG, "esp_ota_begin failed, error=%d", err);
		task_fatal_error();
	}
	ESP_LOGI(TAG, "esp_ota_begin succeeded");
}

Code: Select all

I (30546) ota: Starting OTA Update...
I (30556) ota: Running partition type 0 subtype 16 (offset 0x00010000)
I (30556) ota: Writing to partition subtype 17 at offset 0x170000
I (30576) ota: esp_ota_begin succeeded
I (30576) wifi: bcn_timout,ap_probe_send_start
Guru Meditation Error of type LoadProhibited occurred on core  0. Exception was unhandled.
Register dump:
PC      : 0x40084ecd  PS      : 0x00060e33  A0      : 0x800e349e  A1      : 0x3ffdce70
0x40084ecd: ets_timer_disarm at ??:?

A2      : 0x3ffc54c8  A3      : 0x3ffc24c0  A4      : 0x3ffc41b4  A5      : 0x00000200
A6      : 0x3ffc5220  A7      : 0x00000000  A8      : 0xffffffff  A9      : 0xffffffff
A10     : 0x3ffc24c0  A11     : 0x00060e20  A12     : 0x00060e20  A13     : 0x3ffeeac0
A14     : 0x00000000  A15     : 0x3ffc891c  SAR     : 0x0000001e  EXCCAUSE: 0x0000001c
EXCVADDR: 0xffffffff  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff

Backtrace: 0x40084ecd:0x3ffdce70 0x400e349e:0x3ffdce90 0x400e51a0:0x3ffdceb0 0x400e6f45:0x3ffdcee0
0x40084ecd: ets_timer_disarm at ??:?

0x400e349e: pm_on_data_tx_done at ??:?

0x400e51a0: ppProcTxDone at ??:?

0x400e6f45: ppTask at ??:?
I checked the core dump, but it had errors too. Any idea what is happening? Or is there a way to decrease the size of my .bin file? I've already disabled the ble functionality I don't need.

ESP_Sprite
Posts: 9835
Joined: Thu Nov 26, 2015 4:08 am

Re: Custom Partition Table

Postby ESP_Sprite » Fri Jun 09, 2017 7:27 am

At least one issue I can see is that your 1500K partition size isn't divisable by 64K, meaning the 2nd OTA partition is going to land on a non-64K-boundary and the MMU is going to have issues mapping it. Either make the value a multiple of 64K or manually specify a 64K-aligned offset.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 75 guests