mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 13:27:01 +08:00
arch/xtensa: update SPI Flash driver for ESP32-S2|S3
Updates the SPI Flash driver used for user storage MTD. Moves ESP32 and ESP32S3 to use common driver. Updates KConfig options to keep backwards compatibility. Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
This commit is contained in:
committed by
Matteo Golin
parent
4ccae59e69
commit
680766d304
@@ -221,15 +221,12 @@ SECTIONS
|
||||
*libarch.a:*log_write.*(.literal.esp_log_writev .text.esp_log_writev)
|
||||
*libarch.a:*cpu_region_protect.*(.text .text.* .literal .literal.*)
|
||||
*libarch.a:*flash_qio_mode.*(.text .text.* .literal .literal.*)
|
||||
*libarch.a:*spi_flash_wrap.*(.text .text.* .literal .literal.*)
|
||||
|
||||
#ifdef CONFIG_STACK_CANARIES
|
||||
*libc.a:lib_stackchk.*(.literal .text .literal.* .text.*)
|
||||
#endif
|
||||
*libarch.a:esp32_cpuindex.*(.literal .text .literal.* .text.*)
|
||||
*libarch.a:esp32_irq.*(.literal .text .literal.* .text.*)
|
||||
*libarch.a:esp32_spicache.*(.literal .text .literal.* .text.*)
|
||||
*libarch.a:esp32_spiflash.*(.literal .text .literal.* .text.*)
|
||||
*libarch.a:esp32_user.*(.literal .text .literal.* .text.*)
|
||||
*libarch.a:xtensa_assert.*(.literal .text .literal.* .text.*)
|
||||
*libarch.a:xtensa_cpuint.*(.literal .text .literal.* .text.*)
|
||||
@@ -258,6 +255,22 @@ SECTIONS
|
||||
*libsched.a:sched_unlock.*(.literal .text .literal.* .text.*)
|
||||
*libsched.a:spinlock.*(.literal .text .literal.* .text.*)
|
||||
|
||||
*libarch.a:esp_spiflash.*(.literal .text .literal.* .text.*)
|
||||
*libarch.a:esp_flash_api.*(.text .text.* .literal .literal.*)
|
||||
*libarch.a:esp_flash_spi_init.*(.text .text.* .literal .literal.*)
|
||||
*libarch.a:spi_flash_hal_iram.*(.literal .literal.* .text .text.*)
|
||||
*libarch.a:spi_flash_encrypt_hal_iram.*(.text .text.* .literal .literal.*)
|
||||
*libarch.a:spi_flash_hal_gpspi.*(.literal .literal.* .text .text.*)
|
||||
*libarch.a:spi_flash_chip*.*(.literal .literal.* .text .text.*)
|
||||
*libarch.a:spi_flash_wrap.*(.literal .literal.* .text .text.*)
|
||||
*libarch.a:spi_flash_os_func_noos.*(.literal .literal.* .text .text.*)
|
||||
*libarch.a:spi_flash_os_func_app.*(.literal .literal.* .text .text.*)
|
||||
*libarch.a:flash_brownout_hook.*(.literal .literal.* .text .text.*)
|
||||
*libarch.a:esp_cache.*(.literal .literal.* .text .text.*)
|
||||
*libarch.a:cache_hal_esp32.*(.literal .literal.* .text .text.*)
|
||||
*libarch.a:cache_utils.*(.literal .literal.* .text .text.*)
|
||||
*libarch.a:memspi_host_driver.*(.literal .literal.* .text .text.*)
|
||||
|
||||
*(.wifirxiram .wifirxiram.*)
|
||||
*(.wifi0iram .wifi0iram.*)
|
||||
*(.wifiorslpiram .wifiorslpiram.*)
|
||||
@@ -347,8 +360,7 @@ SECTIONS
|
||||
#ifdef CONFIG_STACK_CANARIES
|
||||
*libc.a:lib_stackchk.*(.bss .bss.* COMMON)
|
||||
#endif
|
||||
*libarch.a:esp32_spicache.*(.bss .bss.* COMMON)
|
||||
*libarch.a:esp32_spiflash.*(.bss .bss.* COMMON)
|
||||
*libarch.a:esp_spiflash.*(.bss .bss.* COMMON)
|
||||
*libarch.a:xtensa_cpupause.*(.bss .bss.* COMMON)
|
||||
*libarch.a:xtensa_copystate.*(.bss .bss.* COMMON)
|
||||
*libarch.a:xtensa_interruptcontext.*(.bss .bss.* COMMON)
|
||||
@@ -411,8 +423,6 @@ SECTIONS
|
||||
*libsched.a:irq_csection.*(.rodata .rodata.*)
|
||||
*libsched.a:irq_dispatch.*(.rodata .rodata.*)
|
||||
|
||||
*libarch.a:esp32_spicache.*(.rodata .rodata.*)
|
||||
*libarch.a:esp32_spiflash.*(.rodata .rodata.*)
|
||||
*libarch.a:*esp_loader.*(.rodata .rodata.*)
|
||||
*libarch.a:*brownout.*(.rodata .rodata.*)
|
||||
*libarch.a:*cpu.*(.rodata .rodata.*)
|
||||
@@ -462,7 +472,21 @@ SECTIONS
|
||||
*libarch.a:*log_noos.*(.rodata .rodata.*)
|
||||
*libarch.a:*cpu_region_protect.*(.rodata .rodata.*)
|
||||
*libarch.a:*flash_qio_mode.*(.rodata .rodata.*)
|
||||
*libarch.a:*spi_flash_wrap.*(.rodata .rodata.*)
|
||||
|
||||
*libarch.a:esp_flash_api.*(.rodata .rodata.*)
|
||||
*libarch.a:esp_flash_spi_init.*(.rodata .rodata.*)
|
||||
*libarch.a:spi_flash_hal_iram.*(.rodata .rodata.*)
|
||||
*libarch.a:spi_flash_encrypt_hal_iram.*(.rodata .rodata.*)
|
||||
*libarch.a:spi_flash_hal_gpspi.*(.rodata .rodata.*)
|
||||
*libarch.a:spi_flash_chip*.*(.rodata .rodata.*)
|
||||
*libarch.a:spi_flash_wrap.*(.rodata .rodata.*)
|
||||
*libarch.a:spi_flash_os_func_noos.*(.rodata .rodata.*)
|
||||
*libarch.a:spi_flash_os_func_app.*(.rodata .rodata.*)
|
||||
*libarch.a:flash_brownout_hook.*(.rodata .rodata.*)
|
||||
*libarch.a:esp_cache.*(.rodata .rodata.*)
|
||||
*libarch.a:cache_utils.*(.rodata .rodata.*)
|
||||
*libarch.a:cache_hal_esp32.*(.rodata .rodata.*)
|
||||
*libarch.a:memspi_host_driver.*(.rodata .rodata.*)
|
||||
|
||||
_edata = ABSOLUTE(.);
|
||||
_data_end = ABSOLUTE(.);
|
||||
@@ -526,12 +550,12 @@ SECTIONS
|
||||
|
||||
. = ALIGN(4);
|
||||
_srodata = ABSOLUTE(.);
|
||||
*(EXCLUDE_FILE (*libarch.a:esp32_spiflash.* esp32_start.*
|
||||
*(EXCLUDE_FILE (*libarch.a:esp_spiflash.* esp32_start.*
|
||||
*libarch.a:*esp_loader.*
|
||||
*libarch.a:*uart_hal.*
|
||||
*libarch.a:*mmu_hal.*
|
||||
) .rodata)
|
||||
*(EXCLUDE_FILE (*libarch.a:esp32_spiflash.* esp32_start.*
|
||||
*(EXCLUDE_FILE (*libarch.a:esp_spiflash.* esp32_start.*
|
||||
*libarch.a:*esp_loader.*
|
||||
*libarch.a:*uart_hal.*
|
||||
*libarch.a:*mmu_hal.*
|
||||
@@ -703,4 +727,22 @@ SECTIONS
|
||||
. = ALIGN (4);
|
||||
_srtcheap = ABSOLUTE(.);
|
||||
} >rtc_slow_seg AT>ROM
|
||||
|
||||
/*
|
||||
* This section holds RTC data that should have fixed addresses.
|
||||
* The data are not initialized at power-up and are retained during deep sleep.
|
||||
*/
|
||||
.rtc_reserved (NOLOAD):
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_rtc_reserved_start = ABSOLUTE(.);
|
||||
/* New data can only be added here to ensure existing data are not moved.
|
||||
Because data have adhered to the end of the segment and code is relied on it.
|
||||
>> put new data here << */
|
||||
|
||||
*(.rtc_timer_data_in_rtc_mem .rtc_timer_data_in_rtc_mem.*)
|
||||
KEEP(*(.bootloader_data_rtc_mem .bootloader_data_rtc_mem.*))
|
||||
_rtc_reserved_end = ABSOLUTE(.);
|
||||
} > rtc_reserved_seg
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,9 @@
|
||||
# define FLASH_SIZE 0x1000000
|
||||
#endif
|
||||
|
||||
#define SRAM1_IRAM_LEN 0xa000
|
||||
#define SRAM1_IRAM_LEN 0xa000
|
||||
#define RTC_TIMER_RESERVE_RTC (24)
|
||||
#define RESERVE_RTC_MEM (RTC_TIMER_RESERVE_RTC)
|
||||
|
||||
MEMORY
|
||||
{
|
||||
@@ -154,6 +156,8 @@ MEMORY
|
||||
rtc_slow_seg (RW) : org = 0x50000000 + CONFIG_ESP32_ULP_COPROC_RESERVE_MEM,
|
||||
len = 0x1000 - CONFIG_ESP32_ULP_COPROC_RESERVE_MEM
|
||||
|
||||
rtc_reserved_seg(RW) : org = 0x50000000 + 0x2000 - RESERVE_RTC_MEM, len = RESERVE_RTC_MEM
|
||||
|
||||
/* External memory, including data and text */
|
||||
|
||||
extmem_seg (RWX) : org = 0x3f800000, len = 0x400000
|
||||
|
||||
@@ -117,7 +117,8 @@ SECTIONS
|
||||
_iram_text_start = ABSOLUTE(.);
|
||||
*(.iram1 .iram1.*)
|
||||
*librtc.a:(.literal .text .literal.* .text.*)
|
||||
*libkarch.a:esp32_spiflash.*(.literal .text .literal.* .text.*)
|
||||
*libkarch.a:esp_spiflash.*(.literal .text .literal.* .text.*)
|
||||
*libkarch.a:*esp_clk.*(.text .text.* .literal .literal.*)
|
||||
*libkarch.a:xtensa_cpupause.*(.literal .text .literal.* .text.*)
|
||||
*libkarch.a:xtensa_copystate.*(.literal .text .literal.* .text.*)
|
||||
*libkarch.a:xtensa_interruptcontext.*(.literal .text .literal.* .text.*)
|
||||
@@ -177,7 +178,7 @@ SECTIONS
|
||||
*(.share.mem)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
*libkarch.a:esp32_spiflash.*(.bss .bss.* COMMON)
|
||||
*libkarch.a:esp_spiflash.*(.bss .bss.* COMMON)
|
||||
*libkarch.a:xtensa_cpupause.*(.bss .bss.* COMMON)
|
||||
*libkarch.a:xtensa_copystate.*(.bss .bss.* COMMON)
|
||||
*libkarch.a:xtensa_interruptcontext.*(.bss .bss.* COMMON)
|
||||
@@ -230,7 +231,8 @@ SECTIONS
|
||||
KEEP (*(.jcr))
|
||||
*(.dram1 .dram1.*)
|
||||
*libphy.a:(.rodata .rodata.*)
|
||||
*libkarch.a:esp32_spiflash.*(.rodata .rodata.*)
|
||||
*libkarch.a:esp_spiflash.*(.rodata .rodata.*)
|
||||
*libkarch.a:*esp_clk.*(.rodata .rodata.*)
|
||||
*libkarch.a:xtensa_cpupause.*(.rodata .rodata.*)
|
||||
*libkarch.a:xtensa_copystate.*(.rodata .rodata.*)
|
||||
*libkarch.a:xtensa_interruptcontext.*(.rodata .rodata.*)
|
||||
@@ -332,4 +334,21 @@ SECTIONS
|
||||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >KIROM
|
||||
|
||||
/*
|
||||
* This section holds RTC data that should have fixed addresses.
|
||||
* The data are not initialized at power-up and are retained during deep sleep.
|
||||
*/
|
||||
.rtc_reserved (NOLOAD):
|
||||
{
|
||||
. = ALIGN(4);
|
||||
_rtc_reserved_start = ABSOLUTE(.);
|
||||
/* New data can only be added here to ensure existing data are not moved.
|
||||
Because data have adhered to the end of the segment and code is relied on it.
|
||||
>> put new data here << */
|
||||
|
||||
*(.rtc_timer_data_in_rtc_mem .rtc_timer_data_in_rtc_mem.*)
|
||||
KEEP(*(.bootloader_data_rtc_mem .bootloader_data_rtc_mem.*))
|
||||
_rtc_reserved_end = ABSOLUTE(.);
|
||||
} > rtc_reserved_seg
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
#include <nuttx/fs/nxffs.h>
|
||||
#endif
|
||||
|
||||
#include "esp32_spiflash.h"
|
||||
#include "espressif/esp_spiflash.h"
|
||||
#include "espressif/esp_spiflash_mtd.h"
|
||||
#include "esp32_board_spiflash.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -116,8 +117,7 @@ static int init_ota_partitions(void)
|
||||
for (int i = 0; i < nitems(g_ota_partition_table); ++i)
|
||||
{
|
||||
const struct partition_s *part = &g_ota_partition_table[i];
|
||||
mtd = esp32_spiflash_alloc_mtdpart(part->firstblock, part->blocksize,
|
||||
OTA_ENCRYPT);
|
||||
mtd = esp_spiflash_alloc_mtdpart(part->firstblock, part->blocksize);
|
||||
|
||||
ret = register_mtddriver(part->name, mtd, 0755, NULL);
|
||||
if (ret < 0)
|
||||
@@ -350,9 +350,8 @@ static int init_storage_partition(void)
|
||||
int ret = OK;
|
||||
struct mtd_dev_s *mtd;
|
||||
|
||||
mtd = esp32_spiflash_alloc_mtdpart(CONFIG_ESP32_STORAGE_MTD_OFFSET,
|
||||
CONFIG_ESP32_STORAGE_MTD_SIZE,
|
||||
STORAGE_ENCRYPT);
|
||||
mtd = esp_spiflash_alloc_mtdpart(CONFIG_ESP32_STORAGE_MTD_OFFSET,
|
||||
CONFIG_ESP32_STORAGE_MTD_SIZE);
|
||||
if (!mtd)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to alloc MTD partition of SPI Flash\n");
|
||||
@@ -446,7 +445,7 @@ int board_spiflash_init(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
ret = esp32_spiflash_init();
|
||||
ret = esp_spiflash_init();
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
|
||||
@@ -15,6 +15,7 @@ CONFIG_ARCH_BOARD_ESP32_DEVKITC=y
|
||||
CONFIG_ARCH_CHIP="esp32"
|
||||
CONFIG_ARCH_CHIP_ESP32=y
|
||||
CONFIG_ARCH_CHIP_ESP32WROVER=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_XTENSA=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=16717
|
||||
@@ -30,7 +31,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INIT_STACKSIZE=3072
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LINE_MAX=64
|
||||
CONFIG_MM_REGIONS=3
|
||||
CONFIG_MM_REGIONS=4
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_DISABLE_LOSMART=y
|
||||
@@ -41,6 +42,8 @@ CONFIG_RAM_SIZE=114688
|
||||
CONFIG_RAM_START=0x20000000
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_SMP_NCPUS=2
|
||||
CONFIG_SPI=y
|
||||
CONFIG_START_DAY=6
|
||||
CONFIG_START_MONTH=12
|
||||
|
||||
Reference in New Issue
Block a user