From 7027d2dfe8b071821e0dbf1e277cfa10b383f82b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 8 Mar 2019 14:57:00 +0800 Subject: [PATCH 01/12] spi_master: compile as C11 due to use of stdatomic.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit stdatomic.h is available both in newlib and GCC include directories. Normally (if you invoke the compiler without any flags) GCC include directories are first on the list, so GCC’s stdatomic.h is used. In IDF, we used to pass newlib include path as an extra include directory, so newlib’s stdint.h got included instead. Newlib 2.2.0 stdatomic implementation is compatible with -std=gnu99 but incompatible with -std=gnu11. And GCC doesn’t support atomic_load with -std=gnu99 (it’s a C11 feature). So when we used atomic_load with -std=gnu99, it worked due to newlib’s header. Since we are no longer going to be including newlib headers into IDF, GCC stdatomic will be used instead. Hence, add -std=gnu11 for source files which use atomic features. --- components/driver/CMakeLists.txt | 6 ++++++ components/driver/component.mk | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index e4e17b33e..488bf404f 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -25,3 +25,9 @@ set(COMPONENT_PRIV_INCLUDEDIRS "include/driver") set(COMPONENT_REQUIRES esp_ringbuf) register_component() + + +if(GCC_NOT_5_2_0) + # uses C11 atomic feature + set_source_files_properties(spi_master.c PROPERTIES COMPILE_FLAGS -std=gnu11) +endif() diff --git a/components/driver/component.mk b/components/driver/component.mk index a208f6ae2..bff34c912 100644 --- a/components/driver/component.mk +++ b/components/driver/component.mk @@ -6,3 +6,7 @@ COMPONENT_ADD_INCLUDEDIRS := include COMPONENT_PRIV_INCLUDEDIRS := include/driver +ifeq ($(GCC_NOT_5_2_0), 1) +# uses C11 atomic feature +spi_master.o: CFLAGS += -std=gnu11 +endif From 5a203a5371030417193bb49a98795c8ac4503c4e Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Tue, 9 Apr 2019 12:26:59 +0700 Subject: [PATCH 02/12] sysview: fix test case for compatibility with new binutils MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the ‘addr2line’ works correctly in the new version of binutils, line numbers are different. --- .../test/sysview/expected_output_new_CT | 450 ++++++++++++++++++ tools/esp_app_trace/test/sysview/test.sh | 9 +- 2 files changed, 458 insertions(+), 1 deletion(-) create mode 100644 tools/esp_app_trace/test/sysview/expected_output_new_CT diff --git a/tools/esp_app_trace/test/sysview/expected_output_new_CT b/tools/esp_app_trace/test/sysview/expected_output_new_CT new file mode 100644 index 000000000..64c3a3948 --- /dev/null +++ b/tools/esp_app_trace/test/sysview/expected_output_new_CT @@ -0,0 +1,450 @@ +Parse trace from 'cpu0.svdat'... +Stop parsing trace. (Timeout 0.000000 sec while reading 1 bytes!) +Parse trace from 'cpu1.svdat'... +Stop parsing trace. (Timeout 0.000000 sec while reading 1 bytes!) +Process events from '['cpu0.svdat', 'cpu1.svdat']'... +EVENT[0]: 0.000000000 - core[0].svTraceStart(10), plen 0: [] +EVENT[1]: 0.000000000 - core[1].svTraceStart(10), plen 0: [] +EVENT[2]: 0.000010950 - core[0].svInit(24), plen 14: [sys_freq: 40000000, cpu_freq: 160000000, ram_base: 1061158912, id_shift: 0] +EVENT[3]: 0.000010950 - core[1].svInit(24), plen 14: [sys_freq: 40000000, cpu_freq: 160000000, ram_base: 1061158912, id_shift: 0] +EVENT[4]: 0.000024800 - core[0].svSysDesc(14), plen 0: [desc: N=FreeRTOS Application,D=ESP32,C=Xtensa,O=FreeRTOS] +EVENT[5]: 0.000024800 - core[1].svSysDesc(14), plen 0: [desc: N=FreeRTOS Application,D=ESP32,C=Xtensa,O=FreeRTOS] +EVENT[6]: 0.000051650 - core[0].svSysDesc(14), plen 0: [desc: I#5=SysTick] +EVENT[7]: 0.000051650 - core[1].svSysDesc(14), plen 0: [desc: I#5=SysTick] +EVENT[8]: 0.000104150 - core[0].svSysDesc(14), plen 0: [desc: I#6=WIFI_MAC] +EVENT[9]: 0.000104150 - core[1].svSysDesc(14), plen 0: [desc: I#6=WIFI_MAC] +EVENT[10]: 0.000121100 - core[0].svSysDesc(14), plen 0: [desc: I#7=WIFI_NMI] +EVENT[11]: 0.000121100 - core[1].svSysDesc(14), plen 0: [desc: I#7=WIFI_NMI] +EVENT[12]: 0.000138125 - core[0].svSysDesc(14), plen 0: [desc: I#8=WIFI_BB] +EVENT[13]: 0.000138125 - core[1].svSysDesc(14), plen 0: [desc: I#8=WIFI_BB] +EVENT[14]: 0.000154825 - core[0].svSysDesc(14), plen 0: [desc: I#9=BT_MAC] +EVENT[15]: 0.000154825 - core[1].svSysDesc(14), plen 0: [desc: I#9=BT_MAC] +EVENT[16]: 0.000193350 - core[0].svSysDesc(14), plen 0: [desc: I#10=BT_BB] +EVENT[17]: 0.000193350 - core[1].svSysDesc(14), plen 0: [desc: I#10=BT_BB] +EVENT[18]: 0.000212875 - core[0].svSysDesc(14), plen 0: [desc: I#11=BT_BB_NMI] +EVENT[19]: 0.000212875 - core[1].svSysDesc(14), plen 0: [desc: I#11=BT_BB_NMI] +EVENT[20]: 0.000231625 - core[0].svSysDesc(14), plen 0: [desc: I#12=RWBT] +EVENT[21]: 0.000231625 - core[1].svSysDesc(14), plen 0: [desc: I#12=RWBT] +EVENT[22]: 0.000250250 - core[0].svSysDesc(14), plen 0: [desc: I#13=RWBLE] +EVENT[23]: 0.000250250 - core[1].svSysDesc(14), plen 0: [desc: I#13=RWBLE] +EVENT[24]: 0.000269450 - core[0].svSysDesc(14), plen 0: [desc: I#14=RWBT_NMI] +EVENT[25]: 0.000269450 - core[1].svSysDesc(14), plen 0: [desc: I#14=RWBT_NMI] +EVENT[26]: 0.000288925 - core[0].svSysDesc(14), plen 0: [desc: I#15=RWBLE_NMI] +EVENT[27]: 0.000288925 - core[1].svSysDesc(14), plen 0: [desc: I#15=RWBLE_NMI] +EVENT[28]: 0.000310575 - core[0].svSysDesc(14), plen 0: [desc: I#16=SLC0] +EVENT[29]: 0.000310575 - core[1].svSysDesc(14), plen 0: [desc: I#16=SLC0] +EVENT[30]: 0.000329150 - core[0].svSysDesc(14), plen 0: [desc: I#17=SLC1] +EVENT[31]: 0.000329150 - core[1].svSysDesc(14), plen 0: [desc: I#17=SLC1] +EVENT[32]: 0.000347675 - core[0].svSysDesc(14), plen 0: [desc: I#18=UHCI0] +EVENT[33]: 0.000347675 - core[1].svSysDesc(14), plen 0: [desc: I#18=UHCI0] +EVENT[34]: 0.000366225 - core[0].svSysDesc(14), plen 0: [desc: I#19=UHCI1] +EVENT[35]: 0.000366225 - core[1].svSysDesc(14), plen 0: [desc: I#19=UHCI1] +EVENT[36]: 0.000386350 - core[0].svSysDesc(14), plen 0: [desc: I#20=TG0_T0_LEVEL] +EVENT[37]: 0.000386350 - core[1].svSysDesc(14), plen 0: [desc: I#20=TG0_T0_LEVEL] +EVENT[38]: 0.000406575 - core[0].svSysDesc(14), plen 0: [desc: I#21=TG0_T1_LEVEL] +EVENT[39]: 0.000406575 - core[1].svSysDesc(14), plen 0: [desc: I#21=TG0_T1_LEVEL] +EVENT[40]: 0.000427300 - core[0].svSysDesc(14), plen 0: [desc: I#22=TG0_WDT_LEVEL] +EVENT[41]: 0.000427300 - core[1].svSysDesc(14), plen 0: [desc: I#22=TG0_WDT_LEVEL] +EVENT[42]: 0.000448000 - core[0].svSysDesc(14), plen 0: [desc: I#23=TG0_LACT_LEVEL] +EVENT[43]: 0.000448000 - core[1].svSysDesc(14), plen 0: [desc: I#23=TG0_LACT_LEVEL] +EVENT[44]: 0.000468250 - core[0].svSysDesc(14), plen 0: [desc: I#24=TG1_T0_LEVEL] +EVENT[45]: 0.000468250 - core[1].svSysDesc(14), plen 0: [desc: I#24=TG1_T0_LEVEL] +EVENT[46]: 0.000488500 - core[0].svSysDesc(14), plen 0: [desc: I#25=TG1_T1_LEVEL] +EVENT[47]: 0.000488500 - core[1].svSysDesc(14), plen 0: [desc: I#25=TG1_T1_LEVEL] +EVENT[48]: 0.000508975 - core[0].svSysDesc(14), plen 0: [desc: I#26=TG1_WDT_LEVEL] +EVENT[49]: 0.000508975 - core[1].svSysDesc(14), plen 0: [desc: I#26=TG1_WDT_LEVEL] +EVENT[50]: 0.000529850 - core[0].svSysDesc(14), plen 0: [desc: I#27=TG1_LACT_LEVEL] +EVENT[51]: 0.000529850 - core[1].svSysDesc(14), plen 0: [desc: I#27=TG1_LACT_LEVEL] +EVENT[52]: 0.000548375 - core[0].svSysDesc(14), plen 0: [desc: I#28=GPIO] +EVENT[53]: 0.000548375 - core[1].svSysDesc(14), plen 0: [desc: I#28=GPIO] +EVENT[54]: 0.000570825 - core[0].svSysDesc(14), plen 0: [desc: I#29=GPIO_NMI] +EVENT[55]: 0.000570825 - core[1].svSysDesc(14), plen 0: [desc: I#29=GPIO_NMI] +EVENT[56]: 0.000590425 - core[0].svSysDesc(14), plen 0: [desc: I#30=FROM_CPU0] +EVENT[57]: 0.000590425 - core[1].svSysDesc(14), plen 0: [desc: I#30=FROM_CPU0] +EVENT[58]: 0.000610000 - core[0].svSysDesc(14), plen 0: [desc: I#31=FROM_CPU1] +EVENT[59]: 0.000610000 - core[1].svSysDesc(14), plen 0: [desc: I#31=FROM_CPU1] +EVENT[60]: 0.000629625 - core[0].svSysDesc(14), plen 0: [desc: I#32=FROM_CPU2] +EVENT[61]: 0.000629625 - core[1].svSysDesc(14), plen 0: [desc: I#32=FROM_CPU2] +EVENT[62]: 0.000649425 - core[0].svSysDesc(14), plen 0: [desc: I#33=FROM_CPU3] +EVENT[63]: 0.000649425 - core[1].svSysDesc(14), plen 0: [desc: I#33=FROM_CPU3] +EVENT[64]: 0.000667975 - core[0].svSysDesc(14), plen 0: [desc: I#34=SPI0] +EVENT[65]: 0.000667975 - core[1].svSysDesc(14), plen 0: [desc: I#34=SPI0] +EVENT[66]: 0.000686500 - core[0].svSysDesc(14), plen 0: [desc: I#35=SPI1] +EVENT[67]: 0.000686500 - core[1].svSysDesc(14), plen 0: [desc: I#35=SPI1] +EVENT[68]: 0.000704825 - core[0].svSysDesc(14), plen 0: [desc: I#36=SPI2] +EVENT[69]: 0.000704825 - core[1].svSysDesc(14), plen 0: [desc: I#36=SPI2] +EVENT[70]: 0.000723100 - core[0].svSysDesc(14), plen 0: [desc: I#37=SPI3] +EVENT[71]: 0.000723100 - core[1].svSysDesc(14), plen 0: [desc: I#37=SPI3] +EVENT[72]: 0.000741550 - core[0].svSysDesc(14), plen 0: [desc: I#38=I2S0] +EVENT[73]: 0.000741550 - core[1].svSysDesc(14), plen 0: [desc: I#38=I2S0] +EVENT[74]: 0.000760000 - core[0].svSysDesc(14), plen 0: [desc: I#39=I2S1] +EVENT[75]: 0.000760000 - core[1].svSysDesc(14), plen 0: [desc: I#39=I2S1] +EVENT[76]: 0.000778475 - core[0].svSysDesc(14), plen 0: [desc: I#40=UART0] +EVENT[77]: 0.000778475 - core[1].svSysDesc(14), plen 0: [desc: I#40=UART0] +EVENT[78]: 0.000797050 - core[0].svSysDesc(14), plen 0: [desc: I#41=UART1] +EVENT[79]: 0.000797050 - core[1].svSysDesc(14), plen 0: [desc: I#41=UART1] +EVENT[80]: 0.000815625 - core[0].svSysDesc(14), plen 0: [desc: I#42=UART2] +EVENT[81]: 0.000815625 - core[1].svSysDesc(14), plen 0: [desc: I#42=UART2] +EVENT[82]: 0.000835000 - core[0].svSysDesc(14), plen 0: [desc: I#43=SDIO_HOST] +EVENT[83]: 0.000835000 - core[1].svSysDesc(14), plen 0: [desc: I#43=SDIO_HOST] +EVENT[84]: 0.000854075 - core[0].svSysDesc(14), plen 0: [desc: I#44=ETH_MAC] +EVENT[85]: 0.000854075 - core[1].svSysDesc(14), plen 0: [desc: I#44=ETH_MAC] +EVENT[86]: 0.000875600 - core[0].svSysDesc(14), plen 0: [desc: I#45=PWM0] +EVENT[87]: 0.000875600 - core[1].svSysDesc(14), plen 0: [desc: I#45=PWM0] +EVENT[88]: 0.000893850 - core[0].svSysDesc(14), plen 0: [desc: I#46=PWM1] +EVENT[89]: 0.000893850 - core[1].svSysDesc(14), plen 0: [desc: I#46=PWM1] +EVENT[90]: 0.000912375 - core[0].svSysDesc(14), plen 0: [desc: I#47=PWM2] +EVENT[91]: 0.000912375 - core[1].svSysDesc(14), plen 0: [desc: I#47=PWM2] +EVENT[92]: 0.000930950 - core[0].svSysDesc(14), plen 0: [desc: I#48=PWM3] +EVENT[93]: 0.000930950 - core[1].svSysDesc(14), plen 0: [desc: I#48=PWM3] +EVENT[94]: 0.000949375 - core[0].svSysDesc(14), plen 0: [desc: I#49=LEDC] +EVENT[95]: 0.000949375 - core[1].svSysDesc(14), plen 0: [desc: I#49=LEDC] +EVENT[96]: 0.000968075 - core[0].svSysDesc(14), plen 0: [desc: I#50=EFUSE] +EVENT[97]: 0.000968075 - core[1].svSysDesc(14), plen 0: [desc: I#50=EFUSE] +EVENT[98]: 0.000986275 - core[0].svSysDesc(14), plen 0: [desc: I#51=CAN] +EVENT[99]: 0.000986275 - core[1].svSysDesc(14), plen 0: [desc: I#51=CAN] +EVENT[100]: 0.001005625 - core[0].svSysDesc(14), plen 0: [desc: I#52=RTC_CORE] +EVENT[101]: 0.001005625 - core[1].svSysDesc(14), plen 0: [desc: I#52=RTC_CORE] +EVENT[102]: 0.001023700 - core[0].svSysDesc(14), plen 0: [desc: I#53=RMT] +EVENT[103]: 0.001023700 - core[1].svSysDesc(14), plen 0: [desc: I#53=RMT] +EVENT[104]: 0.001042050 - core[0].svSysDesc(14), plen 0: [desc: I#54=PCNT] +EVENT[105]: 0.001042050 - core[1].svSysDesc(14), plen 0: [desc: I#54=PCNT] +EVENT[106]: 0.001061500 - core[0].svSysDesc(14), plen 0: [desc: I#55=I2C_EXT0] +EVENT[107]: 0.001061500 - core[1].svSysDesc(14), plen 0: [desc: I#55=I2C_EXT0] +EVENT[108]: 0.001081100 - core[0].svSysDesc(14), plen 0: [desc: I#56=I2C_EXT1] +EVENT[109]: 0.001081100 - core[1].svSysDesc(14), plen 0: [desc: I#56=I2C_EXT1] +EVENT[110]: 0.001099425 - core[0].svSysDesc(14), plen 0: [desc: I#57=RSA] +EVENT[111]: 0.001099425 - core[1].svSysDesc(14), plen 0: [desc: I#57=RSA] +EVENT[112]: 0.001118625 - core[0].svSysDesc(14), plen 0: [desc: I#58=SPI1_DMA] +EVENT[113]: 0.001118625 - core[1].svSysDesc(14), plen 0: [desc: I#58=SPI1_DMA] +EVENT[114]: 0.001137775 - core[0].svSysDesc(14), plen 0: [desc: I#59=SPI2_DMA] +EVENT[115]: 0.001137775 - core[1].svSysDesc(14), plen 0: [desc: I#59=SPI2_DMA] +EVENT[116]: 0.001156950 - core[0].svSysDesc(14), plen 0: [desc: I#60=SPI3_DMA] +EVENT[117]: 0.001156950 - core[1].svSysDesc(14), plen 0: [desc: I#60=SPI3_DMA] +EVENT[118]: 0.001175175 - core[0].svSysDesc(14), plen 0: [desc: I#61=WDT] +EVENT[119]: 0.001175175 - core[1].svSysDesc(14), plen 0: [desc: I#61=WDT] +EVENT[120]: 0.001197300 - core[0].svSysDesc(14), plen 0: [desc: I#62=TIMER1] +EVENT[121]: 0.001197300 - core[1].svSysDesc(14), plen 0: [desc: I#62=TIMER1] +EVENT[122]: 0.001216250 - core[0].svSysDesc(14), plen 0: [desc: I#63=TIMER2] +EVENT[123]: 0.001216250 - core[1].svSysDesc(14), plen 0: [desc: I#63=TIMER2] +EVENT[124]: 0.001236175 - core[0].svSysDesc(14), plen 0: [desc: I#64=TG0_T0_EDGE] +EVENT[125]: 0.001236175 - core[1].svSysDesc(14), plen 0: [desc: I#64=TG0_T0_EDGE] +EVENT[126]: 0.001256275 - core[0].svSysDesc(14), plen 0: [desc: I#65=TG0_T1_EDGE] +EVENT[127]: 0.001256275 - core[1].svSysDesc(14), plen 0: [desc: I#65=TG0_T1_EDGE] +EVENT[128]: 0.001276675 - core[0].svSysDesc(14), plen 0: [desc: I#66=TG0_WDT_EDGE] +EVENT[129]: 0.001276675 - core[1].svSysDesc(14), plen 0: [desc: I#66=TG0_WDT_EDGE] +EVENT[130]: 0.001297375 - core[0].svSysDesc(14), plen 0: [desc: I#67=TG0_LACT_EDGE] +EVENT[131]: 0.001297375 - core[1].svSysDesc(14), plen 0: [desc: I#67=TG0_LACT_EDGE] +EVENT[132]: 0.001317425 - core[0].svSysDesc(14), plen 0: [desc: I#68=TG1_T0_EDGE] +EVENT[133]: 0.001317425 - core[1].svSysDesc(14), plen 0: [desc: I#68=TG1_T0_EDGE] +EVENT[134]: 0.001337650 - core[0].svSysDesc(14), plen 0: [desc: I#69=TG1_T1_EDGE] +EVENT[135]: 0.001337650 - core[1].svSysDesc(14), plen 0: [desc: I#69=TG1_T1_EDGE] +EVENT[136]: 0.001357950 - core[0].svSysDesc(14), plen 0: [desc: I#70=TG1_WDT_EDGE] +EVENT[137]: 0.001357950 - core[1].svSysDesc(14), plen 0: [desc: I#70=TG1_WDT_EDGE] +EVENT[138]: 0.001378625 - core[0].svSysDesc(14), plen 0: [desc: I#71=TG1_LACT_EDGE] +EVENT[139]: 0.001378625 - core[1].svSysDesc(14), plen 0: [desc: I#71=TG1_LACT_EDGE] +EVENT[140]: 0.001397500 - core[0].svSysDesc(14), plen 0: [desc: I#72=MMU_IA] +EVENT[141]: 0.001397500 - core[1].svSysDesc(14), plen 0: [desc: I#72=MMU_IA] +EVENT[142]: 0.001416425 - core[0].svSysDesc(14), plen 0: [desc: I#73=MPU_IA] +EVENT[143]: 0.001416425 - core[1].svSysDesc(14), plen 0: [desc: I#73=MPU_IA] +EVENT[144]: 0.001435550 - core[0].svSysDesc(14), plen 0: [desc: I#74=CACHE_IA] +EVENT[145]: 0.001435550 - core[1].svSysDesc(14), plen 0: [desc: I#74=CACHE_IA] +EVENT[146]: 0.001441950 - core[0].svSysTimeUs(13), plen 0: [time: 10000] +EVENT[147]: 0.001441950 - core[1].svSysTimeUs(13), plen 0: [time: 10000] +EVENT[148]: 0.001647400 - core[0].svTaskInfo(9), plen 0: [tid: 12253880, prio: 22, name: esp_timer] +EVENT[149]: 0.001647400 - core[1].svTaskInfo(9), plen 0: [tid: 12253880, prio: 22, name: esp_timer] +EVENT[150]: 0.001652000 - core[0].svStackInfo(21), plen 0: [tid: 12253880, base: 1073408692, sz: 3436, unused: 0] +EVENT[151]: 0.001652000 - core[1].svStackInfo(21), plen 0: [tid: 12253880, base: 1073408692, sz: 3436, unused: 0] +EVENT[152]: 0.001738550 - core[0].svTaskInfo(9), plen 0: [tid: 12254636, prio: 24, name: ipc0] +EVENT[153]: 0.001738550 - core[1].svTaskInfo(9), plen 0: [tid: 12254636, prio: 24, name: ipc0] +EVENT[154]: 0.001742750 - core[0].svStackInfo(21), plen 0: [tid: 12254636, base: 1073430180, sz: 1388, unused: 0] +EVENT[155]: 0.001742750 - core[1].svStackInfo(21), plen 0: [tid: 12254636, base: 1073430180, sz: 1388, unused: 0] +EVENT[156]: 0.001828975 - core[0].svTaskInfo(9), plen 0: [tid: 12275372, prio: 24, name: ipc1] +EVENT[157]: 0.001828975 - core[1].svTaskInfo(9), plen 0: [tid: 12275372, prio: 24, name: ipc1] +EVENT[158]: 0.001833225 - core[0].svStackInfo(21), plen 0: [tid: 12275372, base: 1073432232, sz: 1384, unused: 0] +EVENT[159]: 0.001833225 - core[1].svStackInfo(21), plen 0: [tid: 12275372, base: 1073432232, sz: 1384, unused: 0] +EVENT[160]: 0.001871225 - core[0].svTaskInfo(9), plen 0: [tid: 12291908, prio: 5, name: blink_task] +EVENT[161]: 0.001871225 - core[1].svTaskInfo(9), plen 0: [tid: 12291908, prio: 5, name: blink_task] +EVENT[162]: 0.001875650 - core[0].svStackInfo(21), plen 0: [tid: 12291908, base: 1073448452, sz: 524, unused: 0] +EVENT[163]: 0.001875650 - core[1].svStackInfo(21), plen 0: [tid: 12291908, base: 1073448452, sz: 524, unused: 0] +EVENT[164]: 0.002070800 - core[0].svTaskInfo(9), plen 0: [tid: 12282660, prio: 1, name: main] +EVENT[165]: 0.002070800 - core[1].svTaskInfo(9), plen 0: [tid: 12282660, prio: 1, name: main] +EVENT[166]: 0.002075200 - core[0].svStackInfo(21), plen 0: [tid: 12282660, base: 1073437472, sz: 3296, unused: 0] +EVENT[167]: 0.002075200 - core[1].svStackInfo(21), plen 0: [tid: 12282660, base: 1073437472, sz: 3296, unused: 0] +EVENT[168]: 0.002153375 - core[0].svTaskInfo(9), plen 0: [tid: 12284560, prio: 0, name: IDLE0] +EVENT[169]: 0.002153375 - core[1].svTaskInfo(9), plen 0: [tid: 12284560, prio: 0, name: IDLE0] +EVENT[170]: 0.002157850 - core[0].svStackInfo(21), plen 0: [tid: 12284560, base: 1073441932, sz: 1236, unused: 0] +EVENT[171]: 0.002157850 - core[1].svStackInfo(21), plen 0: [tid: 12284560, base: 1073441932, sz: 1236, unused: 0] +EVENT[172]: 0.002228950 - core[0].svTaskInfo(9), plen 0: [tid: 12286460, prio: 0, name: IDLE1] +EVENT[173]: 0.002228950 - core[1].svTaskInfo(9), plen 0: [tid: 12286460, prio: 0, name: IDLE1] +EVENT[174]: 0.002233250 - core[0].svStackInfo(21), plen 0: [tid: 12286460, base: 1073443832, sz: 1112, unused: 0] +EVENT[175]: 0.002233250 - core[1].svStackInfo(21), plen 0: [tid: 12286460, base: 1073443832, sz: 1112, unused: 0] +EVENT[176]: 0.002319675 - core[0].svTaskInfo(9), plen 0: [tid: 12289116, prio: 1, name: Tmr Svc] +EVENT[177]: 0.002319675 - core[1].svTaskInfo(9), plen 0: [tid: 12289116, prio: 1, name: Tmr Svc] +EVENT[178]: 0.002324100 - core[0].svStackInfo(21), plen 0: [tid: 12289116, base: 1073445976, sz: 1384, unused: 0] +EVENT[179]: 0.002324100 - core[1].svStackInfo(21), plen 0: [tid: 12289116, base: 1073445976, sz: 1384, unused: 0] +EVENT[180]: 0.002431200 - core[0].svTaskInfo(9), plen 0: [tid: 12294320, prio: 5, name: blink_task2] +EVENT[181]: 0.002431200 - core[1].svTaskInfo(9), plen 0: [tid: 12294320, prio: 5, name: blink_task2] +EVENT[182]: 0.002438750 - core[0].svStackInfo(21), plen 0: [tid: 12294320, base: 1073451180, sz: 1748, unused: 0] +EVENT[183]: 0.002438750 - core[1].svStackInfo(21), plen 0: [tid: 12294320, base: 1073451180, sz: 1748, unused: 0] +EVENT[184]: 0.002446150 - core[0].svNumModules(27), plen 1: [mod_cnt: 0] +EVENT[185]: 0.002446150 - core[1].svNumModules(27), plen 1: [mod_cnt: 0] +EVENT[186]: 0.002484225 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[187]: 0.002496125 - core[0].svTaskStopReady(7), plen 0: [tid: 12291908, cause: 4] +EVENT[188]: 0.002508025 - core[1].svTaskStartExec(4), plen 0: [tid: 12294320] +EVENT[189]: 0.002516350 - core[0].svIsrEnter(2), plen 0: [irq_num: 30] +EVENT[190]: 0.002524325 - core[1].svTaskStopReady(7), plen 0: [tid: 12294320, cause: 27] +EVENT[191]: 0.002532350 - core[0].svExitIsrToScheduler(18), plen 0: [] +EVENT[192]: 0.002541200 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[193]: 0.002548475 - core[0].svTaskStartExec(4), plen 0: [tid: 12282660] +EVENT[194]: 0.002556375 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[195]: 0.002564450 - core[0].vTaskDelete(33), plen 4: [xTaskToDelete: 12282660] +EVENT[196]: 0.002577700 - core[1].svIdle(17), plen 0: [] +EVENT[197]: 0.002585225 - core[0].svIsrEnter(2), plen 0: [irq_num: 30] +EVENT[198]: 0.002592950 - core[0].svExitIsrToScheduler(18), plen 0: [] +EVENT[199]: 0.002605950 - core[0].svIdle(17), plen 0: [] +EVENT[200]: 0.008819550 - core[0].svIsrEnter(2), plen 0: [irq_num: 5] +EVENT[201]: 0.008828075 - core[0].svTaskStartReady(6), plen 0: [tid: 12291908] +EVENT[202]: 0.008828075 - core[1].svTaskStartReady(6), plen 0: [tid: 12291908] +EVENT[203]: 0.008837475 - core[0].svExitIsrToScheduler(18), plen 0: [] +EVENT[204]: 0.008850450 - core[0].svTaskStartExec(4), plen 0: [tid: 12291908] +EVENT[205]: 0.008872650 - core[0].svModuleDesc(22), plen 0: [mod_id: 0, evt_off: 512, desc: ESP32 SystemView Heap Tracing Module] +EVENT[206]: 0.008872650 - core[1].svModuleDesc(22), plen 0: [mod_id: 0, evt_off: 512, desc: ESP32 SystemView Heap Tracing Module] +EVENT[207]: 0.008886175 - core[0].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[208]: 0.008886175 - core[1].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[209]: 0.008897425 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[210]: 0.008906150 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[211]: 0.008919900 - core[0].esp_sysview_heap_trace_alloc(512), plen 16: [addr: 1073450504, size: 64, callers: [1074601571, 1074296884]] +[0.008919900] HEAP: Allocated 64 bytes @ 0x3ffb8e08 from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:65 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[212]: 0.008928250 - core[1].svTaskStartExec(4), plen 0: [tid: 12294320] +EVENT[213]: 0.008957950 - core[0].esp_sysview_heap_trace_alloc(512), plen 16: [addr: 1073450572, size: 80, callers: [1074298654, 1074299267]] +[0.008957950] HEAP: Allocated 80 bytes @ 0x3ffb8e4c from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/components/freertos/queue.c:391 +/home/alexey/projects/esp/esp-idf/components/freertos/queue.c:498 + +EVENT[214]: 0.008967250 - core[0].xQueueGenericCreate(47), plen 3: [uxQueueLength: 1, uxItemSize: 0, ucQueueType: 4] +EVENT[215]: 0.008977300 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[216]: 0.008984625 - core[1].esp_sysview_heap_trace_alloc(512), plen 16: [addr: 1073450656, size: 65, callers: [1074601382, 1074296884]] +[0.008984625] HEAP: Allocated 65 bytes @ 0x3ffb8ea0 from task "blink_task2" on core 1 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:30 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[217]: 0.008995725 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[218]: 0.009010075 - core[1].svIsrEnter(2), plen 0: [irq_num: 5] +EVENT[219]: 0.009018025 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[220]: 0.009031900 - core[1].svTaskStartExec(4), plen 0: [tid: 12294320] +EVENT[221]: 0.009089600 - core[0].esp_sysview_heap_trace_alloc(512), plen 16: [addr: 1073434644, size: 80, callers: [1074298654, 1074299267]] +[0.009089600] HEAP: Allocated 80 bytes @ 0x3ffb5014 from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/components/freertos/queue.c:391 +/home/alexey/projects/esp/esp-idf/components/freertos/queue.c:498 + +EVENT[222]: 0.009098175 - core[1].svTaskStopReady(7), plen 0: [tid: 12294320, cause: 27] +EVENT[223]: 0.009106300 - core[0].xQueueGenericCreate(47), plen 3: [uxQueueLength: 1, uxItemSize: 0, ucQueueType: 4] +EVENT[224]: 0.009113825 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[225]: 0.009121600 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[226]: 0.009129000 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[227]: 0.009137900 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[228]: 0.009145425 - core[1].svIdle(17), plen 0: [] +EVENT[229]: 0.009169600 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[230]: 0.009185225 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[231]: 0.009195125 - core[0].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[232]: 0.009195125 - core[1].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[233]: 0.009207000 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[234]: 0.009215575 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[235]: 0.009223275 - core[0].esp_sysview_heap_trace_alloc(512), plen 16: [addr: 1073434728, size: 96, callers: [1074601587, 1074296884]] +[0.009223275] HEAP: Allocated 96 bytes @ 0x3ffb5068 from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:68 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[236]: 0.009231050 - core[1].svTaskStartExec(4), plen 0: [tid: 12294320] +EVENT[237]: 0.009241875 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[238]: 0.009257225 - core[1].svTaskStopReady(7), plen 0: [tid: 12294320, cause: 27] +EVENT[239]: 0.009269200 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[240]: 0.009278275 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[241]: 0.009286275 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[242]: 0.009303450 - core[1].svIdle(17), plen 0: [] +EVENT[243]: 0.009310950 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[244]: 0.009329625 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[245]: 0.009339525 - core[0].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[246]: 0.009339525 - core[1].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[247]: 0.009351425 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[248]: 0.009359450 - core[0].esp_sysview_heap_trace_free(513), plen 15: [addr: 1073450504, callers: [1074601600, 1074296884]] +[0.009359450] HEAP: Freed bytes @ 0x3ffb8e08 from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:70 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[249]: 0.009367800 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[250]: 0.009378950 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[251]: 0.009387450 - core[1].svTaskStartExec(4), plen 0: [tid: 12294320] +EVENT[252]: 0.009402575 - core[1].svTaskStopReady(7), plen 0: [tid: 12294320, cause: 27] +EVENT[253]: 0.009414900 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[254]: 0.009423125 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[255]: 0.009430250 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[256]: 0.009445425 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[257]: 0.009453075 - core[1].svIdle(17), plen 0: [] +EVENT[258]: 0.009469225 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[259]: 0.009479025 - core[0].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[260]: 0.009479025 - core[1].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[261]: 0.009490950 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[262]: 0.009499475 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[263]: 0.009507600 - core[0].esp_sysview_heap_trace_alloc(512), plen 16: [addr: 1073450504, size: 10, callers: [1074601615, 1074296884]] +[0.009507600] HEAP: Allocated 10 bytes @ 0x3ffb8e08 from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:72 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[264]: 0.009515300 - core[1].svTaskStartExec(4), plen 0: [tid: 12294320] +EVENT[265]: 0.009526100 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[266]: 0.009541550 - core[1].svTaskStopReady(7), plen 0: [tid: 12294320, cause: 27] +EVENT[267]: 0.009553850 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[268]: 0.009561100 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[269]: 0.009568400 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[270]: 0.009585075 - core[1].svIdle(17), plen 0: [] +EVENT[271]: 0.009593375 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[272]: 0.009609150 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[273]: 0.009621875 - core[0].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[274]: 0.009621875 - core[1].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[275]: 0.009633775 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[276]: 0.009642300 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[277]: 0.009649475 - core[0].esp_sysview_heap_trace_alloc(512), plen 16: [addr: 1073450520, size: 23, callers: [1074601628, 1074296884]] +[0.009649475] HEAP: Allocated 23 bytes @ 0x3ffb8e18 from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:73 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[278]: 0.009657875 - core[1].svTaskStartExec(4), plen 0: [tid: 12294320] +EVENT[279]: 0.009666025 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[280]: 0.009681500 - core[1].svTaskStopReady(7), plen 0: [tid: 12294320, cause: 27] +EVENT[281]: 0.009693375 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[282]: 0.009702800 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[283]: 0.009710550 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[284]: 0.009726725 - core[1].svIdle(17), plen 0: [] +EVENT[285]: 0.010504825 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[286]: 0.010520650 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[287]: 0.010530550 - core[0].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[288]: 0.010530550 - core[1].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[289]: 0.010542400 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[290]: 0.010550025 - core[0].esp_sysview_heap_trace_free(513), plen 15: [addr: 1073450520, callers: [1074601643, 1074296884]] +[0.010550025] HEAP: Freed bytes @ 0x3ffb8e18 from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:76 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[291]: 0.010557450 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[292]: 0.010569700 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[293]: 0.010577700 - core[1].svTaskStartExec(4), plen 0: [tid: 12294320] +EVENT[294]: 0.010592825 - core[1].svTaskStopReady(7), plen 0: [tid: 12294320, cause: 27] +EVENT[295]: 0.010605950 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[296]: 0.010613575 - core[0].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[297]: 0.010620900 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[298]: 0.010637050 - core[1].svIdle(17), plen 0: [] +EVENT[299]: 0.012240950 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[300]: 0.012256775 - core[0].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[301]: 0.012266650 - core[0].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[302]: 0.012266650 - core[1].svTaskStartReady(6), plen 0: [tid: 12294320] +EVENT[303]: 0.012281350 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[304]: 0.012289475 - core[0].svTaskStopReady(7), plen 0: [tid: 12291908, cause: 27] +EVENT[305]: 0.012297450 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[306]: 0.012306350 - core[0].svIsrEnter(2), plen 0: [irq_num: 30] +EVENT[307]: 0.012312875 - core[1].svTaskStartExec(4), plen 0: [tid: 12294320] +EVENT[308]: 0.012320700 - core[0].svExitIsrToScheduler(18), plen 0: [] +EVENT[309]: 0.012328950 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[310]: 0.012338100 - core[0].svIdle(17), plen 0: [] +EVENT[311]: 0.012640475 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[312]: 0.014931850 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[313]: 0.014963325 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[314]: 0.014984150 - core[1].esp_sysview_heap_trace_alloc(512), plen 16: [addr: 1073434828, size: 97, callers: [1074601399, 1074296884]] +[0.014984150] HEAP: Allocated 97 bytes @ 0x3ffb50cc from task "blink_task2" on core 1 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:33 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[315]: 0.014997400 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[316]: 0.015031050 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[317]: 0.017622800 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[318]: 0.017638675 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[319]: 0.017656375 - core[1].esp_sysview_heap_trace_free(513), plen 15: [addr: 1073450656, callers: [1074601412, 1074296884]] +[0.017656375] HEAP: Freed bytes @ 0x3ffb8ea0 from task "blink_task2" on core 1 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:35 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[320]: 0.017674025 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[321]: 0.017701700 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[322]: 0.018819550 - core[0].svIsrEnter(2), plen 0: [irq_num: 5] +EVENT[323]: 0.018829625 - core[0].svExitIsrToScheduler(18), plen 0: [] +EVENT[324]: 0.018844750 - core[0].svIdle(17), plen 0: [] +EVENT[325]: 0.019010075 - core[1].svIsrEnter(2), plen 0: [irq_num: 5] +EVENT[326]: 0.019017950 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[327]: 0.019033200 - core[1].svTaskStartExec(4), plen 0: [tid: 12294320] +EVENT[328]: 0.019358925 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[329]: 0.019374600 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[330]: 0.019395425 - core[1].esp_sysview_heap_trace_alloc(512), plen 16: [addr: 1073450520, size: 11, callers: [1074601427, 1074296884]] +[0.019395425] HEAP: Allocated 11 bytes @ 0x3ffb8e18 from task "blink_task2" on core 1 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:37 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[331]: 0.019412600 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[332]: 0.019446250 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[333]: 0.022049900 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[334]: 0.022065775 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[335]: 0.022086625 - core[1].esp_sysview_heap_trace_alloc(512), plen 16: [addr: 1073450536, size: 24, callers: [1074601440, 1074296884]] +[0.022086625] HEAP: Allocated 24 bytes @ 0x3ffb8e28 from task "blink_task2" on core 1 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:38 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[336]: 0.022103925 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[337]: 0.022137550 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[338]: 0.024740850 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[339]: 0.024756725 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[340]: 0.024770475 - core[1].esp_sysview_heap_trace_free(513), plen 15: [addr: 1073450536, callers: [1074601455, 1074296884]] +[0.024770475] HEAP: Freed bytes @ 0x3ffb8e28 from task "blink_task2" on core 1 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:41 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +EVENT[341]: 0.024791750 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12291660, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[342]: 0.024819500 - core[1].xQueueGenericReceive(49), plen 15: [xQueue: 12275732, pvBuffer: 3233808384, xTicksToWait: 4294967295, xJustPeek: 0] +EVENT[343]: 0.026476950 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12275732, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[344]: 0.026495700 - core[1].xQueueGenericSend(53), plen 7: [xQueue: 12291660, pvItemToQueue: 0, xTicksToWait: 0, xCopyPosition: 0] +EVENT[345]: 0.026506975 - core[0].svTaskStartReady(6), plen 0: [tid: 12291908] +EVENT[346]: 0.026506975 - core[1].svTaskStartReady(6), plen 0: [tid: 12291908] +EVENT[347]: 0.026518525 - core[1].svTaskStopReady(7), plen 0: [tid: 12294320, cause: 27] +EVENT[348]: 0.026526625 - core[0].svIsrEnter(2), plen 0: [irq_num: 30] +EVENT[349]: 0.026535575 - core[0].svExitIsrToScheduler(18), plen 0: [] +EVENT[350]: 0.026544075 - core[1].svIsrEnter(2), plen 0: [irq_num: 31] +EVENT[351]: 0.026551650 - core[0].svTaskStartExec(4), plen 0: [tid: 12291908] +EVENT[352]: 0.026559500 - core[1].svExitIsrToScheduler(18), plen 0: [] +EVENT[353]: 0.148816725 - core[1].svIdle(17), plen 0: [] +EVENT[354]: 0.148825750 - core[0].vTaskDelay(34), plen 1: [xTicksToDelay: 1] +EVENT[355]: 0.148833200 - core[0].svTaskStopReady(7), plen 0: [tid: 12291908, cause: 4] +EVENT[356]: 0.148839250 - core[0].svTraceStop(11), plen 0: [] +EVENT[357]: 0.148839250 - core[1].svTraceStop(11), plen 0: [] +Processing completed. +Processed 358 events +=============== LOG TRACE REPORT =============== +Processed 0 log messages. +=============== HEAP TRACE REPORT =============== +Processed 14 heap events. +[0.008957950] HEAP: Allocated 80 bytes @ 0x3ffb8e4c from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/components/freertos/queue.c:391 +/home/alexey/projects/esp/esp-idf/components/freertos/queue.c:498 + +[0.009089600] HEAP: Allocated 80 bytes @ 0x3ffb5014 from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/components/freertos/queue.c:391 +/home/alexey/projects/esp/esp-idf/components/freertos/queue.c:498 + +[0.009223275] HEAP: Allocated 96 bytes @ 0x3ffb5068 from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:68 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +[0.009507600] HEAP: Allocated 10 bytes @ 0x3ffb8e08 from task "blink_task" on core 0 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:72 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +[0.014984150] HEAP: Allocated 97 bytes @ 0x3ffb50cc from task "blink_task2" on core 1 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:33 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +[0.019395425] HEAP: Allocated 11 bytes @ 0x3ffb8e18 from task "blink_task2" on core 1 by: +/home/alexey/projects/esp/esp-idf/examples/get-started/blink/main/blink.c:37 +/home/alexey/projects/esp/esp-idf/components/freertos/port.c:145 + +Found 374 leaked bytes in 6 blocks. diff --git a/tools/esp_app_trace/test/sysview/test.sh b/tools/esp_app_trace/test/sysview/test.sh index ec45fa09c..a64cc69ff 100755 --- a/tools/esp_app_trace/test/sysview/test.sh +++ b/tools/esp_app_trace/test/sysview/test.sh @@ -1,8 +1,15 @@ #! /bin/bash +if [ "$(xtensa-esp32-elf-gcc -dumpversion)" = "5.2.0" ]; then + EXPECTED_OUTPUT="expected_output" +else + # GCC_NOT_5_2_0 just a hint to remove later + EXPECTED_OUTPUT="expected_output_new_CT" +fi + { coverage debug sys \ && coverage erase &> output \ && coverage run -a $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p cpu0.svdat cpu1.svdat test.elf &>> output \ - && diff output expected_output \ + && diff output ${EXPECTED_OUTPUT} \ && coverage report \ ; } || { echo 'The test for sysviewtrace_proc has failed. Please examine the artifacts.' ; exit 1; } From 4770acf1cb3965bdc5fc2020e563312319035a0d Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 29 Mar 2019 12:38:06 +0800 Subject: [PATCH 03/12] newlib: add missing tzset() to the time test --- components/newlib/test/test_newlib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/newlib/test/test_newlib.c b/components/newlib/test/test_newlib.c index 10d81e163..2cf0412fa 100644 --- a/components/newlib/test/test_newlib.c +++ b/components/newlib/test/test_newlib.c @@ -65,6 +65,7 @@ TEST_CASE("test time functions", "[newlib]") { time_t now = 1464248488; setenv("TZ", "UTC-8", 1); + tzset(); struct tm *tm_utc = gmtime(&now); TEST_ASSERT_EQUAL( 28, tm_utc->tm_sec); TEST_ASSERT_EQUAL( 41, tm_utc->tm_min); From d15e18aa5db53f55344bbb4a7623d3dd46b6ad0f Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Thu, 28 Mar 2019 19:22:37 +0800 Subject: [PATCH 04/12] newlib: fixes for compatibility with newlib 3.0 --- components/newlib/platform_include/sys/select.h | 6 ++++++ components/newlib/reent_init.c | 1 - components/pthread/pthread.c | 3 ++- components/wpa_supplicant/port/include/endian.h | 5 +---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components/newlib/platform_include/sys/select.h b/components/newlib/platform_include/sys/select.h index 199d48144..ca7e4a4a2 100644 --- a/components/newlib/platform_include/sys/select.h +++ b/components/newlib/platform_include/sys/select.h @@ -15,7 +15,11 @@ #ifndef __ESP_SYS_SELECT_H__ #define __ESP_SYS_SELECT_H__ +/* Newlib 2.2.0 does not provide sys/select.h, and fd_set is defined in sys/types.h */ #include +#ifndef fd_set +#include_next +#else // fd_set #include #ifdef __cplusplus @@ -28,4 +32,6 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct } // extern "C" #endif +#endif // fd_set + #endif //__ESP_SYS_SELECT_H__ diff --git a/components/newlib/reent_init.c b/components/newlib/reent_init.c index 5c29e898c..638d10be2 100644 --- a/components/newlib/reent_init.c +++ b/components/newlib/reent_init.c @@ -41,5 +41,4 @@ void IRAM_ATTR esp_reent_init(struct _reent* r) r->__sglue._next = NULL; r->__sglue._niobs = 0; r->__sglue._iobs = NULL; - r->_current_locale = "C"; } diff --git a/components/pthread/pthread.c b/components/pthread/pthread.c index 99e5d209e..2bdfb3b72 100644 --- a/components/pthread/pthread.c +++ b/components/pthread/pthread.c @@ -460,7 +460,8 @@ void pthread_exit(void *value_ptr) vTaskSuspend(NULL); } - ESP_LOGV(TAG, "%s EXIT", __FUNCTION__); + // Should never be reached + abort(); } int pthread_cancel(pthread_t thread) diff --git a/components/wpa_supplicant/port/include/endian.h b/components/wpa_supplicant/port/include/endian.h index f84f923ca..0d0d4f5ba 100644 --- a/components/wpa_supplicant/port/include/endian.h +++ b/components/wpa_supplicant/port/include/endian.h @@ -83,10 +83,7 @@ typedef __uint64_t uint64_t; * Host to big endian, host to little endian, big endian to host, and little * endian to host byte order functions as detailed in byteorder(9). */ -#if 1 //BYTE_ORDER == _LITTLE_ENDIAN -#define __bswap16 __bswap_16 -#define __bswap32 __bswap_32 -#define __bswap64 __bswap_64 +#if BYTE_ORDER == _LITTLE_ENDIAN #define htobe16(x) bswap16((x)) #define htobe32(x) bswap32((x)) #define htobe64(x) bswap64((x)) From 31b4fc8eb85f3113d9a26a57c59c36310425da29 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 8 Mar 2019 15:07:00 +0800 Subject: [PATCH 05/12] pthread: add dummy implementation of pthread_setcancelstate Used by new versions of newlib in stdio functions. --- components/newlib/pthread.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/newlib/pthread.c b/components/newlib/pthread.c index 71e50d9e5..c917a22ab 100644 --- a/components/newlib/pthread.c +++ b/components/newlib/pthread.c @@ -8,3 +8,8 @@ int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id) ESP_LOGW(TAG, "%s: not yet supported!", __FUNCTION__); return 0; } + +int pthread_setcancelstate(int state, int *oldstate) +{ + return 0; +} From e84b26f5319fbc5e89257522b165aa5f8acfc995 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 10 Mar 2019 22:12:34 +0800 Subject: [PATCH 06/12] esp_rom: export newlib functions as strong symbols --- .../bootloader/subproject/CMakeLists.txt | 3 +- .../bootloader/subproject/main/component.mk | 2 +- components/esp_rom/CMakeLists.txt | 8 +- components/esp_rom/component.mk | 9 +- components/esp_rom/esp32/ld/esp32.rom.ld | 28 --- .../esp_rom/esp32/ld/esp32.rom.libgcc.ld | 7 + .../esp_rom/esp32/ld/esp32.rom.nanofmt.ld | 100 ----------- .../esp_rom/esp32/ld/esp32.rom.newlib-data.ld | 23 +++ .../esp32/ld/esp32.rom.newlib-funcs.ld | 160 +++++++++++++++++ .../esp_rom/esp32/ld/esp32.rom.newlib-nano.ld | 115 ++++++++++++ .../esp_rom/esp32/ld/esp32.rom.redefined.ld | 23 +-- .../ld/esp32.rom.spiram_incompatible_fns.ld | 163 ------------------ .../esp_rom/esp32/ld/esp32.rom.syscalls.ld | 79 +++++++++ 13 files changed, 399 insertions(+), 321 deletions(-) delete mode 100644 components/esp_rom/esp32/ld/esp32.rom.nanofmt.ld create mode 100644 components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld create mode 100644 components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld create mode 100644 components/esp_rom/esp32/ld/esp32.rom.newlib-nano.ld delete mode 100644 components/esp_rom/esp32/ld/esp32.rom.spiram_incompatible_fns.ld create mode 100644 components/esp_rom/esp32/ld/esp32.rom.syscalls.ld diff --git a/components/bootloader/subproject/CMakeLists.txt b/components/bootloader/subproject/CMakeLists.txt index 83b7cb911..cc88aa2dd 100644 --- a/components/bootloader/subproject/CMakeLists.txt +++ b/components/bootloader/subproject/CMakeLists.txt @@ -26,9 +26,10 @@ target_linker_script(bootloader.elf # as cmake won't attach linker args to a header-only library, attach # linker args directly to the bootloader.elf +# esp32.rom.newlib-funcs.ld is included to use memset/memcpy. set(BOOTLOADER_LINKER_SCRIPTS "${IDF_PATH}/components/esp_rom/${IDF_TARGET}/ld/${IDF_TARGET}.rom.ld" - "${IDF_PATH}/components/esp_rom/${IDF_TARGET}/ld/${IDF_TARGET}.rom.spiram_incompatible_fns.ld" + "${IDF_PATH}/components/esp_rom/${IDF_TARGET}/ld/${IDF_TARGET}.rom.newlib-funcs.ld" "${IDF_PATH}/components/${IDF_TARGET}/ld/${IDF_TARGET}.peripherals.ld") target_linker_script(bootloader.elf ${BOOTLOADER_LINKER_SCRIPTS}) diff --git a/components/bootloader/subproject/main/component.mk b/components/bootloader/subproject/main/component.mk index e2cae1b03..c74985132 100644 --- a/components/bootloader/subproject/main/component.mk +++ b/components/bootloader/subproject/main/component.mk @@ -9,7 +9,7 @@ LINKER_SCRIPTS := \ $(IDF_TARGET).bootloader.ld \ $(IDF_TARGET).bootloader.rom.ld \ $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.ld \ - $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.spiram_incompatible_fns.ld \ + $(IDF_PATH)/components/esp_rom/$(IDF_TARGET)/ld/$(IDF_TARGET).rom.newlib-funcs.ld \ $(IDF_PATH)/components/$(IDF_TARGET)/ld/$(IDF_TARGET).peripherals.ld ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH diff --git a/components/esp_rom/CMakeLists.txt b/components/esp_rom/CMakeLists.txt index 47a3b3c4c..63a028172 100644 --- a/components/esp_rom/CMakeLists.txt +++ b/components/esp_rom/CMakeLists.txt @@ -13,16 +13,18 @@ else() target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.ld" - "esp32/ld/esp32.rom.libgcc.ld") + "esp32/ld/esp32.rom.libgcc.ld" + "esp32/ld/esp32.rom.syscalls.ld" + "esp32/ld/esp32.rom.newlib-data.ld") if(CONFIG_SPIRAM_CACHE_WORKAROUND) target_compile_options(${COMPONENT_TARGET} PUBLIC -mfix-esp32-psram-cache-issue) else() - target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.spiram_incompatible_fns.ld") + target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.newlib-funcs.ld") endif() if(CONFIG_NEWLIB_NANO_FORMAT) - target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.nanofmt.ld") + target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.newlib-nano.ld") endif() if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH) diff --git a/components/esp_rom/component.mk b/components/esp_rom/component.mk index 9badd5617..f53b15596 100644 --- a/components/esp_rom/component.mk +++ b/components/esp_rom/component.mk @@ -1,16 +1,19 @@ #Linker scripts used to link the final application. #Warning: These linker scripts are only used when the normal app is compiled; the bootloader #specifies its own scripts. -LINKER_SCRIPTS += esp32.rom.ld esp32.rom.libgcc.ld +LINKER_SCRIPTS += esp32.rom.ld \ + esp32.rom.libgcc.ld \ + esp32.rom.syscalls.ld \ + esp32.rom.newlib-data.ld #SPI-RAM incompatible functions can be used in when the SPI RAM #workaround is not enabled. ifndef CONFIG_SPIRAM_CACHE_WORKAROUND -LINKER_SCRIPTS += esp32.rom.spiram_incompatible_fns.ld +LINKER_SCRIPTS += esp32.rom.newlib-funcs.ld endif ifdef CONFIG_NEWLIB_NANO_FORMAT -LINKER_SCRIPTS += esp32.rom.nanofmt.ld +LINKER_SCRIPTS += esp32.rom.newlib-nano.ld endif ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH diff --git a/components/esp_rom/esp32/ld/esp32.rom.ld b/components/esp_rom/esp32/ld/esp32.rom.ld index c1e3e94bc..6943a7479 100644 --- a/components/esp_rom/esp32/ld/esp32.rom.ld +++ b/components/esp_rom/esp32/ld/esp32.rom.ld @@ -33,9 +33,7 @@ PROVIDE ( Cache_Read_Init_rom = 0x40009950 ); PROVIDE ( cache_sram_mmu_set_rom = 0x400097f4 ); /* This is static function, but can be used, not generated by script*/ PROVIDE ( calc_rtc_memory_crc = 0x40008170 ); -PROVIDE ( calloc = 0x4000bee4 ); PROVIDE ( __clear_cache = 0x40063860 ); -PROVIDE ( _close_r = 0x4000bd3c ); PROVIDE ( co_default_bdaddr = 0x3ffae704 ); PROVIDE ( co_null_bdaddr = 0x3ffb80e0 ); PROVIDE ( co_sca2ppm = 0x3ff971e8 ); @@ -45,8 +43,6 @@ PROVIDE ( crc32_be = 0x4005d024 ); PROVIDE ( crc32_le = 0x4005cfec ); PROVIDE ( crc8_be = 0x4005d114 ); PROVIDE ( crc8_le = 0x4005d0e0 ); -PROVIDE ( _ctype_ = 0x3ff96354 ); -PROVIDE ( __ctype_ptr__ = 0x3ff96350 ); PROVIDE ( _data_end_rom = 0x4000d5c8 ); PROVIDE ( _data_end_btdm_rom = 0x4000d4f8 ); PROVIDE ( _data_start_rom = 0x4000d4f8 ); @@ -55,7 +51,6 @@ PROVIDE ( _data_start_btdm = 0x3ffae6e0); PROVIDE ( _data_end_btdm = 0x3ffaff10); PROVIDE ( _bss_start_btdm = 0x3ffb8000); PROVIDE ( _bss_end_btdm = 0x3ffbff70); -PROVIDE ( _daylight = 0x3ffae0a4 ); PROVIDE ( dbg_default_handler = 0x3ff97218 ); PROVIDE ( dbg_default_state = 0x3ff97220 ); PROVIDE ( dbg_state = 0x3ffb8d5d ); @@ -84,7 +79,6 @@ PROVIDE ( g_rom_spiflash_dummy_len_plus = 0x3ffae290 ); PROVIDE ( ecc_env = 0x3ffb8d60 ); PROVIDE ( ecc_Jacobian_InfinityPoint256 = 0x3ff972e8 ); PROVIDE ( em_buf_env = 0x3ffb8d74 ); -PROVIDE ( environ = 0x3ffae0b4 ); PROVIDE ( esp_crc8 = 0x4005d144 ); PROVIDE ( _etext = 0x4000d66c ); PROVIDE ( ets_readySet_ = 0x3ffe01f0 ); @@ -92,14 +86,9 @@ PROVIDE ( ets_startup_callback = 0x3ffe0404 ); PROVIDE ( rwip_coex_cfg = 0x3ff9914c ); PROVIDE ( rwip_priority = 0x3ff99159 ); PROVIDE ( exc_cause_table = 0x3ff991d0 ); -PROVIDE ( _exit_r = 0x4000bd28 ); -PROVIDE ( free = 0x4000beb8 ); -PROVIDE ( _fstat_r = 0x4000bccc ); -PROVIDE ( __gcc_bcmp = 0x40064a70 ); PROVIDE ( GF_Jacobian_Point_Addition256 = 0x400163a4 ); PROVIDE ( GF_Jacobian_Point_Double256 = 0x40016260 ); PROVIDE ( GF_Point_Jacobian_To_Affine256 = 0x40016b0c ); -PROVIDE ( _global_impure_ptr = 0x3ffae0b0 ); PROVIDE ( g_phyFuns_instance = 0x3ffae0c4 ); PROVIDE ( g_rom_flashchip = 0x3ffae270 ); PROVIDE ( gTxMsg = 0x3ffe0050 ); @@ -140,7 +129,6 @@ PROVIDE ( ld_env = 0x3ffb9510 ); PROVIDE ( ld_pcm_settings_dft = 0x3ff98a0c ); PROVIDE ( ld_sched_params = 0x3ffb96c0 ); PROVIDE ( ld_sync_train_channels = 0x3ff98a3c ); -PROVIDE ( _link_r = 0x4000bc9c ); PROVIDE ( llc_default_handler = 0x3ff98b3c ); PROVIDE ( llc_default_state_tab_p_get = 0x40046058 ); PROVIDE ( llc_env = 0x3ffb96d0 ); @@ -184,12 +172,8 @@ PROVIDE ( lm_n_page_tab = 0x3ff990e8 ); PROVIDE ( lmp_desc_tab = 0x3ff96e6c ); PROVIDE ( lmp_ext_desc_tab = 0x3ff96d9c ); PROVIDE ( lm_state = 0x3ffb9a1c ); -PROVIDE ( _lseek_r = 0x4000bd8c ); -PROVIDE ( malloc = 0x4000bea0 ); PROVIDE ( maxSecretKey_256 = 0x3ff97448 ); -PROVIDE ( __mb_cur_max = 0x3ff96530 ); PROVIDE ( mmu_init = 0x400095a4 ); -PROVIDE ( __month_lengths = 0x3ff9609c ); PROVIDE ( MultiplyBigHexByUint32_256 = 0x40016214 ); PROVIDE ( MultiplyBigHexModP256 = 0x400160b8 ); PROVIDE ( MultiplyByU32ModP256 = 0x40015fdc ); @@ -199,7 +183,6 @@ PROVIDE ( mz_crc32 = 0x4005ee88 ); PROVIDE ( mz_free = 0x4005eed4 ); PROVIDE ( notEqual256 = 0x40015b04 ); PROVIDE ( one_bits = 0x3ff971f8 ); -PROVIDE ( _open_r = 0x4000bd54 ); PROVIDE ( phy_get_romfuncs = 0x40004100 ); PROVIDE ( _Pri_4_HandlerAddress = 0x3ffe0648 ); PROVIDE ( _Pri_5_HandlerAddress = 0x3ffe064c ); @@ -248,7 +231,6 @@ PROVIDE ( lm_n192_mod_add = 0x40011e9c ); PROVIDE ( lm_n192_mod_sub = 0x40011eec ); PROVIDE ( r_ea_alarm_clear = 0x40015ab4 ); PROVIDE ( r_ea_alarm_set = 0x40015a10 ); -PROVIDE ( _read_r = 0x4000bda8 ); PROVIDE ( r_ea_elt_cancel = 0x400150d0 ); PROVIDE ( r_ea_elt_create = 0x40015264 ); PROVIDE ( r_ea_elt_insert = 0x400152a8 ); @@ -262,7 +244,6 @@ PROVIDE ( r_ea_interval_insert = 0x4001557c ); PROVIDE ( r_ea_interval_remove = 0x40015590 ); PROVIDE ( ea_conflict_check = 0x40014e9c ); PROVIDE ( ea_prog_timer = 0x40014f88 ); -PROVIDE ( realloc = 0x4000becc ); PROVIDE ( r_ea_offset_req = 0x40015748 ); PROVIDE ( r_ea_sleep_check = 0x40015928 ); PROVIDE ( r_ea_sw_isr = 0x40015724 ); @@ -281,7 +262,6 @@ PROVIDE ( r_em_buf_rx_buff_addr_get = 0x400173e8 ); PROVIDE ( r_em_buf_rx_free = 0x400173c4 ); PROVIDE ( r_em_buf_tx_buff_addr_get = 0x40017404 ); PROVIDE ( r_em_buf_tx_free = 0x4001741c ); -PROVIDE ( _rename_r = 0x4000bc28 ); PROVIDE ( r_F1_256 = 0x400133e4 ); PROVIDE ( r_F2_256 = 0x40013568 ); PROVIDE ( r_F3_256 = 0x40013664 ); @@ -1290,9 +1270,6 @@ PROVIDE ( rwip_priority = 0x3ff99159 ); PROVIDE ( rwip_rf = 0x3ffbdb28 ); PROVIDE ( rwip_rf_p_get = 0x400558f4 ); PROVIDE ( r_XorKey = 0x400112c0 ); -PROVIDE ( __sf_fake_stderr = 0x3ff96458 ); -PROVIDE ( __sf_fake_stdin = 0x3ff96498 ); -PROVIDE ( __sf_fake_stdout = 0x3ff96478 ); PROVIDE ( sha_blk_bits = 0x3ff99290 ); PROVIDE ( sha_blk_bits_bytes = 0x3ff99288 ); PROVIDE ( sha_blk_hash_bytes = 0x3ff9928c ); @@ -1348,17 +1325,12 @@ 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 ( _timezone = 0x3ffae0a0 ); PROVIDE ( tinfl_decompress = 0x4005ef30 ); PROVIDE ( tinfl_decompress_mem_to_callback = 0x40060090 ); PROVIDE ( tinfl_decompress_mem_to_mem = 0x40060050 ); -PROVIDE ( _tzname = 0x3ffae030 ); PROVIDE ( UartDev = 0x3ffe019c ); -PROVIDE ( _unlink_r = 0x4000bc84 ); PROVIDE ( user_code_start = 0x3ffe0400 ); PROVIDE ( veryBigHexP256 = 0x3ff9736c ); -PROVIDE ( __wctomb = 0x3ff96540 ); -PROVIDE ( _write_r = 0x4000bd70 ); PROVIDE ( xthal_bcopy = 0x4000c098 ); PROVIDE ( xthal_copy123 = 0x4000c124 ); PROVIDE ( xthal_get_ccompare = 0x4000c078 ); diff --git a/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld b/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld index 51448b332..dfdbe2588 100644 --- a/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld +++ b/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld @@ -1,3 +1,9 @@ +/* Unlike other ROM functions which are exported using PROVIDE, which declares + weak symbols, these libgcc functions are exported using assignment, + which declares strong symbols. This is done so that ROM functions are always + used instead of the ones provided by libgcc.a. +*/ + __absvdi2 = 0x4006387c; __absvsi2 = 0x40063868; __adddf3 = 0x40002590; @@ -41,6 +47,7 @@ __floatundidf = 0x4000c978; __floatundisf = 0x4000c8b0; __floatunsidf = 0x4000c938; __floatunsisf = 0x4000c864; +__gcc_bcmp = 0x40064a70; __gedf2 = 0x40063768; __gesf2 = 0x4006340c; __gtdf2 = 0x400636dc; diff --git a/components/esp_rom/esp32/ld/esp32.rom.nanofmt.ld b/components/esp_rom/esp32/ld/esp32.rom.nanofmt.ld deleted file mode 100644 index ae843dff2..000000000 --- a/components/esp_rom/esp32/ld/esp32.rom.nanofmt.ld +++ /dev/null @@ -1,100 +0,0 @@ -/* - Address table for printf/scanf family of functions in ESP32 ROM. - These functions are compiled with newlib "nano" format option. - As such, they don's support 64-bit integer formats. - Floating point formats are supported by setting _printf_float and - _scanf_float entries in syscall table. This is done automatically - by startup code. - - Generated for ROM with MD5sum: - ab8282ae908fe9e7a63fb2a4ac2df013 eagle.pro.rom.out -*/ - -PROVIDE ( asiprintf = 0x40056d9c ); -PROVIDE ( _asiprintf_r = 0x40056d4c ); -PROVIDE ( asniprintf = 0x40056cd8 ); -PROVIDE ( _asniprintf_r = 0x40056c64 ); -PROVIDE ( asnprintf = 0x40056cd8 ); -PROVIDE ( _asnprintf_r = 0x40056c64 ); -PROVIDE ( asprintf = 0x40056d9c ); -PROVIDE ( _asprintf_r = 0x40056d4c ); -PROVIDE ( fiprintf = 0x40056efc ); -PROVIDE ( _fiprintf_r = 0x40056ed8 ); -PROVIDE ( fiscanf = 0x40058884 ); -PROVIDE ( _fiscanf_r = 0x400588b4 ); -PROVIDE ( fprintf = 0x40056efc ); -PROVIDE ( _fprintf_r = 0x40056ed8 ); -PROVIDE ( iprintf = 0x40056978 ); -PROVIDE ( _iprintf_r = 0x40056944 ); -PROVIDE ( printf = 0x40056978 ); -PROVIDE ( _printf_common = 0x40057338 ); -PROVIDE ( _printf_float = 0x4000befc ); -PROVIDE ( _printf_i = 0x40057404 ); -PROVIDE ( _printf_r = 0x40056944 ); -PROVIDE ( siprintf = 0x40056c08 ); -PROVIDE ( _siprintf_r = 0x40056bbc ); -PROVIDE ( sniprintf = 0x40056b4c ); -PROVIDE ( _sniprintf_r = 0x40056ae4 ); -PROVIDE ( snprintf = 0x40056b4c ); -PROVIDE ( _snprintf_r = 0x40056ae4 ); -PROVIDE ( sprintf = 0x40056c08 ); -PROVIDE ( _sprintf_r = 0x40056bbc ); -PROVIDE ( __sprint_r = 0x400577e4 ); -PROVIDE ( _svfiprintf_r = 0x40057100 ); -PROVIDE ( __svfiscanf_r = 0x40057b08 ); -PROVIDE ( _svfprintf_r = 0x40057100 ); -PROVIDE ( __svfscanf = 0x40057f04 ); -PROVIDE ( __svfscanf_r = 0x40057b08 ); -PROVIDE ( vasiprintf = 0x40056eb8 ); -PROVIDE ( _vasiprintf_r = 0x40056e80 ); -PROVIDE ( vasniprintf = 0x40056e58 ); -PROVIDE ( _vasniprintf_r = 0x40056df8 ); -PROVIDE ( vasnprintf = 0x40056e58 ); -PROVIDE ( _vasnprintf_r = 0x40056df8 ); -PROVIDE ( vasprintf = 0x40056eb8 ); -PROVIDE ( _vasprintf_r = 0x40056e80 ); -PROVIDE ( vfiprintf = 0x40057ae8 ); -PROVIDE ( _vfiprintf_r = 0x40057850 ); -PROVIDE ( vfiscanf = 0x40057eb8 ); -PROVIDE ( _vfiscanf_r = 0x40057f24 ); -PROVIDE ( vfprintf = 0x40057ae8 ); -PROVIDE ( _vfprintf_r = 0x40057850 ); -PROVIDE ( vfscanf = 0x40057eb8 ); -PROVIDE ( _vfscanf_r = 0x40057f24 ); -PROVIDE ( viprintf = 0x400569b4 ); -PROVIDE ( _viprintf_r = 0x400569e4 ); -PROVIDE ( viscanf = 0x40058698 ); -PROVIDE ( _viscanf_r = 0x400586c8 ); -PROVIDE ( vprintf = 0x400569b4 ); -PROVIDE ( _vprintf_r = 0x400569e4 ); -PROVIDE ( vscanf = 0x40058698 ); -PROVIDE ( _vscanf_r = 0x400586c8 ); -PROVIDE ( vsiprintf = 0x40056ac4 ); -PROVIDE ( _vsiprintf_r = 0x40056a90 ); -PROVIDE ( vsiscanf = 0x40058740 ); -PROVIDE ( _vsiscanf_r = 0x400586f8 ); -PROVIDE ( vsniprintf = 0x40056a68 ); -PROVIDE ( _vsniprintf_r = 0x40056a14 ); -PROVIDE ( vsnprintf = 0x40056a68 ); -PROVIDE ( _vsnprintf_r = 0x40056a14 ); -PROVIDE ( vsprintf = 0x40056ac4 ); -PROVIDE ( _vsprintf_r = 0x40056a90 ); -PROVIDE ( vsscanf = 0x40058740 ); -PROVIDE ( _vsscanf_r = 0x400586f8 ); -PROVIDE ( fscanf = 0x40058884 ); -PROVIDE ( _fscanf_r = 0x400588b4 ); -PROVIDE ( iscanf = 0x40058760 ); -PROVIDE ( _iscanf_r = 0x4005879c ); -PROVIDE ( scanf = 0x40058760 ); -PROVIDE ( _scanf_chars = 0x40058384 ); -PROVIDE ( _scanf_float = 0x4000bf18 ); -PROVIDE ( _scanf_i = 0x4005845c ); -PROVIDE ( _scanf_r = 0x4005879c ); -PROVIDE ( siscanf = 0x400587d0 ); -PROVIDE ( _siscanf_r = 0x40058830 ); -PROVIDE ( sscanf = 0x400587d0 ); -PROVIDE ( _sscanf_r = 0x40058830 ); -PROVIDE ( __ssvfiscanf_r = 0x4005802c ); -PROVIDE ( __ssvfscanf_r = 0x4005802c ); - - diff --git a/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld b/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld new file mode 100644 index 000000000..71e2d9160 --- /dev/null +++ b/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld @@ -0,0 +1,23 @@ +/* These are the .bss/.data symbols used by newlib functions present in ESP32 ROM. + See also esp32.rom.newlib-funcs.ld for the list of general newlib functions, + and esp32.rom.newlib-nano.ld for "nano" versions of printf/scanf family of functions. + + Unlike other ROM functions and data which are exported using PROVIDE, which declares + weak symbols, newlib related functions are exported using assignment, + which declares strong symbols. This is done so that ROM functions are always + used instead of the ones provided by libc.a. + */ + +_ctype_ = 0x3ff96354; +__ctype_ptr__ = 0x3ff96350; +_daylight = 0x3ffae0a4; +environ = 0x3ffae0b4; +_global_impure_ptr = 0x3ffae0b0; +__mb_cur_max = 0x3ff96530; +__month_lengths = 0x3ff9609c; +__sf_fake_stderr = 0x3ff96458; +__sf_fake_stdin = 0x3ff96498; +__sf_fake_stdout = 0x3ff96478; +_timezone = 0x3ffae0a0; +_tzname = 0x3ffae030; +__wctomb = 0x3ff96540; diff --git a/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld b/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld new file mode 100644 index 000000000..ed7c4910e --- /dev/null +++ b/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld @@ -0,0 +1,160 @@ +/* These are the newlib functions present in ESP32 ROM. + They should not be used when compiling with PSRAM cache workaround enabled. + See also esp32.rom.newlib-data.ld for the list of .data/.bss symbols + used by these functions, and esp32.rom.newlib-nano.ld for "nano" versions + of printf/scanf family of functions. + + Unlike other ROM functions which are exported using PROVIDE, which declares + weak symbols, newlib related functions are exported using assignment, + which declares strong symbols. This is done so that ROM functions are always + used instead of the ones provided by libc.a. + */ + +abs = 0x40056340; +__ascii_wctomb = 0x40058ef0; +asctime = 0x40059588; +asctime_r = 0x40000ec8; +atoi = 0x400566c4; +_atoi_r = 0x400566d4; +atol = 0x400566ec; +_atol_r = 0x400566fc; +bzero = 0x4000c1f4; +_cleanup = 0x40001df8; +_cleanup_r = 0x40001d48; +creat = 0x40000e8c; +ctime = 0x400595b0; +ctime_r = 0x400595c4; +div = 0x40056348; +__dummy_lock = 0x4000c728; +__dummy_lock_try = 0x4000c730; +__env_lock = 0x40001fd4; +__env_unlock = 0x40001fe0; +fclose = 0x400020ac; +_fclose_r = 0x40001fec; +fflush = 0x40059394; +_fflush_r = 0x40059320; +_findenv_r = 0x40001f44; +__fp_lock_all = 0x40001f1c; +__fp_unlock_all = 0x40001f30; +__fputwc = 0x40058da0; +fputwc = 0x40058ea8; +_fputwc_r = 0x40058e4c; +_fwalk = 0x4000c738; +_fwalk_reent = 0x4000c770; +__get_current_time_locale = 0x40001834; +_getenv_r = 0x40001fbc; +__gettzinfo = 0x40001fcc; +gmtime = 0x40059848; +gmtime_r = 0x40059868; +isalnum = 0x40000f04; +isalpha = 0x40000f18; +isascii = 0x4000c20c; +_isatty_r = 0x40000ea0; +isblank = 0x40000f2c; +iscntrl = 0x40000f50; +isdigit = 0x40000f64; +isgraph = 0x40000f94; +islower = 0x40000f78; +isprint = 0x40000fa8; +ispunct = 0x40000fc0; +isspace = 0x40000fd4; +isupper = 0x40000fe8; +__itoa = 0x40056678; +itoa = 0x400566b4; +labs = 0x40056370; +ldiv = 0x40056378; +__locale_charset = 0x40059540; +__locale_cjk_lang = 0x40059558; +localeconv = 0x4005957c; +_localeconv_r = 0x40059560; +__locale_mb_cur_max = 0x40059548; +__locale_msgcharset = 0x40059550; +localtime = 0x400595dc; +localtime_r = 0x400595fc; +longjmp = 0x400562cc; +memccpy = 0x4000c220; +memchr = 0x4000c244; +memcmp = 0x4000c260; +memcpy = 0x4000c2c8; +memmove = 0x4000c3c0; +memrchr = 0x4000c400; +memset = 0x4000c44c; +mktime = 0x4005a5e8; +qsort = 0x40056424; +rand = 0x40001058; +rand_r = 0x400010d4; +__sccl = 0x4000c498; +__sclose = 0x400011b8; +__seofread = 0x40001148; +setjmp = 0x40056268; +setlocale = 0x40059568; +_setlocale_r = 0x4005950c; +__sflush_r = 0x400591e0; +__sfmoreglue = 0x40001dc8; +__sfp = 0x40001e90; +__sfp_lock_acquire = 0x40001e08; +__sfp_lock_release = 0x40001e14; +__sfvwrite_r = 0x4005893c; +__sinit = 0x40001e38; +__sinit_lock_acquire = 0x40001e20; +__sinit_lock_release = 0x40001e2c; +__smakebuf_r = 0x40059108; +srand = 0x40001004; +__sread = 0x40001118; +__srefill_r = 0x400593d4; +__sseek = 0x40001184; +strcasecmp = 0x400011cc; +strcasestr = 0x40001210; +strcat = 0x4000c518; +strchr = 0x4000c53c; +strcmp = 0x40001274; +strcoll = 0x40001398; +strcpy = 0x400013ac; +strcspn = 0x4000c558; +strdup = 0x4000143c; +_strdup_r = 0x40001450; +strftime = 0x40059ab4; +strlcat = 0x40001470; +strlcpy = 0x4000c584; +strlen = 0x400014c0; +strlwr = 0x40001524; +strncasecmp = 0x40001550; +strncat = 0x4000c5c4; +strncmp = 0x4000c5f4; +strncpy = 0x400015d4; +strndup = 0x400016b0; +_strndup_r = 0x400016c4; +strnlen = 0x4000c628; +strrchr = 0x40001708; +strsep = 0x40001734; +strspn = 0x4000c648; +strstr = 0x4000c674; +__strtok_r = 0x4000c6a8; +strtok_r = 0x4000c70c; +strtol = 0x4005681c; +_strtol_r = 0x40056714; +strtoul = 0x4005692c; +_strtoul_r = 0x40056834; +strupr = 0x4000174c; +__submore = 0x40058f3c; +__swbuf = 0x40058cb4; +__swbuf_r = 0x40058bec; +__swrite = 0x40001150; +__swsetup_r = 0x40058cc8; +time = 0x40001844; +__time_load_locale = 0x4000183c; +toascii = 0x4000c720; +tolower = 0x40001868; +toupper = 0x40001884; +__tzcalc_limits = 0x400018a0; +__tz_lock = 0x40001a04; +tzset = 0x40001a1c; +_tzset_r = 0x40001a28; +__tz_unlock = 0x40001a10; +ungetc = 0x400590f4; +_ungetc_r = 0x40058fa0; +__utoa = 0x400561f0; +utoa = 0x40056258; +wcrtomb = 0x40058920; +_wcrtomb_r = 0x400588d8; +_wctomb_r = 0x40058f14; diff --git a/components/esp_rom/esp32/ld/esp32.rom.newlib-nano.ld b/components/esp_rom/esp32/ld/esp32.rom.newlib-nano.ld new file mode 100644 index 000000000..51d93a1ec --- /dev/null +++ b/components/esp_rom/esp32/ld/esp32.rom.newlib-nano.ld @@ -0,0 +1,115 @@ +/* These are the printf/scanf related newlib functions present in ESP32 ROM. + These functions are compiled with newlib "nano" format option. + As such, they don's support 64-bit integer formats. + Floating point formats are supported by setting _printf_float and + _scanf_float entries in syscall table. This is done automatically + by startup code. + These functions should not be used when compiling with PSRAM cache workaround enabled. + See also esp32.rom.newlib-data.ld for the list of .data/.bss symbols + used by newlib functions, and esp32.rom.newlib-funcs.ld for the list + of general newlib functions. + + Unlike other ROM functions which are exported using PROVIDE, which declares + weak symbols, newlib related functions are exported using assignment, + which declares strong symbols. This is done so that ROM functions are always + used instead of the ones provided by libc.a. + */ + +asiprintf = 0x40056d9c; +_asiprintf_r = 0x40056d4c; +asniprintf = 0x40056cd8; +_asniprintf_r = 0x40056c64; +asnprintf = 0x40056cd8; +_asnprintf_r = 0x40056c64; +asprintf = 0x40056d9c; +_asprintf_r = 0x40056d4c; +fiprintf = 0x40056efc; +_fiprintf_r = 0x40056ed8; +fiscanf = 0x40058884; +_fiscanf_r = 0x400588b4; +fprintf = 0x40056efc; +_fprintf_r = 0x40056ed8; +fscanf = 0x40058884; +_fscanf_r = 0x400588b4; +iprintf = 0x40056978; +_iprintf_r = 0x40056944; +iscanf = 0x40058760; +_iscanf_r = 0x4005879c; +printf = 0x40056978; +_printf_common = 0x40057338; +_printf_i = 0x40057404; +_printf_r = 0x40056944; +scanf = 0x40058760; +_scanf_chars = 0x40058384; +_scanf_i = 0x4005845c; +_scanf_r = 0x4005879c; +__sfputs_r = 0x40057790; +siprintf = 0x40056c08; +_siprintf_r = 0x40056bbc; +siscanf = 0x400587d0; +_siscanf_r = 0x40058830; +sniprintf = 0x40056b4c; +_sniprintf_r = 0x40056ae4; +snprintf = 0x40056b4c; +_snprintf_r = 0x40056ae4; +sprintf = 0x40056c08; +_sprintf_r = 0x40056bbc; +__sprint_r = 0x400577e4; +sscanf = 0x400587d0; +_sscanf_r = 0x40058830; +__ssprint_r = 0x40056ff8; +__ssputs_r = 0x40056f2c; +__ssrefill_r = 0x40057fec; +__ssvfiscanf_r = 0x4005802c; +__ssvfscanf_r = 0x4005802c; +_sungetc_r = 0x40057f6c; +_svfiprintf_r = 0x40057100; +__svfiscanf_r = 0x40057b08; +_svfprintf_r = 0x40057100; +__svfscanf = 0x40057f04; +__svfscanf_r = 0x40057b08; +vasiprintf = 0x40056eb8; +_vasiprintf_r = 0x40056e80; +vasniprintf = 0x40056e58; +_vasniprintf_r = 0x40056df8; +vasnprintf = 0x40056e58; +_vasnprintf_r = 0x40056df8; +vasprintf = 0x40056eb8; +_vasprintf_r = 0x40056e80; +vfiprintf = 0x40057ae8; +_vfiprintf_r = 0x40057850; +vfiscanf = 0x40057eb8; +_vfiscanf_r = 0x40057f24; +vfprintf = 0x40057ae8; +_vfprintf_r = 0x40057850; +vfscanf = 0x40057eb8; +_vfscanf_r = 0x40057f24; +viprintf = 0x400569b4; +_viprintf_r = 0x400569e4; +viscanf = 0x40058698; +_viscanf_r = 0x400586c8; +vprintf = 0x400569b4; +_vprintf_r = 0x400569e4; +vscanf = 0x40058698; +_vscanf_r = 0x400586c8; +vsiprintf = 0x40056ac4; +_vsiprintf_r = 0x40056a90; +vsiscanf = 0x40058740; +_vsiscanf_r = 0x400586f8; +vsniprintf = 0x40056a68; +_vsniprintf_r = 0x40056a14; +vsnprintf = 0x40056a68; +_vsnprintf_r = 0x40056a14; +vsprintf = 0x40056ac4; +_vsprintf_r = 0x40056a90; +vsscanf = 0x40058740; +_vsscanf_r = 0x400586f8; + +/* _print_float and _scanf_float functions in ROM are stubs which call + real implementations in IDF through the syscall table. + As such, don't include these ROM symbols. + +_printf_float = 0x4000befc; +_scanf_float = 0x4000bf18; + +*/ diff --git a/components/esp_rom/esp32/ld/esp32.rom.redefined.ld b/components/esp_rom/esp32/ld/esp32.rom.redefined.ld index c229640a2..a2383b311 100644 --- a/components/esp_rom/esp32/ld/esp32.rom.redefined.ld +++ b/components/esp_rom/esp32/ld/esp32.rom.redefined.ld @@ -3,7 +3,7 @@ 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 ); @@ -19,42 +19,21 @@ 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 ); diff --git a/components/esp_rom/esp32/ld/esp32.rom.spiram_incompatible_fns.ld b/components/esp_rom/esp32/ld/esp32.rom.spiram_incompatible_fns.ld deleted file mode 100644 index 17a38d355..000000000 --- a/components/esp_rom/esp32/ld/esp32.rom.spiram_incompatible_fns.ld +++ /dev/null @@ -1,163 +0,0 @@ -/* - If the spiram compiler workaround is active, these functions from ROM cannot be used. If the workaround is not - active (e.g. because the system does not use SPI RAM) then these functions are okay to use. -*/ -PROVIDE ( abs = 0x40056340 ); -PROVIDE ( __ascii_wctomb = 0x40058ef0 ); -PROVIDE ( asctime = 0x40059588 ); -PROVIDE ( asctime_r = 0x40000ec8 ); -PROVIDE ( atoi = 0x400566c4 ); -PROVIDE ( _atoi_r = 0x400566d4 ); -PROVIDE ( atol = 0x400566ec ); -PROVIDE ( _atol_r = 0x400566fc ); -PROVIDE ( bzero = 0x4000c1f4 ); -PROVIDE ( _cleanup = 0x40001df8 ); -PROVIDE ( _cleanup_r = 0x40001d48 ); -PROVIDE ( close = 0x40001778 ); -PROVIDE ( creat = 0x40000e8c ); -PROVIDE ( ctime = 0x400595b0 ); -PROVIDE ( ctime_r = 0x400595c4 ); -PROVIDE ( div = 0x40056348 ); -PROVIDE ( __dummy_lock = 0x4000c728 ); -PROVIDE ( __dummy_lock_try = 0x4000c730 ); -PROVIDE ( __env_lock = 0x40001fd4 ); -PROVIDE ( __env_unlock = 0x40001fe0 ); -PROVIDE ( fclose = 0x400020ac ); -PROVIDE ( _fclose_r = 0x40001fec ); -PROVIDE ( fflush = 0x40059394 ); -PROVIDE ( _fflush_r = 0x40059320 ); -PROVIDE ( _findenv_r = 0x40001f44 ); -PROVIDE ( __fp_lock_all = 0x40001f1c ); -PROVIDE ( __fp_unlock_all = 0x40001f30 ); -PROVIDE ( fputwc = 0x40058ea8 ); -PROVIDE ( __fputwc = 0x40058da0 ); -PROVIDE ( _fputwc_r = 0x40058e4c ); -PROVIDE ( _fwalk = 0x4000c738 ); -PROVIDE ( _fwalk_reent = 0x4000c770 ); -PROVIDE ( __get_current_time_locale = 0x40001834 ); -PROVIDE ( _getenv_r = 0x40001fbc ); -PROVIDE ( __gettzinfo = 0x40001fcc ); -PROVIDE ( gmtime = 0x40059848 ); -PROVIDE ( gmtime_r = 0x40059868 ); -PROVIDE ( isalnum = 0x40000f04 ); -PROVIDE ( isalpha = 0x40000f18 ); -PROVIDE ( isascii = 0x4000c20c ); -PROVIDE ( _isatty_r = 0x40000ea0 ); -PROVIDE ( isblank = 0x40000f2c ); -PROVIDE ( iscntrl = 0x40000f50 ); -PROVIDE ( isdigit = 0x40000f64 ); -PROVIDE ( isgraph = 0x40000f94 ); -PROVIDE ( islower = 0x40000f78 ); -PROVIDE ( isprint = 0x40000fa8 ); -PROVIDE ( ispunct = 0x40000fc0 ); -PROVIDE ( isspace = 0x40000fd4 ); -PROVIDE ( isupper = 0x40000fe8 ); -PROVIDE ( itoa = 0x400566b4 ); -PROVIDE ( __itoa = 0x40056678 ); -PROVIDE ( labs = 0x40056370 ); -PROVIDE ( ldiv = 0x40056378 ); -PROVIDE ( __locale_charset = 0x40059540 ); -PROVIDE ( __locale_cjk_lang = 0x40059558 ); -PROVIDE ( localeconv = 0x4005957c ); -PROVIDE ( _localeconv_r = 0x40059560 ); -PROVIDE ( __locale_mb_cur_max = 0x40059548 ); -PROVIDE ( __locale_msgcharset = 0x40059550 ); -PROVIDE ( localtime = 0x400595dc ); -PROVIDE ( localtime_r = 0x400595fc ); -PROVIDE ( longjmp = 0x400562cc ); -PROVIDE ( memccpy = 0x4000c220 ); -PROVIDE ( memchr = 0x4000c244 ); -PROVIDE ( memcmp = 0x4000c260 ); -PROVIDE ( memcpy = 0x4000c2c8 ); -PROVIDE ( memmove = 0x4000c3c0 ); -PROVIDE ( memrchr = 0x4000c400 ); -PROVIDE ( memset = 0x4000c44c ); -PROVIDE ( mktime = 0x4005a5e8 ); -PROVIDE ( open = 0x4000178c ); -PROVIDE ( qsort = 0x40056424 ); -PROVIDE ( rand = 0x40001058 ); -PROVIDE ( rand_r = 0x400010d4 ); -PROVIDE ( read = 0x400017dc ); -PROVIDE ( sbrk = 0x400017f4 ); -PROVIDE ( __sccl = 0x4000c498 ); -PROVIDE ( __sclose = 0x400011b8 ); -PROVIDE ( __seofread = 0x40001148 ); -PROVIDE ( setjmp = 0x40056268 ); -PROVIDE ( setlocale = 0x40059568 ); -PROVIDE ( _setlocale_r = 0x4005950c ); -PROVIDE ( __sflush_r = 0x400591e0 ); -PROVIDE ( __sfmoreglue = 0x40001dc8 ); -PROVIDE ( __sfp = 0x40001e90 ); -PROVIDE ( __sfp_lock_acquire = 0x40001e08 ); -PROVIDE ( __sfp_lock_release = 0x40001e14 ); -PROVIDE ( __sfputs_r = 0x40057790 ); -PROVIDE ( __sfvwrite_r = 0x4005893c ); -PROVIDE ( __sinit = 0x40001e38 ); -PROVIDE ( __sinit_lock_acquire = 0x40001e20 ); -PROVIDE ( __sinit_lock_release = 0x40001e2c ); -PROVIDE ( __smakebuf_r = 0x40059108 ); -PROVIDE ( srand = 0x40001004 ); -PROVIDE ( __sread = 0x40001118 ); -PROVIDE ( __srefill_r = 0x400593d4 ); -PROVIDE ( __sseek = 0x40001184 ); -PROVIDE ( __ssprint_r = 0x40056ff8 ); -PROVIDE ( __ssputs_r = 0x40056f2c ); -PROVIDE ( __ssrefill_r = 0x40057fec ); -PROVIDE ( strcasecmp = 0x400011cc ); -PROVIDE ( strcasestr = 0x40001210 ); -PROVIDE ( strcat = 0x4000c518 ); -PROVIDE ( strchr = 0x4000c53c ); -PROVIDE ( strcmp = 0x40001274 ); -PROVIDE ( strcoll = 0x40001398 ); -PROVIDE ( strcpy = 0x400013ac ); -PROVIDE ( strcspn = 0x4000c558 ); -PROVIDE ( strdup = 0x4000143c ); -PROVIDE ( _strdup_r = 0x40001450 ); -PROVIDE ( strftime = 0x40059ab4 ); -PROVIDE ( strlcat = 0x40001470 ); -PROVIDE ( strlcpy = 0x4000c584 ); -PROVIDE ( strlen = 0x400014c0 ); -PROVIDE ( strlwr = 0x40001524 ); -PROVIDE ( strncasecmp = 0x40001550 ); -PROVIDE ( strncat = 0x4000c5c4 ); -PROVIDE ( strncmp = 0x4000c5f4 ); -PROVIDE ( strncpy = 0x400015d4 ); -PROVIDE ( strndup = 0x400016b0 ); -PROVIDE ( _strndup_r = 0x400016c4 ); -PROVIDE ( strnlen = 0x4000c628 ); -PROVIDE ( strrchr = 0x40001708 ); -PROVIDE ( strsep = 0x40001734 ); -PROVIDE ( strspn = 0x4000c648 ); -PROVIDE ( strstr = 0x4000c674 ); -PROVIDE ( __strtok_r = 0x4000c6a8 ); -PROVIDE ( strtok_r = 0x4000c70c ); -PROVIDE ( strtol = 0x4005681c ); -PROVIDE ( _strtol_r = 0x40056714 ); -PROVIDE ( strtoul = 0x4005692c ); -PROVIDE ( _strtoul_r = 0x40056834 ); -PROVIDE ( strupr = 0x4000174c ); -PROVIDE ( __submore = 0x40058f3c ); -PROVIDE ( _sungetc_r = 0x40057f6c ); -PROVIDE ( __swbuf = 0x40058cb4 ); -PROVIDE ( __swbuf_r = 0x40058bec ); -PROVIDE ( __swrite = 0x40001150 ); -PROVIDE ( __swsetup_r = 0x40058cc8 ); -PROVIDE ( time = 0x40001844 ); -PROVIDE ( __time_load_locale = 0x4000183c ); -PROVIDE ( times = 0x40001808 ); -PROVIDE ( toascii = 0x4000c720 ); -PROVIDE ( tolower = 0x40001868 ); -PROVIDE ( toupper = 0x40001884 ); -PROVIDE ( __tzcalc_limits = 0x400018a0 ); -PROVIDE ( __tz_lock = 0x40001a04 ); -PROVIDE ( tzset = 0x40001a1c ); -PROVIDE ( _tzset_r = 0x40001a28 ); -PROVIDE ( __tz_unlock = 0x40001a10 ); -PROVIDE ( ungetc = 0x400590f4 ); -PROVIDE ( _ungetc_r = 0x40058fa0 ); -PROVIDE ( utoa = 0x40056258 ); -PROVIDE ( __utoa = 0x400561f0 ); -PROVIDE ( wcrtomb = 0x40058920 ); -PROVIDE ( _wcrtomb_r = 0x400588d8 ); -PROVIDE ( _wctomb_r = 0x40058f14 ); -PROVIDE ( write = 0x4000181c ); diff --git a/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld b/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld new file mode 100644 index 000000000..f358bddd3 --- /dev/null +++ b/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld @@ -0,0 +1,79 @@ +/* These ROM functions call respective entries in syscall table. + IDF implementations of these function carry different names + (usually esp_vfs_*) so we still export these functions, + in case some newlib function needs to call them. + + I.e.: + + open (in ROM) -> _open_r (in ROM) -> syscall table entry _open_r -> esp_vfs_open (in IDF) + + */ + +PROVIDE ( _close_r = 0x4000bd3c ); +PROVIDE ( _exit_r = 0x4000bd28 ); +PROVIDE ( _fstat_r = 0x4000bccc ); +PROVIDE ( _link_r = 0x4000bc9c ); +PROVIDE ( _lseek_r = 0x4000bd8c ); +PROVIDE ( _open_r = 0x4000bd54 ); +PROVIDE ( _read_r = 0x4000bda8 ); +PROVIDE ( _rename_r = 0x4000bc28 ); +PROVIDE ( _unlink_r = 0x4000bc84 ); +PROVIDE ( _write_r = 0x4000bd70 ); + + +/* These ROM functions call respective entries in the syscall table. + They are called by other ROM functions (mostly from newlib). + We don't link to them directly, since in IDF there are actual + implementations of these functions, with same names. + + I.e.: + + free (in ROM) -> _free_r (in ROM) -> syscall table entry _free_r -> _free_r (in IDF) + + Hence the following entries are provided only for reference + and commented out. + */ + +/* <--- the following lines are commented out + +PROVIDE ( _free_r = 0x4000bbcc ); +PROVIDE ( _getpid_r = 0x4000bcfc ); +PROVIDE ( __getreent = 0x4000be8c ); +PROVIDE ( _gettimeofday_r = 0x4000bc58 ); +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 ( _raise_r = 0x4000bc70 ); +PROVIDE ( _realloc_r = 0x4000bbe0 ); +PROVIDE ( _sbrk_r = 0x4000bce4 ); +PROVIDE ( _system_r = 0x4000bc10 ); +PROVIDE ( _times_r = 0x4000bc40 ); + + ---> end commented out block +*/ + + +/* These are the non-reentrant versions of syscalls present in the ROM. + They call the reentrant versions, passing the pointer returned by __getreent + as the first argument. + */ + +calloc = 0x4000bee4; +close = 0x40001778; +free = 0x4000beb8; +malloc = 0x4000bea0; +open = 0x4000178c; +read = 0x400017dc; +realloc = 0x4000becc; +sbrk = 0x400017f4; +times = 0x40001808; +write = 0x4000181c; From 8c2f2867d8e158de8dad4c03462d436b4e66c412 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 29 Mar 2019 12:37:51 +0800 Subject: [PATCH 07/12] =?UTF-8?q?esp=5From:=20don=E2=80=99t=20include=20lo?= =?UTF-8?q?cale=20functions=20when=20compiling=20with=20newlib=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/esp_rom/CMakeLists.txt | 4 ++++ components/esp_rom/component.mk | 4 ++++ .../esp32/ld/esp32.rom.newlib-funcs.ld | 8 -------- .../esp32/ld/esp32.rom.newlib-locale.ld | 19 +++++++++++++++++++ 4 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 components/esp_rom/esp32/ld/esp32.rom.newlib-locale.ld diff --git a/components/esp_rom/CMakeLists.txt b/components/esp_rom/CMakeLists.txt index 63a028172..cbf6f3dcb 100644 --- a/components/esp_rom/CMakeLists.txt +++ b/components/esp_rom/CMakeLists.txt @@ -27,6 +27,10 @@ else() target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.newlib-nano.ld") endif() + if(NOT GCC_NOT_5_2_0) + target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.newlib-locale.ld") + endif() + if(NOT CONFIG_SPI_FLASH_ROM_DRIVER_PATCH) target_linker_script(${COMPONENT_TARGET} "esp32/ld/esp32.rom.spiflash.ld") endif() diff --git a/components/esp_rom/component.mk b/components/esp_rom/component.mk index f53b15596..468132c12 100644 --- a/components/esp_rom/component.mk +++ b/components/esp_rom/component.mk @@ -16,6 +16,10 @@ ifdef CONFIG_NEWLIB_NANO_FORMAT LINKER_SCRIPTS += esp32.rom.newlib-nano.ld endif +ifneq ($(GCC_NOT_5_2_0), 1) +LINKER_SCRIPTS += esp32.rom.newlib-locale.ld +endif + ifndef CONFIG_SPI_FLASH_ROM_DRIVER_PATCH LINKER_SCRIPTS += esp32.rom.spiflash.ld endif diff --git a/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld b/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld index ed7c4910e..7a4c772e8 100644 --- a/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld +++ b/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld @@ -63,12 +63,6 @@ __itoa = 0x40056678; itoa = 0x400566b4; labs = 0x40056370; ldiv = 0x40056378; -__locale_charset = 0x40059540; -__locale_cjk_lang = 0x40059558; -localeconv = 0x4005957c; -_localeconv_r = 0x40059560; -__locale_mb_cur_max = 0x40059548; -__locale_msgcharset = 0x40059550; localtime = 0x400595dc; localtime_r = 0x400595fc; longjmp = 0x400562cc; @@ -87,8 +81,6 @@ __sccl = 0x4000c498; __sclose = 0x400011b8; __seofread = 0x40001148; setjmp = 0x40056268; -setlocale = 0x40059568; -_setlocale_r = 0x4005950c; __sflush_r = 0x400591e0; __sfmoreglue = 0x40001dc8; __sfp = 0x40001e90; diff --git a/components/esp_rom/esp32/ld/esp32.rom.newlib-locale.ld b/components/esp_rom/esp32/ld/esp32.rom.newlib-locale.ld new file mode 100644 index 000000000..81e22aaf3 --- /dev/null +++ b/components/esp_rom/esp32/ld/esp32.rom.newlib-locale.ld @@ -0,0 +1,19 @@ +/* These are the locale-related newlib functions present in ESP32 ROM. + ESP32 ROM contains newlib version 2.2.0, and these functions should not be + used when compiling with newlib version 3, since locale implementation is + different there. + + Unlike other ROM functions which are exported using PROVIDE, which declares + weak symbols, newlib related functions are exported using assignment, + which declares strong symbols. This is done so that ROM functions are always + used instead of the ones provided by libc.a. + */ + +__locale_charset = 0x40059540; +__locale_cjk_lang = 0x40059558; +localeconv = 0x4005957c; +_localeconv_r = 0x40059560; +__locale_mb_cur_max = 0x40059548; +__locale_msgcharset = 0x40059550; +setlocale = 0x40059568; +_setlocale_r = 0x4005950c; From 898b4bdf4d310d93296f0b25865599bea85ebb2b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 8 Mar 2019 15:07:50 +0800 Subject: [PATCH 08/12] newlib: when compiling with GCC8, use newlib headers and libraries from toolchain --- components/newlib/CMakeLists.txt | 41 +++-- components/newlib/component.mk | 21 ++- .../newlib/esp32-spiram-rom-functions-c.lf | 147 ++++++++++++++++++ ...-spiram-rom-functions-psram-workaround.lf} | 3 + 4 files changed, 202 insertions(+), 10 deletions(-) create mode 100644 components/newlib/esp32-spiram-rom-functions-c.lf rename components/newlib/{esp32-spiram-rom-functions.lf => esp32-spiram-rom-functions-psram-workaround.lf} (96%) diff --git a/components/newlib/CMakeLists.txt b/components/newlib/CMakeLists.txt index c6eed1a19..76645b33f 100644 --- a/components/newlib/CMakeLists.txt +++ b/components/newlib/CMakeLists.txt @@ -9,15 +9,10 @@ set(COMPONENT_SRCS "locks.c" "termios.c" "utime.c" "time.c") -set(COMPONENT_ADD_INCLUDEDIRS platform_include include) +set(COMPONENT_ADD_INCLUDEDIRS platform_include) -if(CONFIG_SPIRAM_CACHE_WORKAROUND) - set(LIBC c-psram-workaround) - set(LIBM m-psram-workaround) - - set(COMPONENT_ADD_LDFRAGMENTS esp32-spiram-rom-functions.lf) -else() +if(GCC_NOT_5_2_0) if(CONFIG_NEWLIB_NANO_FORMAT) set(LIBC c_nano) else() @@ -25,13 +20,41 @@ else() endif() set(LIBM m) -endif() + if(CONFIG_SPIRAM_CACHE_WORKAROUND) + set(COMPONENT_ADD_LDFRAGMENTS esp32-spiram-rom-functions-c.lf) + endif() + +else() + # Remove this section when GCC 5.2.0 is no longer supported + # 'include' and 'lib' directories should also be removed. + # An if statement about LIB_PATH below should also be removed. + list(APPEND COMPONENT_ADD_INCLUDEDIRS include) + set(LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib) + + if(CONFIG_SPIRAM_CACHE_WORKAROUND) + set(LIBC c-psram-workaround) + set(LIBM m-psram-workaround) + + set(COMPONENT_ADD_LDFRAGMENTS esp32-spiram-rom-functions-psram-workaround.lf) + else() + + if(CONFIG_NEWLIB_NANO_FORMAT) + set(LIBC c_nano) + else() + set(LIBC c) + endif() + + set(LIBM m) + endif() +endif() set(COMPONENT_REQUIRES vfs) # for sys/ioctl.h register_component() -target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib") +if (LIB_PATH) + target_link_libraries(${COMPONENT_TARGET} "-L ${LIB_PATH}") +endif() target_link_libraries(${COMPONENT_TARGET} ${LIBC} ${LIBM}) set_source_files_properties(syscalls.c PROPERTIES COMPILE_FLAGS -fno-builtin) diff --git a/components/newlib/component.mk b/components/newlib/component.mk index 399af6526..be7e730e8 100644 --- a/components/newlib/component.mk +++ b/components/newlib/component.mk @@ -1,8 +1,26 @@ +ifeq ($(GCC_NOT_5_2_0), 1) + +ifdef CONFIG_NEWLIB_NANO_FORMAT +LIBC := c_nano +else # CONFIG_NEWLIB_NANO_FORMAT +LIBC := c +endif # CONFIG_NEWLIB_NANO_FORMAT + +COMPONENT_ADD_LDFLAGS := -l$(LIBC) -lm -lnewlib +COMPONENT_ADD_INCLUDEDIRS := platform_include + +ifdef CONFIG_SPIRAM_CACHE_WORKAROUND +COMPONENT_ADD_LDFRAGMENTS := esp32-spiram-rom-functions-c.lf +endif + +else # GCC_NOT_5_2_0 +# Remove this section when GCC 5.2.0 is no longer supported + ifdef CONFIG_SPIRAM_CACHE_WORKAROUND LIBC_PATH := $(COMPONENT_PATH)/lib/libc-psram-workaround.a LIBM_PATH := $(COMPONENT_PATH)/lib/libm-psram-workaround.a -COMPONENT_ADD_LDFRAGMENTS := esp32-spiram-rom-functions.lf +COMPONENT_ADD_LDFRAGMENTS := esp32-spiram-rom-functions-psram-workaround.lf else ifdef CONFIG_NEWLIB_NANO_FORMAT @@ -20,5 +38,6 @@ COMPONENT_ADD_LDFLAGS := $(LIBC_PATH) $(LIBM_PATH) -lnewlib COMPONENT_ADD_LINKER_DEPS := $(LIBC_PATH) $(LIBM_PATH) COMPONENT_ADD_INCLUDEDIRS := platform_include include +endif # GCC_NOT_5_2_0 syscalls.o: CFLAGS += -fno-builtin diff --git a/components/newlib/esp32-spiram-rom-functions-c.lf b/components/newlib/esp32-spiram-rom-functions-c.lf new file mode 100644 index 000000000..cff6a68b5 --- /dev/null +++ b/components/newlib/esp32-spiram-rom-functions-c.lf @@ -0,0 +1,147 @@ +# If the Newlib functions in ROM aren't used (eg because the external SPI RAM workaround is active), these functions will +# be linked into the application directly instead. Normally, they would end up in flash, which is undesirable because esp-idf +# and/or applications may assume that because these functions normally are in ROM, they are accessible even when flash is +# inaccessible. To work around this, this ld fragment places these functions in RAM instead. If the ROM functions are used, +# these defines do nothing, so they can still be included in that situation. +# +# +# Note: the only difference between esp32-spiram-rom-functions-c.lf +# and esp32-spiram-rom-functions-psram-workaround.lf is the archive name. + +[mapping:libc] +archive: + if NEWLIB_NANO_FORMAT = y: + libc_nano.a + else: + libc.a +entries: + if SPIRAM_CACHE_WORKAROUND = y: + lib_a-utoa (noflash) + lib_a-longjmp (noflash) + lib_a-setjmp (noflash) + lib_a-abs (noflash) + lib_a-div (noflash) + lib_a-labs (noflash) + lib_a-ldiv (noflash) + lib_a-quorem (noflash) + lib_a-utoa (noflash) + lib_a-itoa (noflash) + lib_a-atoi (noflash) + lib_a-atol (noflash) + lib_a-strtol (noflash) + lib_a-strtoul (noflash) + lib_a-wcrtomb (noflash) + lib_a-fvwrite (noflash) + lib_a-wbuf (noflash) + lib_a-wsetup (noflash) + lib_a-fputwc (noflash) + lib_a-wctomb_r (noflash) + lib_a-ungetc (noflash) + lib_a-makebuf (noflash) + lib_a-fflush (noflash) + lib_a-refill (noflash) + lib_a-s_fpclassify (noflash) + lib_a-asctime (noflash) + lib_a-ctime (noflash) + lib_a-ctime_r (noflash) + lib_a-lcltime (noflash) + lib_a-lcltime_r (noflash) + lib_a-gmtime (noflash) + lib_a-gmtime_r (noflash) + lib_a-strftime (noflash) + lib_a-mktime (noflash) + lib_a-syswrite (noflash) + lib_a-tzset_r (noflash) + lib_a-tzset (noflash) + lib_a-toupper (noflash) + lib_a-tolower (noflash) + lib_a-toascii (noflash) + lib_a-systimes (noflash) + lib_a-time (noflash) + lib_a-gettzinfo (noflash) + lib_a-strupr (noflash) + lib_a-asctime_r (noflash) + lib_a-bzero (noflash) + lib_a-close (noflash) + lib_a-creat (noflash) + lib_a-environ (noflash) + lib_a-fclose (noflash) + lib_a-isalnum (noflash) + lib_a-isalpha (noflash) + lib_a-isascii (noflash) + lib_a-isblank (noflash) + lib_a-iscntrl (noflash) + lib_a-isdigit (noflash) + lib_a-isgraph (noflash) + lib_a-islower (noflash) + lib_a-isprint (noflash) + lib_a-ispunct (noflash) + lib_a-isspace (noflash) + lib_a-isupper (noflash) + lib_a-memccpy (noflash) + lib_a-memchr (noflash) + lib_a-memcmp (noflash) + lib_a-memcpy (noflash) + lib_a-memmove (noflash) + lib_a-memrchr (noflash) + lib_a-memset (noflash) + lib_a-open (noflash) + lib_a-rand (noflash) + lib_a-rand_r (noflash) + lib_a-read (noflash) + lib_a-rshift (noflash) + lib_a-sbrk (noflash) + lib_a-srand (noflash) + lib_a-strcasecmp (noflash) + lib_a-strcasestr (noflash) + lib_a-strcat (noflash) + lib_a-strchr (noflash) + lib_a-strcmp (noflash) + lib_a-strcoll (noflash) + lib_a-strcpy (noflash) + lib_a-strcspn (noflash) + lib_a-strdup (noflash) + lib_a-strlcat (noflash) + lib_a-strlcpy (noflash) + lib_a-strlen (noflash) + lib_a-strlwr (noflash) + lib_a-strncasecmp (noflash) + lib_a-strncat (noflash) + lib_a-strncmp (noflash) + lib_a-strncpy (noflash) + lib_a-strndup (noflash) + lib_a-strnlen (noflash) + lib_a-strrchr (noflash) + lib_a-strsep (noflash) + lib_a-strspn (noflash) + lib_a-strstr (noflash) + lib_a-strtok_r (noflash) + lib_a-strupr (noflash) + lib_a-stdio (noflash) + lib_a-syssbrk (noflash) + lib_a-sysclose (noflash) + lib_a-sysopen (noflash) + creat (noflash) + lib_a-sysread (noflash) + lib_a-syswrite (noflash) + lib_a-impure (noflash) + lib_a-tzvars (noflash) + lib_a-sf_nan (noflash) + lib_a-tzcalc_limits (noflash) + lib_a-month_lengths (noflash) + lib_a-timelocal (noflash) + lib_a-findfp (noflash) + lock (noflash) + lib_a-getenv_r (noflash) + isatty (noflash) + lib_a-fwalk (noflash) + lib_a-getenv_r (noflash) + lib_a-tzlock (noflash) + lib_a-ctype_ (noflash) + lib_a-sccl (noflash) + lib_a-strptime (noflash) + lib_a-envlock (noflash) + lib_a-raise (noflash) + lib_a-strdup_r (noflash) + lib_a-system (noflash) + lib_a-strndup_r (noflash) diff --git a/components/newlib/esp32-spiram-rom-functions.lf b/components/newlib/esp32-spiram-rom-functions-psram-workaround.lf similarity index 96% rename from components/newlib/esp32-spiram-rom-functions.lf rename to components/newlib/esp32-spiram-rom-functions-psram-workaround.lf index 216fb0590..6dbc06300 100644 --- a/components/newlib/esp32-spiram-rom-functions.lf +++ b/components/newlib/esp32-spiram-rom-functions-psram-workaround.lf @@ -7,6 +7,9 @@ # # Note: We currently never link libg-psram-workaround.a, so no rules # are generated for this library +# +# Note: the only difference between esp32-spiram-rom-functions-c.lf +# and esp32-spiram-rom-functions-psram-workaround.lf is the archive name. [mapping:libc_psram_workaround] archive: libc-psram-workaround.a From 05aab5c0b931ef743ec0e0bcd626928fa9a7510e Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 18 Mar 2019 11:47:00 +0800 Subject: [PATCH 09/12] newlib: force including IDF locks implementation --- components/newlib/CMakeLists.txt | 8 ++++++++ components/newlib/component.mk | 4 ++++ components/newlib/locks.c | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/components/newlib/CMakeLists.txt b/components/newlib/CMakeLists.txt index 76645b33f..6cb6fb8e5 100644 --- a/components/newlib/CMakeLists.txt +++ b/components/newlib/CMakeLists.txt @@ -25,6 +25,10 @@ if(GCC_NOT_5_2_0) set(COMPONENT_ADD_LDFRAGMENTS esp32-spiram-rom-functions-c.lf) endif() + # Forces the linker to include locks.o from this component, which + # replaces weak locking functions defined in libc.a:locks.o + set(EXTRA_LINK_FLAGS "-u newlib_include_locks_impl") + else() # Remove this section when GCC 5.2.0 is no longer supported # 'include' and 'lib' directories should also be removed. @@ -58,3 +62,7 @@ endif() target_link_libraries(${COMPONENT_TARGET} ${LIBC} ${LIBM}) set_source_files_properties(syscalls.c PROPERTIES COMPILE_FLAGS -fno-builtin) + +if(EXTRA_LINK_FLAGS) + target_link_libraries(${COMPONENT_TARGET} "${EXTRA_LINK_FLAGS}") +endif() diff --git a/components/newlib/component.mk b/components/newlib/component.mk index be7e730e8..008497ace 100644 --- a/components/newlib/component.mk +++ b/components/newlib/component.mk @@ -14,6 +14,10 @@ ifdef CONFIG_SPIRAM_CACHE_WORKAROUND COMPONENT_ADD_LDFRAGMENTS := esp32-spiram-rom-functions-c.lf endif +# Forces the linker to include locks.o from this component, which +# replaces weak locking functions defined in libc.a:locks.o +COMPONENT_ADD_LDFLAGS += -u newlib_include_locks_impl + else # GCC_NOT_5_2_0 # Remove this section when GCC 5.2.0 is no longer supported diff --git a/components/newlib/locks.c b/components/newlib/locks.c index 708ddab3f..9efaf51f3 100644 --- a/components/newlib/locks.c +++ b/components/newlib/locks.c @@ -216,3 +216,10 @@ void IRAM_ATTR _lock_release(_lock_t *lock) { void IRAM_ATTR _lock_release_recursive(_lock_t *lock) { lock_release_generic(lock, queueQUEUE_TYPE_RECURSIVE_MUTEX); } + +/* No-op function, used to force linking this file, + instead of the dummy locks implementation from newlib. + */ +void newlib_include_locks_impl() +{ +} From 5719cd6fac238f8611324f5b5bd2190dee6b0678 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 1 Apr 2019 15:21:12 +0800 Subject: [PATCH 10/12] newlib: when compiling with GCC8, use newlib headers and libraries from toolchain --- .../esp_rom/esp32/ld/esp32.rom.syscalls.ld | 10 +- components/newlib/CMakeLists.txt | 19 ++- components/newlib/component.mk | 13 +- components/newlib/heap.c | 126 ++++++++++++++++++ components/newlib/newlib.lf | 6 + components/newlib/syscalls.c | 49 +------ 6 files changed, 165 insertions(+), 58 deletions(-) create mode 100644 components/newlib/heap.c create mode 100644 components/newlib/newlib.lf diff --git a/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld b/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld index f358bddd3..811d879dd 100644 --- a/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld +++ b/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld @@ -28,7 +28,7 @@ PROVIDE ( _write_r = 0x4000bd70 ); I.e.: - free (in ROM) -> _free_r (in ROM) -> syscall table entry _free_r -> _free_r (in IDF) + times (in ROM) -> _times_r (in ROM) -> syscall table entry _times_r -> _times_r (in IDF) Hence the following entries are provided only for reference and commented out. @@ -36,6 +36,8 @@ PROVIDE ( _write_r = 0x4000bd70 ); /* <--- the following lines are commented out +PROVIDE ( calloc = 0x4000bee4 ); +PROVIDE ( free = 0x4000beb8 ); PROVIDE ( _free_r = 0x4000bbcc ); PROVIDE ( _getpid_r = 0x4000bcfc ); PROVIDE ( __getreent = 0x4000be8c ); @@ -51,8 +53,10 @@ PROVIDE ( _lock_release = 0x4000be64 ); PROVIDE ( _lock_release_recursive = 0x4000be78 ); PROVIDE ( _lock_try_acquire = 0x4000be3c ); PROVIDE ( _lock_try_acquire_recursive = 0x4000be50 ); +PROVIDE ( malloc = 0x4000bea0 ); PROVIDE ( _malloc_r = 0x4000bbb4 ); PROVIDE ( _raise_r = 0x4000bc70 ); +PROVIDE ( realloc = 0x4000becc ); PROVIDE ( _realloc_r = 0x4000bbe0 ); PROVIDE ( _sbrk_r = 0x4000bce4 ); PROVIDE ( _system_r = 0x4000bc10 ); @@ -67,13 +71,9 @@ PROVIDE ( _times_r = 0x4000bc40 ); as the first argument. */ -calloc = 0x4000bee4; close = 0x40001778; -free = 0x4000beb8; -malloc = 0x4000bea0; open = 0x4000178c; read = 0x400017dc; -realloc = 0x4000becc; sbrk = 0x400017f4; times = 0x40001808; write = 0x4000181c; diff --git a/components/newlib/CMakeLists.txt b/components/newlib/CMakeLists.txt index 6cb6fb8e5..a5bae29ad 100644 --- a/components/newlib/CMakeLists.txt +++ b/components/newlib/CMakeLists.txt @@ -1,14 +1,15 @@ -set(COMPONENT_SRCS "locks.c" +set(COMPONENT_SRCS "heap.c" + "locks.c" + "poll.c" "pthread.c" "random.c" "reent_init.c" "select.c" - "poll.c" "syscall_table.c" "syscalls.c" "termios.c" - "utime.c" - "time.c") + "time.c" + "utime.c") set(COMPONENT_ADD_INCLUDEDIRS platform_include) @@ -25,9 +26,11 @@ if(GCC_NOT_5_2_0) set(COMPONENT_ADD_LDFRAGMENTS esp32-spiram-rom-functions-c.lf) endif() - # Forces the linker to include locks.o from this component, which - # replaces weak locking functions defined in libc.a:locks.o + # Forces the linker to include locks, heap, and syscalls from this component, + # instead of the implementations provided by newlib. set(EXTRA_LINK_FLAGS "-u newlib_include_locks_impl") + list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_heap_impl") + list(APPEND EXTRA_LINK_FLAGS "-u newlib_include_syscalls_impl") else() # Remove this section when GCC 5.2.0 is no longer supported @@ -54,6 +57,8 @@ else() endif() set(COMPONENT_REQUIRES vfs) # for sys/ioctl.h +list(APPEND COMPONENT_ADD_LDFRAGMENTS newlib.lf) + register_component() if (LIB_PATH) @@ -61,7 +66,7 @@ if (LIB_PATH) endif() target_link_libraries(${COMPONENT_TARGET} ${LIBC} ${LIBM}) -set_source_files_properties(syscalls.c PROPERTIES COMPILE_FLAGS -fno-builtin) +set_source_files_properties(heap.c PROPERTIES COMPILE_FLAGS -fno-builtin) if(EXTRA_LINK_FLAGS) target_link_libraries(${COMPONENT_TARGET} "${EXTRA_LINK_FLAGS}") diff --git a/components/newlib/component.mk b/components/newlib/component.mk index 008497ace..1f99816aa 100644 --- a/components/newlib/component.mk +++ b/components/newlib/component.mk @@ -7,16 +7,19 @@ else # CONFIG_NEWLIB_NANO_FORMAT LIBC := c endif # CONFIG_NEWLIB_NANO_FORMAT -COMPONENT_ADD_LDFLAGS := -l$(LIBC) -lm -lnewlib +# Order of linking matters: libnewlib.a should go before libc.a +COMPONENT_ADD_LDFLAGS := -lnewlib -l$(LIBC) -lm COMPONENT_ADD_INCLUDEDIRS := platform_include ifdef CONFIG_SPIRAM_CACHE_WORKAROUND COMPONENT_ADD_LDFRAGMENTS := esp32-spiram-rom-functions-c.lf endif -# Forces the linker to include locks.o from this component, which -# replaces weak locking functions defined in libc.a:locks.o +# Forces the linker to include locks, heap, and syscalls from this component, +# instead of the implementations provided by newlib. COMPONENT_ADD_LDFLAGS += -u newlib_include_locks_impl +COMPONENT_ADD_LDFLAGS += -u newlib_include_heap_impl +COMPONENT_ADD_LDFLAGS += -u newlib_include_syscalls_impl else # GCC_NOT_5_2_0 # Remove this section when GCC 5.2.0 is no longer supported @@ -44,4 +47,6 @@ COMPONENT_ADD_LINKER_DEPS := $(LIBC_PATH) $(LIBM_PATH) COMPONENT_ADD_INCLUDEDIRS := platform_include include endif # GCC_NOT_5_2_0 -syscalls.o: CFLAGS += -fno-builtin +COMPONENT_ADD_LDFRAGMENTS += newlib.lf + +heap.o: CFLAGS += -fno-builtin diff --git a/components/newlib/heap.c b/components/newlib/heap.c new file mode 100644 index 000000000..37380a347 --- /dev/null +++ b/components/newlib/heap.c @@ -0,0 +1,126 @@ +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include +#include +#include +#include "esp_heap_caps.h" + + +/* + These contain the business logic for the malloc() and realloc() implementation. Because of heap tracing + wrapping reasons, we do not want these to be a public api, however, so they're not defined publicly. +*/ +extern void *heap_caps_malloc_default( size_t size ); +extern void *heap_caps_realloc_default( void *ptr, size_t size ); + + +void* malloc(size_t size) +{ + return heap_caps_malloc_default(size); +} + +void* calloc(size_t n, size_t size) +{ + return _calloc_r(_REENT, n, size); +} + +void* realloc(void* ptr, size_t size) +{ + return heap_caps_realloc_default(ptr, size); +} + +void free(void *ptr) +{ + heap_caps_free(ptr); +} + +void* _malloc_r(struct _reent *r, size_t size) +{ + return heap_caps_malloc_default(size); +} + +void _free_r(struct _reent *r, void* ptr) +{ + heap_caps_free(ptr); +} + +void* _realloc_r(struct _reent *r, void* ptr, size_t size) +{ + return heap_caps_realloc_default( ptr, size ); +} + +void* _calloc_r(struct _reent *r, size_t nmemb, size_t size) +{ + void *result; + size_t size_bytes; + if (__builtin_mul_overflow(nmemb, size, &size_bytes)) { + return NULL; + } + + result = heap_caps_malloc_default(size_bytes); + if (result != NULL) { + bzero(result, size_bytes); + } + return result; +} + +/* No-op function, used to force linking this file, + instead of the heap implementation from newlib. + */ +void newlib_include_heap_impl() +{ +} + +/* The following functions are implemented by newlib's heap allocator, + but aren't available in the heap component. + Define them as non-functional stubs here, so that the application + can not cause the newlib heap implementation to be linked in + */ +void* memalign(size_t alignment, size_t n) +{ + extern void memalign_function_was_linked_but_unsupported_in_esp_idf(void); + memalign_function_was_linked_but_unsupported_in_esp_idf(); + return NULL; +} + +int malloc_trim(size_t pad) +{ + return 0; // indicates failure +} + +size_t malloc_usable_size(void* p) +{ + return 0; +} + +void malloc_stats() +{ +} + +int mallopt(int parameter_number, int parameter_value) +{ + return 0; // indicates failure +} + +struct mallinfo mallinfo() +{ + struct mallinfo dummy = {0}; + return dummy; +} + +void* valloc(size_t n) __attribute__((alias("malloc"))); +void* pvalloc(size_t n) __attribute__((alias("malloc"))); +void cfree(void* p) __attribute__((alias("free"))); diff --git a/components/newlib/newlib.lf b/components/newlib/newlib.lf new file mode 100644 index 000000000..59d3ace55 --- /dev/null +++ b/components/newlib/newlib.lf @@ -0,0 +1,6 @@ +# Places the heap related functions from heap.c into IRAM + +[mapping:newlib] +archive: libnewlib.a +entries: + heap (noflash) diff --git a/components/newlib/syscalls.c b/components/newlib/syscalls.c index d1c06a472..899f21d48 100644 --- a/components/newlib/syscalls.c +++ b/components/newlib/syscalls.c @@ -14,54 +14,13 @@ #include #include +#include #include #include #include #include -#include -#include "esp_attr.h" -#include "freertos/FreeRTOS.h" -#include "esp_heap_caps.h" -/* - These contain the business logic for the malloc() and realloc() implementation. Because of heap tracing - wrapping reasons, we do not want these to be a public api, however, so they're not defined publicly. -*/ -extern void *heap_caps_malloc_default( size_t size ); -extern void *heap_caps_realloc_default( void *ptr, size_t size ); - - -void* IRAM_ATTR _malloc_r(struct _reent *r, size_t size) -{ - return heap_caps_malloc_default( size ); -} - -void IRAM_ATTR _free_r(struct _reent *r, void* ptr) -{ - heap_caps_free( ptr ); -} - -void* IRAM_ATTR _realloc_r(struct _reent *r, void* ptr, size_t size) -{ - return heap_caps_realloc_default( ptr, size ); -} - -void* IRAM_ATTR _calloc_r(struct _reent *r, size_t nmemb, size_t size) -{ - void *result; - size_t size_bytes; - if (__builtin_mul_overflow(nmemb, size, &size_bytes)) { - return NULL; - } - - result = malloc(size_bytes); - if (result != NULL) { - bzero(result, size_bytes); - } - return result; -} - int _system_r(struct _reent *r, const char *str) { __errno_r(r) = ENOSYS; @@ -95,3 +54,9 @@ void _exit(int __status) abort(); } +/* No-op function, used to force linking this file, + instead of the syscalls implementation from libgloss. + */ +void newlib_include_syscalls_impl() +{ +} From 2e6c8cdce35031ffec3165f590dd07b82a04339e Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Tue, 9 Apr 2019 10:14:31 +0700 Subject: [PATCH 11/12] esp32: disable -Wframe-address Since the behavior is well defined on Xtensa with Window ABI we can suppress a frame-address warning. Also fix the CMAKE_C*_FLAGS parsing. --- make/project.mk | 1 + tools/cmake/idf_functions.cmake | 2 ++ tools/cmake/toolchain-esp32.cmake | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/make/project.mk b/make/project.mk index 06c7e02da..17f07c2cd 100644 --- a/make/project.mk +++ b/make/project.mk @@ -397,6 +397,7 @@ endif #CONFIG_WARN_WRITE_STRINGS # Flags which control code generation and dependency generation, both for C and C++ COMMON_FLAGS = \ + -Wno-frame-address \ -ffunction-sections -fdata-sections \ -fstrict-volatile-bitfields \ -mlongcalls \ diff --git a/tools/cmake/idf_functions.cmake b/tools/cmake/idf_functions.cmake index 9da794313..104144ac1 100644 --- a/tools/cmake/idf_functions.cmake +++ b/tools/cmake/idf_functions.cmake @@ -92,6 +92,8 @@ function(idf_set_global_compile_options) list(APPEND compile_definitions "ESP_PLATFORM" "HAVE_CONFIG_H") + spaces2list(CMAKE_C_FLAGS) + spaces2list(CMAKE_CXX_FLAGS) list(APPEND compile_options "${CMAKE_C_FLAGS}") list(APPEND c_compile_options "${CMAKE_C_FLAGS}") list(APPEND cxx_compile_options "${CMAKE_CXX_FLAGS}") diff --git a/tools/cmake/toolchain-esp32.cmake b/tools/cmake/toolchain-esp32.cmake index e8fbbef2b..b311d7ab6 100644 --- a/tools/cmake/toolchain-esp32.cmake +++ b/tools/cmake/toolchain-esp32.cmake @@ -5,5 +5,5 @@ set(CMAKE_CXX_COMPILER xtensa-esp32-elf-g++) set(CMAKE_ASM_COMPILER xtensa-esp32-elf-gcc) set(CMAKE_EXE_LINKER_FLAGS "-nostdlib" CACHE STRING "Linker Base Flags") -set(CMAKE_C_FLAGS "-mlongcalls" CACHE STRING "C Compiler Base Flags") -set(CMAKE_CXX_FLAGS "-mlongcalls" CACHE STRING "C++ Compiler Base Flags") +set(CMAKE_C_FLAGS "-mlongcalls -Wno-frame-address" CACHE STRING "C Compiler Base Flags") +set(CMAKE_CXX_FLAGS "-mlongcalls -Wno-frame-address" CACHE STRING "C++ Compiler Base Flags") From a567b6c1f6b91aec331e88b8ea46a0c692ff3b45 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Wed, 10 Apr 2019 21:05:10 +0700 Subject: [PATCH 12/12] pthread: Use a definition only if we have the old toolchain --- components/newlib/platform_include/pthread.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/newlib/platform_include/pthread.h b/components/newlib/platform_include/pthread.h index 3c7d4f8a1..35be88a60 100644 --- a/components/newlib/platform_include/pthread.h +++ b/components/newlib/platform_include/pthread.h @@ -16,8 +16,12 @@ #include #include +#include +// Remove this when GCC 5.2.0 is no longer supported +#ifndef _POSIX_TIMEOUTS #define _POSIX_TIMEOUTS // For pthread_mutex_timedlock +#endif #include_next