Skip to content

Commit eeb0d52

Browse files
committed
loaders/esp: add support for detection of 32-256MB flash chips to the esp stubs
1 parent 8b98a86 commit eeb0d52

18 files changed

+888
-865
lines changed

contrib/loaders/flash/esp/esp32/stub_flasher_data.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@
6464
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6565
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00,
6666
0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00,
67-
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
68-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67+
0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02,
6968
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7069
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70+
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10,
7171
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7272
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7373
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

contrib/loaders/flash/esp/esp32c2/sdkconfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16
2828
/* TODO: use current clk, get it from PLL settings */
2929
#define CONFIG_ESP32C2_DEFAULT_CPU_FREQ_MHZ 120
30-
#define CONFIG_ESP32C2_XTAL_FREQ 40
31-
#define CONFIG_ESP32C2_XTAL_FREQ_40 1
30+
#define CONFIG_XTAL_FREQ 40
31+
#define CONFIG_XTAL_FREQ_40 1
3232
/* Unused by stub, just for compilation of IDF */
3333
#define CONFIG_PARTITION_TABLE_OFFSET 0x8000
3434
#define CONFIG_MMU_PAGE_SIZE 0x10000 /* 64KB */

contrib/loaders/flash/esp/esp32c2/stub_flasher_chip.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include "stub_flasher_int.h"
3838
#include "stub_flasher_chip.h"
3939
#include "stub_flasher.h"
40-
#include "esp_app_trace_port.h"
4140

4241
#define EFUSE_WR_DIS_SPI_BOOT_CRYPT_CNT (1 << 4)
4342

@@ -112,7 +111,7 @@ int xPortInIsrContext(void)
112111
return 0;
113112
}
114113

115-
esp_apptrace_hw_t *esp_apptrace_uart_hw_get(int num, void **data)
114+
void *esp_apptrace_uart_hw_get(int num, void **data)
116115
{
117116
return NULL;
118117
}

contrib/loaders/flash/esp/esp32c2/stub_flasher_code.inc

Lines changed: 438 additions & 426 deletions
Large diffs are not rendered by default.

contrib/loaders/flash/esp/esp32c2/stub_flasher_data.inc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
0x32, 0x03, 0x38, 0x40, 0x16, 0x05, 0x38, 0x40, 0x00, 0x00, 0x38, 0x40,
2-
0x28, 0x07, 0x38, 0x40, 0x3a, 0x07, 0x38, 0x40, 0x1a, 0x00, 0x38, 0x40,
3-
0xf6, 0x05, 0x38, 0x40, 0x32, 0x00, 0x38, 0x40, 0x44, 0x00, 0x38, 0x40,
1+
0x4a, 0x03, 0x38, 0x40, 0xb6, 0x06, 0x38, 0x40, 0x30, 0x03, 0x38, 0x40,
2+
0x2e, 0x05, 0x38, 0x40, 0x88, 0x05, 0x38, 0x40, 0x18, 0x03, 0x38, 0x40,
3+
0xd6, 0x05, 0x38, 0x40, 0x06, 0x03, 0x38, 0x40, 0xec, 0x02, 0x38, 0x40,
44
0x00, 0x00, 0x00, 0x00, 0x5c, 0x40, 0xca, 0x3f, 0x00, 0x00, 0x00, 0x00,
55
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x38, 0x40,
9-
0xde, 0x00, 0x38, 0x40, 0xae, 0x00, 0x38, 0x40, 0xe2, 0x00, 0x38, 0x40,
10-
0x4c, 0x13, 0x38, 0x40, 0x6a, 0x13, 0x38, 0x40, 0x56, 0x13, 0x38, 0x40,
11-
0x60, 0x13, 0x38, 0x40, 0x94, 0x14, 0x38, 0x40, 0x84, 0x13, 0x38, 0x40,
12-
0xd8, 0x13, 0x38, 0x40, 0x3a, 0x14, 0x38, 0x40, 0x94, 0x14, 0x38, 0x40,
13-
0x72, 0x13, 0x38, 0x40, 0x7a, 0x13, 0x38, 0x40, 0x48, 0x13, 0x38, 0x40,
8+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x02, 0x38, 0x40,
9+
0x62, 0x02, 0x38, 0x40, 0x70, 0x02, 0x38, 0x40, 0x54, 0x02, 0x38, 0x40,
10+
0xc8, 0x13, 0x38, 0x40, 0xea, 0x13, 0x38, 0x40, 0xd4, 0x13, 0x38, 0x40,
11+
0xde, 0x13, 0x38, 0x40, 0x26, 0x15, 0x38, 0x40, 0x00, 0x14, 0x38, 0x40,
12+
0x68, 0x14, 0x38, 0x40, 0xcc, 0x14, 0x38, 0x40, 0x26, 0x15, 0x38, 0x40,
13+
0xf0, 0x13, 0x38, 0x40, 0xf6, 0x13, 0x38, 0x40, 0x82, 0x14, 0x38, 0x40,
1414
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00,
1515
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x80, 0x00,
16-
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16+
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
1917
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
19+
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
2020
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2121
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2222
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#define ESP32C2_STUB_BSS_SIZE 0x0000138UL
1+
#define ESP32C2_STUB_BSS_SIZE 0x0000135UL
22

