Skip to content

Commit

Permalink
soc: xtensa: esp32_net: update linker
Browse files Browse the repository at this point in the history
and adds newlibc fix for esp32_net SoC

Signed-off-by: Felipe Neves <felipe.neves@linaro.org>
  • Loading branch information
uLipe authored and carlescufi committed Aug 16, 2022
1 parent d94dc98 commit f01f8f3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion soc/xtensa/esp32/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ MEMORY
ROM (RX): org = 0x40, len = ROM_SIZE - 0x40

#ifdef CONFIG_ESP32_NETWORK_CORE
iram0_0_seg(RX): org = 0x40080000, len = 0x10000
iram0_0_seg(RX): org = 0x40080000, len = 0x08000
#else
iram0_0_seg(RX): org = 0x40080000, len = 0x20000
#endif
Expand Down
2 changes: 2 additions & 0 deletions soc/xtensa/esp32_net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ zephyr_sources(
soc.c
)

zephyr_library_sources_ifdef(CONFIG_NEWLIB_LIBC newlib_fix.c)

if(CONFIG_BUILD_OUTPUT_BIN)
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${ESP_IDF_PATH}/components/esptool_py/esptool/esptool.py
Expand Down
5 changes: 4 additions & 1 deletion soc/xtensa/esp32_net/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

MEMORY
{
iram0_0_seg(RX): org = 0x40080000 + 0x10000, len = 0x10000
iram0_0_seg(RX): org = 0x40080000 + 0x08000, len = 0x18000
dram0_shm0_seg(RW): org = 0x3FFE5230, len = 2K /* shared RAM reserved for IPM */
dram0_sem0_seg(RW): org = 0x3FFE5A30, len = 8 /*shared data reserved for IPM data header */
dram0_1_seg(RW): org = 0x3FFE5A38 + CONFIG_ESP32_BT_RESERVE_DRAM, len = 0x1BCB0 - 0xEE0 - CONFIG_ESP32_BT_RESERVE_DRAM
Expand Down Expand Up @@ -186,6 +186,7 @@ _net_buf_pool_list = _esp_net_buf_pool_list;

KEEP(*(.jcr))
*(.dram1 .dram1.*)
_end = ABSOLUTE(.);
_data_end = ABSOLUTE(.);
. = ALIGN(4);
} GROUP_LINK_IN(RAMABLE_REGION)
Expand Down Expand Up @@ -424,6 +425,8 @@ __shell_root_cmds_end = __esp_shell_root_cmds_end;
#include <zephyr/linker/intlist.ld>
#endif

_heap_sentry = 0x3ffe3f20;

#include <zephyr/linker/debug-sections.ld>

SECTION_PROLOGUE(.xtensa.info, 0,)
Expand Down
22 changes: 22 additions & 0 deletions soc/xtensa/esp32_net/newlib_fix.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2019, Intel Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/toolchain.h>
#include <stdio.h>
#include <stddef.h>
#include <unistd.h>
#include <sys/stat.h>

#include <reent.h>

int __weak _gettimeofday_r(struct _reent *r, struct timeval *__tp, void *__tzp)
{
ARG_UNUSED(r);
ARG_UNUSED(__tp);
ARG_UNUSED(__tzp);

return -1;
}

0 comments on commit f01f8f3

Please sign in to comment.