|
@@ -31,6 +31,18 @@
|
|
|
|
|
|
static task_handle_t input_sig;
|
|
static task_handle_t input_sig;
|
|
|
|
|
|
|
|
+/* Contents of esp_init_data_default.bin */
|
|
|
|
+extern const uint32_t init_data[];
|
|
|
|
+extern const uint32_t init_data_end[];
|
|
|
|
+__asm__(
|
|
|
|
+ /* Place in .text for same reason as user_start_trampoline */
|
|
|
|
+ ".section \".text\"\n"
|
|
|
|
+ ".align 4\n"
|
|
|
|
+ "init_data:\n"
|
|
|
|
+ ".incbin \"" ESP_INIT_DATA_DEFAULT "\"\n"
|
|
|
|
+ "init_data_end:\n"
|
|
|
|
+ ".previous\n"
|
|
|
|
+);
|
|
|
|
|
|
/* Note: the trampoline *must* be explicitly put into the .text segment, since
|
|
/* Note: the trampoline *must* be explicitly put into the .text segment, since
|
|
* by the time it is invoked the irom has not yet been mapped. This naturally
|
|
* by the time it is invoked the irom has not yet been mapped. This naturally
|
|
@@ -68,26 +80,8 @@ void TEXT_SECTION_ATTR user_start_trampoline (void)
|
|
SPIRead (init_data_addr, &init_data_hdr, sizeof (init_data_hdr));
|
|
SPIRead (init_data_addr, &init_data_hdr, sizeof (init_data_hdr));
|
|
if (init_data_hdr == 0xffffffff)
|
|
if (init_data_hdr == 0xffffffff)
|
|
{
|
|
{
|
|
- // Note: ideally we should generate the actual init data from the
|
|
|
|
- // SDK's bin/esp_init_data_default.bin during the build, and #include it
|
|
|
|
- // straight into this array. E.g.:
|
|
|
|
- // xxd -i esp_init_data_default | tail -n13 | head -n11 > eidd.h
|
|
|
|
- static uint8_t flash_init_data[128] __attribute__((aligned(4))) =
|
|
|
|
- {
|
|
|
|
- 0x05, 0x00, 0x04, 0x02, 0x05, 0x05, 0x05, 0x02, 0x05, 0x00, 0x04, 0x05,
|
|
|
|
- 0x05, 0x04, 0x05, 0x05, 0x04, 0xfe, 0xfd, 0xff, 0xf0, 0xf0, 0xf0, 0xe0,
|
|
|
|
- 0xe0, 0xe0, 0xe1, 0x0a, 0xff, 0xff, 0xf8, 0x00, 0xf8, 0xf8, 0x52, 0x4e,
|
|
|
|
- 0x4a, 0x44, 0x40, 0x38, 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x05,
|
|
|
|
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
- 0x00, 0x00, 0x00, 0x00, 0xe1, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
- 0x00, 0x00, 0x01, 0x93, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
- 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
- };
|
|
|
|
SPIEraseSector (init_data_addr);
|
|
SPIEraseSector (init_data_addr);
|
|
- SPIWrite (init_data_addr, (const uint32_t *)flash_init_data, sizeof (flash_init_data));
|
|
|
|
|
|
+ SPIWrite (init_data_addr, init_data, 4 * (init_data_end - init_data));
|
|
}
|
|
}
|
|
|
|
|
|
call_user_start ();
|
|
call_user_start ();
|