esp32: remove ROM functions redefined in IDF from LD script

In some cases, linker could choose to use ROM functions instead of the
ones defined in IDF.
For functions used in ROM stub table, this would lead to infinite
recursion when the corresponding function was called from ROM.
For crypto functions, some of these were modified in IDF, and
incompatible with ROM counterparts.
This commit is contained in:
Ivan Grokhotkov 2018-09-26 20:46:15 +08:00 committed by bot
parent f694d057be
commit 9240bbb708
6 changed files with 66 additions and 54 deletions

View File

@ -1 +1,4 @@
PROVIDE ( ets_update_cpu_frequency = 0x40008550 ); /* Updates g_ticks_per_us on the current CPU only; not on the other core */
PROVIDE ( MD5Final = 0x4005db1c );
PROVIDE ( MD5Init = 0x4005da7c );
PROVIDE ( MD5Update = 0x4005da9c );

View File

@ -3,19 +3,13 @@ ESP32 ROM address table
Generated for ROM with MD5sum:
ab8282ae908fe9e7a63fb2a4ac2df013 ../../rom_image/prorom.elf
*/
PROVIDE ( abort = 0x4000bba4 );
PROVIDE ( Add2SelfBigHex256 = 0x40015b7c );
PROVIDE ( AddBigHex256 = 0x40015b28 );
PROVIDE ( AddBigHexModP256 = 0x40015c98 );
PROVIDE ( AddP256 = 0x40015c74 );
PROVIDE ( AddPdiv2_256 = 0x40015ce0 );
PROVIDE ( aes_128_cbc_decrypt = 0x4005cc7c );
PROVIDE ( aes_128_cbc_encrypt = 0x4005cc18 );
PROVIDE ( aes_unwrap = 0x4005ccf0 );
PROVIDE ( app_gpio_arg = 0x3ffe003c );
PROVIDE ( app_gpio_handler = 0x3ffe0040 );
PROVIDE ( base64_decode = 0x4005ced8 );
PROVIDE ( base64_encode = 0x4005cdbc );
PROVIDE ( BasePoint_x_256 = 0x3ff97488 );
PROVIDE ( BasePoint_y_256 = 0x3ff97468 );
PROVIDE ( bigHexInversion256 = 0x400168f0 );
@ -97,12 +91,8 @@ PROVIDE ( ets_startup_callback = 0x3ffe0404 );
PROVIDE ( exc_cause_table = 0x3ff991d0 );
PROVIDE ( _exit_r = 0x4000bd28 );
PROVIDE ( free = 0x4000beb8 );
PROVIDE ( _free_r = 0x4000bbcc );
PROVIDE ( _fstat_r = 0x4000bccc );
PROVIDE ( __gcc_bcmp = 0x40064a70 );
PROVIDE ( _getpid_r = 0x4000bcfc );
PROVIDE ( __getreent = 0x4000be8c );
PROVIDE ( _gettimeofday_r = 0x4000bc58 );
PROVIDE ( GF_Jacobian_Point_Addition256 = 0x400163a4 );
PROVIDE ( GF_Jacobian_Point_Double256 = 0x40016260 );
PROVIDE ( GF_Point_Jacobian_To_Affine256 = 0x40016b0c );
@ -126,16 +116,9 @@ PROVIDE ( hci_evt_dbg_desc_tab = 0x3ff9750c );
PROVIDE ( hci_evt_desc_tab = 0x3ff9751c );
PROVIDE ( hci_evt_le_desc_tab = 0x3ff974b4 );
PROVIDE ( hci_fc_env = 0x3ffb9340 );
PROVIDE ( hmac_md5 = 0x4005d264 );
PROVIDE ( hmac_md5_vector = 0x4005d17c );
PROVIDE ( hmac_sha1 = 0x40060acc );
PROVIDE ( hmac_sha1_vector = 0x400609e4 );
PROVIDE ( hmac_sha256 = 0x40060d58 );
PROVIDE ( hmac_sha256_vector = 0x40060c84 );
PROVIDE ( jd_decomp = 0x400613e8 );
PROVIDE ( jd_prepare = 0x40060fa8 );
PROVIDE ( ke_env = 0x3ffb93cc );
PROVIDE ( _kill_r = 0x4000bd10 );
PROVIDE ( lb_default_handler = 0x3ff982b8 );
PROVIDE ( lb_default_state_tab_p_get = 0x4001c198 );
PROVIDE ( lb_env = 0x3ffb9424 );
@ -198,23 +181,10 @@ PROVIDE ( lm_n_page_tab = 0x3ff990e8 );
PROVIDE ( lmp_desc_tab = 0x3ff96e6c );
PROVIDE ( lmp_ext_desc_tab = 0x3ff96d9c );
PROVIDE ( lm_state = 0x3ffb9a1c );
PROVIDE ( _lock_acquire_recursive = 0x4000be28 );
PROVIDE ( _lock_close = 0x4000bdec );
PROVIDE ( _lock_close_recursive = 0x4000be00 );
PROVIDE ( _lock_init = 0x4000bdc4 );
PROVIDE ( _lock_init_recursive = 0x4000bdd8 );
PROVIDE ( _lock_release_recursive = 0x4000be78 );
PROVIDE ( _lock_try_acquire = 0x4000be3c );
PROVIDE ( _lock_try_acquire_recursive = 0x4000be50 );
PROVIDE ( _lseek_r = 0x4000bd8c );
PROVIDE ( malloc = 0x4000bea0 );
PROVIDE ( _malloc_r = 0x4000bbb4 );
PROVIDE ( maxSecretKey_256 = 0x3ff97448 );
PROVIDE ( __mb_cur_max = 0x3ff96530 );
PROVIDE ( MD5Final = 0x4005db1c );
PROVIDE ( MD5Init = 0x4005da7c );
PROVIDE ( MD5Update = 0x4005da9c );
PROVIDE ( md5_vector = 0x4005db80 );
PROVIDE ( mmu_init = 0x400095a4 );
PROVIDE ( __month_lengths = 0x3ff9609c );
PROVIDE ( MultiplyBigHexByUint32_256 = 0x40016214 );
@ -227,7 +197,6 @@ PROVIDE ( mz_free = 0x4005eed4 );
PROVIDE ( notEqual256 = 0x40015b04 );
PROVIDE ( one_bits = 0x3ff971f8 );
PROVIDE ( _open_r = 0x4000bd54 );
PROVIDE ( pbkdf2_sha1 = 0x40060ba4 );
PROVIDE ( phy_get_romfuncs = 0x40004100 );
PROVIDE ( _Pri_4_HandlerAddress = 0x3ffe0648 );
PROVIDE ( _Pri_5_HandlerAddress = 0x3ffe064c );
@ -245,7 +214,6 @@ PROVIDE ( r_bt_util_buf_sync_rx_alloc = 0x40010468 );
PROVIDE ( r_bt_util_buf_sync_rx_free = 0x4001049c );
PROVIDE ( r_bt_util_buf_sync_tx_alloc = 0x400103ec );
PROVIDE ( r_bt_util_buf_sync_tx_free = 0x40010428 );
PROVIDE ( rc4_skip = 0x40060928 );
PROVIDE ( r_co_bdaddr_compare = 0x40014324 );
PROVIDE ( r_co_bytes_to_string = 0x400142e4 );
PROVIDE ( r_co_list_check_size_available = 0x400142c4 );
@ -292,7 +260,6 @@ PROVIDE ( r_ea_interval_remove = 0x40015590 );
PROVIDE ( ea_conflict_check = 0x40014e9c );
PROVIDE ( ea_prog_timer = 0x40014f88 );
PROVIDE ( realloc = 0x4000becc );
PROVIDE ( _realloc_r = 0x4000bbe0 );
PROVIDE ( r_ea_offset_req = 0x40015748 );
PROVIDE ( r_ea_sleep_check = 0x40015928 );
PROVIDE ( r_ea_sw_isr = 0x40015724 );
@ -1315,14 +1282,9 @@ PROVIDE ( rwip_priority = 0x3ff99159 );
PROVIDE ( rwip_rf = 0x3ffbdb28 );
PROVIDE ( rwip_rf_p_get = 0x400558f4 );
PROVIDE ( r_XorKey = 0x400112c0 );
PROVIDE ( _sbrk_r = 0x4000bce4 );
PROVIDE ( __sf_fake_stderr = 0x3ff96458 );
PROVIDE ( __sf_fake_stdin = 0x3ff96498 );
PROVIDE ( __sf_fake_stdout = 0x3ff96478 );
PROVIDE ( sha1_prf = 0x40060ae8 );
PROVIDE ( sha1_vector = 0x40060b64 );
PROVIDE ( sha256_prf = 0x40060d70 );
PROVIDE ( sha256_vector = 0x40060e08 );
PROVIDE ( sha_blk_bits = 0x3ff99290 );
PROVIDE ( sha_blk_bits_bytes = 0x3ff99288 );
PROVIDE ( sha_blk_hash_bytes = 0x3ff9928c );
@ -1378,7 +1340,6 @@ PROVIDE ( tdefl_get_prev_return_status = 0x400608d0 );
PROVIDE ( tdefl_init = 0x40060810 );
PROVIDE ( tdefl_write_image_to_png_file_in_memory = 0x4006091c );
PROVIDE ( tdefl_write_image_to_png_file_in_memory_ex = 0x40060910 );
PROVIDE ( _times_r = 0x4000bc40 );
PROVIDE ( _timezone = 0x3ffae0a0 );
PROVIDE ( tinfl_decompress = 0x4005ef30 );
PROVIDE ( tinfl_decompress_mem_to_callback = 0x40060090 );
@ -1511,7 +1472,6 @@ PROVIDE ( uart_tx_flush = 0x40009258 );
PROVIDE ( uart_tx_one_char = 0x40009200 );
PROVIDE ( uart_tx_one_char2 = 0x4000922c );
PROVIDE ( uart_tx_switch = 0x40009028 );
PROVIDE ( uart_tx_wait_idle = 0x40009278 );
/*
@ -1578,8 +1538,6 @@ PROVIDE ( ets_efuse_read_op = 0x40008600 );
PROVIDE ( ets_intr_lock = 0x400067b0 );
PROVIDE ( ets_intr_unlock = 0x400067c4 );
PROVIDE ( ets_isr_attach = 0x400067ec );
PROVIDE ( ets_isr_mask = 0x400067fc );
PROVIDE ( ets_isr_unmask = 0x40006808 );
PROVIDE ( ets_waiti0 = 0x400067d8 );
PROVIDE ( intr_matrix_set = 0x4000681c );
PROVIDE ( check_pos = 0x400068b8 );
@ -1619,13 +1577,6 @@ PROVIDE ( ets_delay_us = 0x40008534 );
PROVIDE ( ets_get_cpu_frequency = 0x4000855c );
PROVIDE ( ets_get_detected_xtal_freq = 0x40008588 );
PROVIDE ( ets_get_xtal_scale = 0x4000856c );
PROVIDE ( ets_timer_arm = 0x40008368 );
PROVIDE ( ets_timer_arm_us = 0x400083ac );
PROVIDE ( ets_timer_disarm = 0x400083ec );
PROVIDE ( ets_timer_done = 0x40008428 );
PROVIDE ( ets_timer_handler_isr = 0x40008454 );
PROVIDE ( ets_timer_init = 0x400084e8 );
PROVIDE ( ets_timer_setfn = 0x40008350 );
PROVIDE ( ets_update_cpu_frequency_rom = 0x40008550 ); /* Updates g_ticks_per_us on the current CPU only; not on the other core */
/* Following are static data, but can be used, not generated by script <<<<< btdm data */

