Merge branch 'feature/loadable_elf_c3' into 'master'

build-system: add loadable elf support for ESP32-S2 and C3

Closes IDF-2137

See merge request espressif/esp-idf!12217
pull/7261/head
Ivan Grokhotkov 2021-02-03 19:40:34 +08:00
commit 4edaf134bb
6 zmienionych plików z 41 dodań i 7 usunięć

Wyświetl plik

@ -134,7 +134,7 @@ mainmenu "Espressif IoT Development Framework Configuration"
Select the way the application is built. Select the way the application is built.
By default, the application is built as a binary file in a format compatible with By default, the application is built as a binary file in a format compatible with
the ESP32 bootloader. In addition to this application, 2nd stage bootloader is the ESP-IDF bootloader. In addition to this application, 2nd stage bootloader is
also built. Application and bootloader binaries can be written into flash and also built. Application and bootloader binaries can be written into flash and
loaded/executed from there. loaded/executed from there.
@ -146,7 +146,7 @@ mainmenu "Espressif IoT Development Framework Configuration"
written into flash. written into flash.
Note that at the moment, ESP-IDF does not contain all the startup code required to Note that at the moment, ESP-IDF does not contain all the startup code required to
initialize the CPUs and ROM memory (data/bss). Therefore it is necessary to execute initialize the CPUs and ROM memory (data/bss). Therefore it is necessary to execute
a bit of ROM code prior to executing the application. A gdbinit file may look as follows: a bit of ROM code prior to executing the application. A gdbinit file may look as follows (for ESP32):
# Connect to a running instance of OpenOCD # Connect to a running instance of OpenOCD
target remote :3333 target remote :3333
@ -166,6 +166,8 @@ mainmenu "Espressif IoT Development Framework Configuration"
xtensa-esp32-elf-gdb build/app-name.elf -x gdbinit xtensa-esp32-elf-gdb build/app-name.elf -x gdbinit
Example gdbinit files for other targets can be found in tools/test_apps/system/gdb_loadable_elf/
Recommended sdkconfig.defaults for building loadable ELF files is as follows. Recommended sdkconfig.defaults for building loadable ELF files is as follows.
CONFIG_APP_BUILD_TYPE_ELF_RAM is required, other options help reduce application CONFIG_APP_BUILD_TYPE_ELF_RAM is required, other options help reduce application
memory footprint. memory footprint.

Wyświetl plik

@ -78,8 +78,12 @@ entries:
[scheme:default] [scheme:default]
entries: entries:
text -> flash_text if APP_BUILD_USE_FLASH_SECTIONS = y:
rodata -> flash_rodata text -> flash_text
rodata -> flash_rodata
else:
text -> iram0_text
rodata -> dram0_data
data -> dram0_data data -> dram0_data
bss -> dram0_bss bss -> dram0_bss
common -> dram0_bss common -> dram0_bss

Wyświetl plik

@ -37,10 +37,10 @@ class SerialThread(object):
@ttfw_idf.idf_custom_test(env_tag='test_jtag_arm', group='test-apps') @ttfw_idf.idf_custom_test(env_tag='test_jtag_arm', group='test-apps')
def test_app_loadable_elf(env, extra_data): def test_app_loadable_elf(env, extra_data):
rel_project_path = os.path.join('tools', 'test_apps', 'system', 'gdb_loadable_elf') rel_project_path = os.path.join('tools', 'test_apps', 'system', 'gdb_loadable_elf')
app_files = ['gdb_loadable_elf.elf'] app_files = ['gdb_loadable_elf.elf']
app = ttfw_idf.LoadableElfTestApp(rel_project_path, app_files, target='esp32') target = 'esp32'
app = ttfw_idf.LoadableElfTestApp(rel_project_path, app_files, target=target)
idf_path = app.get_sdk_path() idf_path = app.get_sdk_path()
proj_path = os.path.join(idf_path, rel_project_path) proj_path = os.path.join(idf_path, rel_project_path)
elf_path = os.path.join(app.binary_path, 'gdb_loadable_elf.elf') elf_path = os.path.join(app.binary_path, 'gdb_loadable_elf.elf')
@ -49,7 +49,7 @@ def test_app_loadable_elf(env, extra_data):
with SerialThread(esp_log_path): with SerialThread(esp_log_path):
openocd_log = os.path.join(proj_path, 'openocd.log') openocd_log = os.path.join(proj_path, 'openocd.log')
gdb_log = os.path.join(proj_path, 'gdb.log') gdb_log = os.path.join(proj_path, 'gdb.log')
gdb_init = os.path.join(proj_path, 'gdbinit') gdb_init = os.path.join(proj_path, 'gdbinit_' + target)
gdb_dir = os.path.join(proj_path, 'main') gdb_dir = os.path.join(proj_path, 'main')
with ttfw_idf.OCDBackend(openocd_log, app.target): with ttfw_idf.OCDBackend(openocd_log, app.target):

Wyświetl plik

@ -0,0 +1,14 @@
set pagination off
# Connect to a running instance of OpenOCD
target remote 127.0.0.1:3333
# Reset and halt the target
mon reset halt
# Run to a specific point in ROM code,
# where most of initialization is complete.
thb *0x40047654
c
# Load the application into RAM
load
# Run till app_main
tb app_main
c

Wyświetl plik

@ -0,0 +1,14 @@
set pagination off
# Connect to a running instance of OpenOCD
target remote 127.0.0.1:3333
# Reset and halt the target
mon reset halt
# Run to a specific point in ROM code,
# where most of initialization is complete.
thb *0x4000f6e2
c
# Load the application into RAM
load
# Run till app_main
tb app_main
c