diff --git a/arch/risc-v/src/esp32c3/Kconfig b/arch/risc-v/src/esp32c3/Kconfig index e12fdcd735..45c97131ab 100644 --- a/arch/risc-v/src/esp32c3/Kconfig +++ b/arch/risc-v/src/esp32c3/Kconfig @@ -159,6 +159,7 @@ config ESP32C3_DISABLE_STDC_ATOMIC config ESP32C3_RTC_HEAP bool "Use the RTC memory as a separate heap" + select ARCH_HAVE_EXTRA_HEAPS default n menu "ESP32-C3 Peripheral Support" diff --git a/arch/risc-v/src/esp32c3/Make.defs b/arch/risc-v/src/esp32c3/Make.defs index aea0f6cd6f..bd622791a9 100644 --- a/arch/risc-v/src/esp32c3/Make.defs +++ b/arch/risc-v/src/esp32c3/Make.defs @@ -160,6 +160,10 @@ CHIP_CSRCS += esp32c3_efuse_table.c CHIP_CSRCS += esp32c3_efuse_lowerhalf.c endif +ifeq ($(CONFIG_ARCH_HAVE_EXTRA_HEAPS),y) +CHIP_CSRCS += esp32c3_extraheaps.c +endif + ifeq ($(CONFIG_ARCH_USE_TEXT_HEAP),y) CHIP_CSRCS += esp32c3_textheap.c endif diff --git a/arch/risc-v/src/esp32c3/esp32c3_extraheaps.c b/arch/risc-v/src/esp32c3/esp32c3_extraheaps.c new file mode 100644 index 0000000000..beb6b96fa6 --- /dev/null +++ b/arch/risc-v/src/esp32c3/esp32c3_extraheaps.c @@ -0,0 +1,62 @@ +/**************************************************************************** + * arch/risc-v/src/esp32c3/esp32c3_extraheaps.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "hardware/esp32c3_soc.h" + +#ifdef CONFIG_ESP32C3_RTC_HEAP +#include "esp32c3_rtcheap.h" +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_extraheaps_init + * + * Description: + * Initialize any extra heap. + * + ****************************************************************************/ + +void up_extraheaps_init() +{ +#ifdef CONFIG_ESP32C3_RTC_HEAP + /* Initialize the RTC heap */ + + esp32c3_rtcheap_initialize(); +#endif +} + diff --git a/arch/risc-v/src/esp32c3/esp32c3_textheap.c b/arch/risc-v/src/esp32c3/esp32c3_textheap.c index fbb94bc8cd..2bc65bf389 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_textheap.c +++ b/arch/risc-v/src/esp32c3/esp32c3_textheap.c @@ -49,19 +49,6 @@ * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: up_textheap_init() - ****************************************************************************/ - -void up_textheap_init() -{ -#ifdef CONFIG_ESP32C3_RTC_HEAP - /* Initialize the RTC heap */ - - esp32c3_rtcheap_initialize(); -#endif -} - /**************************************************************************** * Name: up_textheap_memalign() *