View File

@ -0,0 +1,60 @@
/*
ROM Functions defined in this file are not used in ESP-IDF as is,
and different definitions for functions with the same names are provided.
This file is not used when linking ESP-IDF and is intended for reference only
*/
PROVIDE ( abort = 0x4000bba4 );
PROVIDE ( aes_128_cbc_decrypt = 0x4005cc7c );
PROVIDE ( aes_128_cbc_encrypt = 0x4005cc18 );
PROVIDE ( aes_unwrap = 0x4005ccf0 );
PROVIDE ( base64_decode = 0x4005ced8 );
PROVIDE ( base64_encode = 0x4005cdbc );
PROVIDE ( ets_isr_mask = 0x400067fc );
PROVIDE ( ets_isr_unmask = 0x40006808 );
PROVIDE ( ets_timer_arm = 0x40008368 );
PROVIDE ( ets_timer_arm_us = 0x400083ac );
PROVIDE ( ets_timer_disarm = 0x400083ec );
PROVIDE ( ets_timer_done = 0x40008428 );
PROVIDE ( ets_timer_init = 0x400084e8 );
PROVIDE ( ets_timer_handler_isr = 0x40008454 );
PROVIDE ( ets_timer_setfn = 0x40008350 );
PROVIDE ( _free_r = 0x4000bbcc );
PROVIDE ( _getpid_r = 0x4000bcfc );
PROVIDE ( __getreent = 0x4000be8c );
PROVIDE ( _gettimeofday_r = 0x4000bc58 );
PROVIDE ( hmac_md5 = 0x4005d264 );
PROVIDE ( hmac_md5_vector = 0x4005d17c );
PROVIDE ( hmac_sha1 = 0x40060acc );
PROVIDE ( hmac_sha1_vector = 0x400609e4 );
PROVIDE ( hmac_sha256 = 0x40060d58 );
PROVIDE ( hmac_sha256_vector = 0x40060c84 );
PROVIDE ( _kill_r = 0x4000bd10 );
PROVIDE ( _lock_acquire = 0x4000be14 );
PROVIDE ( _lock_acquire_recursive = 0x4000be28 );
PROVIDE ( _lock_close = 0x4000bdec );
PROVIDE ( _lock_close_recursive = 0x4000be00 );
PROVIDE ( _lock_init = 0x4000bdc4 );
PROVIDE ( _lock_init_recursive = 0x4000bdd8 );
PROVIDE ( _lock_release = 0x4000be64 );
PROVIDE ( _lock_release_recursive = 0x4000be78 );
PROVIDE ( _lock_try_acquire = 0x4000be3c );
PROVIDE ( _lock_try_acquire_recursive = 0x4000be50 );
PROVIDE ( _malloc_r = 0x4000bbb4 );
PROVIDE ( MD5Final = 0x4005db1c );
PROVIDE ( MD5Init = 0x4005da7c );
PROVIDE ( MD5Update = 0x4005da9c );
PROVIDE ( md5_vector = 0x4005db80 );
PROVIDE ( pbkdf2_sha1 = 0x40060ba4 );
PROVIDE ( rc4_skip = 0x40060928 );
PROVIDE ( _raise_r = 0x4000bc70 );
PROVIDE ( _realloc_r = 0x4000bbe0 );
PROVIDE ( _sbrk_r = 0x4000bce4 );
PROVIDE ( sha1_prf = 0x40060ae8 );
PROVIDE ( sha1_vector = 0x40060b64 );
PROVIDE ( sha256_prf = 0x40060d70 );
PROVIDE ( sha256_vector = 0x40060e08 );
PROVIDE ( _system_r = 0x4000bc10 );
PROVIDE ( _times_r = 0x4000bc40 );
PROVIDE ( uart_tx_wait_idle = 0x40009278 );

