riscv/esp32c3: Add module text allocator.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2021-06-04 12:21:47 +01:00 committed by Gustavo Henrique Nihei
parent 778e3ed4ad
commit 2d55f2659e
3 changed files with 88 additions and 0 deletions

View File

@ -50,6 +50,7 @@ config ARCH_CHIP_ESP32C3
select LIBC_ARCH_MEMCCMP
select LIBC_ARCH_MEMMOVE
select LIBC_ARCH_MEMSET
select ARCH_HAVE_MODULE_TEXT
---help---
Espressif ESP32-C3 (RV32IMC).

View File

@ -142,6 +142,10 @@ ifeq ($(CONFIG_ESP32C3_AES_ACCELERATOR),y)
CHIP_CSRCS += esp32c3_aes.c
endif
ifeq ($(CONFIG_ARCH_USE_MODULE_TEXT),y)
CHIP_CSRCS += esp32c3_modtext.c
endif
ifeq ($(CONFIG_ESP32C3_WIRELESS),y)
WIRELESS_DRV_UNPACK = esp-wireless-drivers-3rdparty
WIRELESS_DRV_ID = 2b53111

View File

@ -0,0 +1,83 @@
/****************************************************************************
* arch/risc-v/src/esp32c3/esp32c3_modtext.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 <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define D_I_BUS_OFFSET 0x700000
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_module_text_init()
****************************************************************************/
void up_module_text_init()
{
}
/****************************************************************************
* Name: up_module_text_memalign()
****************************************************************************/
FAR void *up_module_text_memalign(size_t align, size_t size)
{
FAR void *ret;
ret = kmm_memalign(align, size);
if (ret)
{
ret += D_I_BUS_OFFSET;
}
return ret;
}
/****************************************************************************
* Name: up_module_text_free()
****************************************************************************/
void up_module_text_free(FAR void *p)
{
if (p)
{
p -= D_I_BUS_OFFSET;
}
kmm_free(p);
}