3-
#define ESP32C2_STUB_ENTRY_ADDR 0x04038116eUL
3+
#define ESP32C2_STUB_ENTRY_ADDR 0x0403811b0UL
44

5-
#define ESP32C2_STUB_APPTRACE_CTRL_ADDR 0x03fca4144UL
5+
#define ESP32C2_STUB_APPTRACE_CTRL_ADDR 0x03fca415cUL
66

7-
/*#define ESP32C2_STUB_BUILD_IDF_REV 06b31d487b
7+
/*#define ESP32C2_STUB_BUILD_IDF_REV b5f69e5fb7
88
*/

contrib/loaders/flash/esp/esp32c3/stub_flasher_chip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ void stub_uart_console_configure()
289289
uint32_t clock = ets_get_apb_freq();
290290
ets_update_cpu_frequency(clock / 1000000);
291291

292-
Uart_Init(ets_efuse_get_uart_print_channel(), UART_CLK_FREQ_ROM);
292+
Uart_Init(0, UART_CLK_FREQ_ROM);
293293
/* install to print later
294294
* Non-Flash Boot can print
295295
* Flash Boot can print when RTC_CNTL_STORE4_REG bit0 is 0 (can be 1 after deep sleep, software reset) and printf boot.

contrib/loaders/flash/esp/esp32c3/stub_flasher_code.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@
250250
0xfd, 0x54, 0xe9, 0xb7, 0x93, 0x77, 0x34, 0x00, 0xfd, 0xd7, 0x71, 0x98,
251251
0x6d, 0xf4, 0x8d, 0x47, 0xe3, 0xe8, 0x37, 0xff, 0xa1, 0x67, 0x61, 0x74,
252252
0xc1, 0x07, 0x71, 0x14, 0x8a, 0x97, 0x3e, 0x94, 0x11, 0x46, 0xa2, 0x85,
253-
0x33, 0x05, 0x59, 0x01, 0x15, 0x3e, 0x79, 0xf9, 0x4e, 0x85, 0xef, 0xf0,
253+
0x33, 0x85, 0x2a, 0x01, 0x15, 0x3e, 0x79, 0xf9, 0x4e, 0x85, 0xef, 0xf0,
254254
0x0f, 0xcc, 0xaa, 0x84, 0x71, 0xd5, 0x4e, 0x86, 0xa2, 0x85, 0x97, 0xf0,
255255
0xc7, 0xff, 0xe7, 0x80, 0x20, 0x77, 0x26, 0x85, 0xef, 0xf0, 0x8f, 0xc5,
256256
0x45, 0xfd, 0xef, 0xf0, 0xaf, 0xc0, 0xaa, 0x84, 0x35, 0xdd, 0x7d, 0xb7,
257-
0xaa, 0x85, 0x22, 0x86, 0x33, 0x05, 0x59, 0x01, 0x01, 0x36, 0xaa, 0x89,
257+
0xaa, 0x85, 0x22, 0x86, 0x33, 0x85, 0x2a, 0x01, 0x01, 0x36, 0xaa, 0x89,
258258
0x5a, 0x85, 0xef, 0xf0, 0xaf, 0xc3, 0x33, 0xe5, 0xa9, 0x00, 0x59, 0xf9,
259259
0x22, 0x99, 0xef, 0xf0, 0x6f, 0xbe, 0x39, 0xd9, 0x71, 0xb7, 0xb7, 0x47,
260260
0xc8, 0x3f, 0x83, 0xc6, 0x07, 0x30, 0x3e, 0x87, 0xb9, 0xca, 0xb7, 0x97,

contrib/loaders/flash/esp/esp32c3/stub_flasher_data.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
0x68, 0x12, 0x38, 0x40, 0x6e, 0x12, 0x38, 0x40, 0x9a, 0x13, 0x38, 0x40,
1414
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00,
1515
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x80, 0x00,
16-
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16+
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
1917
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
19+
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
2020
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2121
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2222
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

contrib/loaders/flash/esp/esp32c6/stub_flasher_chip.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "stub_flasher_int.h"
3737
#include "stub_flasher_chip.h"
3838
#include "stub_flasher.h"
39-
#include "esp_app_trace_port.h"
4039

4140
#define EFUSE_WR_DIS_SPI_BOOT_CRYPT_CNT (1 << 4)
4241

@@ -105,7 +104,7 @@ int xPortInIsrContext(void)
105104
return 0;
106105
}
107106

108-
esp_apptrace_hw_t *esp_apptrace_uart_hw_get(int num, void **data)
107+
void *esp_apptrace_uart_hw_get(int num, void **data)
109108
{
110109
return NULL;
111110
}

0 commit comments

Comments
 (0)