View File

@ -64,8 +64,6 @@ PROVIDE ( __locale_mb_cur_max = 0x40059548 );
PROVIDE ( __locale_msgcharset = 0x40059550 );
PROVIDE ( localtime = 0x400595dc );
PROVIDE ( localtime_r = 0x400595fc );
PROVIDE ( _lock_acquire = 0x4000be14 );
PROVIDE ( _lock_release = 0x4000be64 );
PROVIDE ( longjmp = 0x400562cc );
PROVIDE ( memccpy = 0x4000c220 );
PROVIDE ( memchr = 0x4000c244 );
@ -77,7 +75,6 @@ PROVIDE ( memset = 0x4000c44c );
PROVIDE ( mktime = 0x4005a5e8 );
PROVIDE ( open = 0x4000178c );
PROVIDE ( qsort = 0x40056424 );
PROVIDE ( _raise_r = 0x4000bc70 );
PROVIDE ( rand = 0x40001058 );
PROVIDE ( rand_r = 0x400010d4 );
PROVIDE ( read = 0x400017dc );
@ -145,7 +142,6 @@ PROVIDE ( __swbuf = 0x40058cb4 );
PROVIDE ( __swbuf_r = 0x40058bec );
PROVIDE ( __swrite = 0x40001150 );
PROVIDE ( __swsetup_r = 0x40058cc8 );
PROVIDE ( _system_r = 0x4000bc10 );
PROVIDE ( time = 0x40001844 );
PROVIDE ( __time_load_locale = 0x4000183c );
PROVIDE ( times = 0x40001808 );

View File

@ -118,6 +118,8 @@ void IRAM_ATTR _lock_close(_lock_t *lock) {
portEXIT_CRITICAL(&lock_init_spinlock);
}
void IRAM_ATTR _lock_close_recursive(_lock_t *lock) __attribute__((alias("_lock_close")));
/* Acquire the mutex semaphore for lock. wait up to delay ticks.
mutex_type is queueQUEUE_TYPE_RECURSIVE_MUTEX or queueQUEUE_TYPE_MUTEX
*/

View File

@ -74,7 +74,7 @@ static struct syscall_stub_table s_stub_table = {
._lock_init = &_lock_init,
._lock_init_recursive = &_lock_init_recursive,
._lock_close = &_lock_close,
._lock_close_recursive = &_lock_close,
._lock_close_recursive = &_lock_close_recursive,
._lock_acquire = &_lock_acquire,
._lock_acquire_recursive = &_lock_acquire_recursive,
._lock_try_acquire = &_lock_try_acquire,