Skip to content

Commit ab57ef2

Browse files
committed
soc: esp32c6: Improve shared memory
Improve shared memory usage among HP and LP Core Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
1 parent 66acb36 commit ab57ef2

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

soc/espressif/esp32c6/default_lpcore.ld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ _aligned_coproc_mem = ALIGNED_COPROC_MEM;
2424
_vector_table_org = LPSRAM_IRAM_START;
2525
_vector_table_len = 0x80;
2626
_ram_org = _vector_table_org + _vector_table_len;
27-
_ram_len = _aligned_coproc_mem - _vector_table_len - ULP_SHARED_MEM;
28-
_shared_mem_org = _ram_org + _ram_len;
29-
_shared_mem_len = ULP_SHARED_MEM;
27+
_ram_len = _aligned_coproc_mem - _vector_table_len - ULP_SHARED_MEM_SIZE;
28+
_shared_mem_org = ULP_SHARED_MEM_ADDR;
29+
_shared_mem_len = ULP_SHARED_MEM_SIZE;
3030

3131
ENTRY(reset_vector)
3232

soc/espressif/esp32c6/hpcore_init_ulp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
#include "ulp_lp_core.h"
1111
#include "lp_core_uart.h"
1212
#include <zephyr/logging/log.h>
13+
#include <zephyr/devicetree.h>
1314

1415
LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
1516

1617
void IRAM_ATTR lp_core_image_init(void)
1718
{
1819
const uint32_t lpcore_img_off = FIXED_PARTITION_OFFSET(slot0_lpcore_partition);
19-
const uint32_t lpcore_img_size = 0x4000;
20+
const uint32_t lpcore_img_size =
21+
DT_REG_SIZE(DT_NODELABEL(sramlp)) - DT_REG_SIZE(DT_NODELABEL(shmlp));
2022
int ret = 0;
2123

2224
LOG_INF("Getting LPU image at %p, size %d", (void *)lpcore_img_off, lpcore_img_size);

soc/espressif/esp32c6/memory.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
/* LP-SRAM (16kB) memory */
88
#define LPSRAM_IRAM_START DT_REG_ADDR(DT_NODELABEL(sramlp))
99
#define LPSRAM_SIZE DT_REG_SIZE(DT_NODELABEL(sramlp))
10-
#define ULP_SHARED_MEM DT_REG_SIZE(DT_NODELABEL(shmlp))
10+
#define ULP_SHARED_MEM_SIZE DT_REG_SIZE(DT_NODELABEL(shmlp))
11+
#define ULP_SHARED_MEM_ADDR DT_REG_ADDR(DT_NODELABEL(shmlp))
1112
#define ULP_COPROC_RESERVE_MEM (0x4000)
1213

1314
/* HP-SRAM (512kB) memory */

0 commit comments

Comments
 (0)