Compare commits

...

15 Commits

Author SHA1 Message Date
Alin Jerpelea
3fede42098 documentation: Add release notes for 10.2.0 release
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-10-28 14:44:52 +02:00
ligd
6075f479d5 mqueue: fix memory leak cause by lost inode_release
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-10-25 12:23:39 -05:00
Gustavo Henrique Nihei
519dde3639 xtensa/esp32s2: Provide SPI Flash parameters to MCUboot build
Also unify bootloader config creation to reduce duplication.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-10-18 14:38:04 -05:00
Gustavo Henrique Nihei
25341e4622 xtensa/esp32: Provide SPI Flash parameters to MCUboot build
Also unify bootloader config creation to reduce duplication.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-10-18 14:38:04 -05:00
Gustavo Henrique Nihei
575a35b1fb risc-v/esp32c3: Provide SPI Flash parameters to MCUboot build
Also unify bootloader config creation to reduce duplication.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-10-18 14:38:04 -05:00
Gustavo Henrique Nihei
b1fab12a99 risc-v/esp32c3: Add esp-nuttx-bootloader folder to gitignore list
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-10-18 14:38:04 -05:00
Gustavo Henrique Nihei
99dbc0e9fe risc-v/esp32c3: Fix wrong arch in the path to chip folder
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-10-18 14:38:04 -05:00
Abdelatif Guettouche
37aa299b07 arch/xtensa/xtensa_cpupause.c: Allow a spin before taking the g_cpu_wait
spinlock.

If we repeatedly call up_cpu_pause and up_cpu_resume, there would be
cases where the next call to up_cpu_pause happens while the other CPU is
still responding to the previous resume request.  In this case the
DEBUGASSERT will trigger.  We should allow the first CPU to wait until the
other CPU has finished responding to the resume request.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-10-18 12:55:35 -05:00
Abdelatif Guettouche
55718fb23f esp32_spiflash.c: Allocate only one variable to hold the cache state in
single CPU mode.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-10-18 14:21:27 +02:00
Abdelatif Guettouche
756adce078 esp32_spiflash.c: Keep the index of the other CPU between SPI Flash
operations.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-10-18 14:21:27 +02:00
Abdelatif Guettouche
9e717995bf xtensa_testset.c: Simplify the test-set function and remove some old
comments.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-10-18 14:21:27 +02:00
Abdelatif Guettouche
6e95087b3b esp32_spiflash.c: Pause the other CPU during flash operation.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-10-18 14:21:27 +02:00
Abdelatif Guettouche
9b982a5d61 esp32.ld: Force some of libsched.a symbols to internal SRAM. They are used
when the cache is disabled.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-10-18 14:21:27 +02:00
Abdelatif Guettouche
deb2aca815 esp32.ld: Force some of libarch.a symbols to internal SRAM. They are used
when the cache is disabled.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-10-18 14:21:27 +02:00
Abdelatif Guettouche
440dcd3c03 esp32_intercpu_interrupt.c: Force the functions to internal SRAM.
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
2021-10-18 14:21:27 +02:00
11 changed files with 1132 additions and 132 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +1,3 @@
/esp-wireless-drivers-3rdparty
/esp-nuttx-bootloader
/*.zip

View File

@@ -20,22 +20,35 @@
ifeq ($(CONFIG_ESP32C3_BOOTLOADER_BUILD_FROM_SOURCE),y)
CHIPDIR = $(TOPDIR)/arch/xtensa/src/chip
CHIPDIR = $(TOPDIR)/arch/risc-v/src/chip
BOOTLOADER_SRCDIR = $(CHIPDIR)/esp-nuttx-bootloader
BOOTLOADER_VERSION = main
BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader
BOOTLOADER_OUTDIR = out
BOOTLOADER_CONFIG = $(CHIPDIR)/bootloader.conf
$(BOOTLOADER_SRCDIR):
$(Q) git clone $(BOOTLOADER_URL) $(BOOTLOADER_SRCDIR) -b $(BOOTLOADER_VERSION)
ifeq ($(CONFIG_ESP32C3_APP_FORMAT_MCUBOOT),y)
BOOTLOADER_CONFIG = $(CHIPDIR)/mcuboot.conf
$(BOOTLOADER_CONFIG): $(TOPDIR)/.config
$(Q) echo "Creating Bootloader configuration"
$(Q) { \
[ "$(CONFIG_ESP32C3_FLASH_2M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y"; \
[ "$(CONFIG_ESP32C3_FLASH_4M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y"; \
[ "$(CONFIG_ESP32C3_FLASH_8M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y"; \
[ "$(CONFIG_ESP32C3_FLASH_16M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y"; \
[ "$(CONFIG_ESP32C3_FLASH_MODE_DIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DIO=y"; \
[ "$(CONFIG_ESP32C3_FLASH_MODE_DOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y"; \
[ "$(CONFIG_ESP32C3_FLASH_MODE_QIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QIO=y"; \
[ "$(CONFIG_ESP32C3_FLASH_MODE_QOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y"; \
[ "$(CONFIG_ESP32C3_FLASH_FREQ_80M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_80M=y"; \
[ "$(CONFIG_ESP32C3_FLASH_FREQ_40M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_40M=y"; \
[ "$(CONFIG_ESP32C3_FLASH_FREQ_26M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_26M=y"; \
[ "$(CONFIG_ESP32C3_FLASH_FREQ_20M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_20M=y"; \
true; \
} > $(BOOTLOADER_CONFIG)
ifeq ($(CONFIG_ESP32C3_APP_FORMAT_MCUBOOT),y)
$(Q) { \
echo "CONFIG_ESP_BOOTLOADER_SIZE=0xF000"; \
echo "CONFIG_ESP_APPLICATION_PRIMARY_START_ADDRESS=$(CONFIG_ESP32C3_OTA_PRIMARY_SLOT_OFFSET)"; \
@@ -44,7 +57,15 @@ $(BOOTLOADER_CONFIG): $(TOPDIR)/.config
echo "CONFIG_ESP_MCUBOOT_WDT_ENABLE=y"; \
echo "CONFIG_ESP_SCRATCH_OFFSET=$(CONFIG_ESP32C3_OTA_SCRATCH_OFFSET)"; \
echo "CONFIG_ESP_SCRATCH_SIZE=$(CONFIG_ESP32C3_OTA_SCRATCH_SIZE)"; \
} > $(BOOTLOADER_CONFIG)
} >> $(BOOTLOADER_CONFIG)
else ifeq ($(CONFIG_ESP32C3_APP_FORMAT_LEGACY),y)
$(Q) { \
echo "CONFIG_PARTITION_TABLE_CUSTOM=y"; \
echo "CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions.csv\""; \
} >> $(BOOTLOADER_CONFIG)
endif
ifeq ($(CONFIG_ESP32C3_APP_FORMAT_MCUBOOT),y)
bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
$(Q) echo "Building Bootloader binaries"
@@ -58,27 +79,6 @@ clean_bootloader:
else ifeq ($(CONFIG_ESP32C3_APP_FORMAT_LEGACY),y)
BOOTLOADER_CONFIG = $(CHIPDIR)/sdkconfig
$(BOOTLOADER_CONFIG): $(TOPDIR)/.config
$(Q) echo "Creating Bootloader configuration"
$(Q) { \
[ "$(CONFIG_ESP32C3_FLASH_2M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y"; \
[ "$(CONFIG_ESP32C3_FLASH_4M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y"; \
[ "$(CONFIG_ESP32C3_FLASH_8M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y"; \
[ "$(CONFIG_ESP32C3_FLASH_16M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y"; \
[ "$(CONFIG_ESP32C3_FLASH_MODE_DIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DIO=y"; \
[ "$(CONFIG_ESP32C3_FLASH_MODE_DOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y"; \
[ "$(CONFIG_ESP32C3_FLASH_MODE_QIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QIO=y"; \
[ "$(CONFIG_ESP32C3_FLASH_MODE_QOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y"; \
[ "$(CONFIG_ESP32C3_FLASH_FREQ_80M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_80M=y"; \
[ "$(CONFIG_ESP32C3_FLASH_FREQ_40M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_40M=y"; \
[ "$(CONFIG_ESP32C3_FLASH_FREQ_26M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_26M=y"; \
[ "$(CONFIG_ESP32C3_FLASH_FREQ_20M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_20M=y"; \
echo "CONFIG_PARTITION_TABLE_CUSTOM=y"; \
echo "CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions.csv\""; \
} > $(BOOTLOADER_CONFIG)
bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
$(Q) echo "Building Bootloader binaries"
$(Q) $(BOOTLOADER_SRCDIR)/build_idfboot.sh -c esp32c3 -s -f $(BOOTLOADER_CONFIG)

View File

@@ -231,10 +231,12 @@ int up_cpu_pause(int cpu)
* handler from returning until up_cpu_resume() is called; g_cpu_paused
* is a handshake that will prevent this function from returning until
* the CPU is actually paused.
* Note that we might spin before getting g_cpu_wait, this just means that
* the other CPU still hasn't finished responding to the previous resume
* request.
*/
DEBUGASSERT(!spin_islocked(&g_cpu_wait[cpu]) &&
!spin_islocked(&g_cpu_paused[cpu]));
DEBUGASSERT(!spin_islocked(&g_cpu_paused[cpu]));
spin_lock(&g_cpu_wait[cpu]);
spin_lock(&g_cpu_paused[cpu]);

View File

@@ -56,8 +56,9 @@ static inline uint32_t xtensa_compareset(volatile uint32_t *addr,
__asm__ __volatile__
(
"WSR %2, SCOMPARE1\n" /* Initialize SCOMPARE1 */
"S32C1I %0, %1, 0\n" /* Store id into the lock, if the lock is the
* same as comparel. Otherwise, no write-access */
"S32C1I %0, %1, 0\n" /* Store the compare value into the lock,
* if the lock is the same as compare1.
* Otherwise, no write-access */
: "=r"(set) : "r"(addr), "r"(compare), "0"(set)
);
@@ -90,36 +91,10 @@ static inline uint32_t xtensa_compareset(volatile uint32_t *addr,
spinlock_t up_testset(volatile spinlock_t *lock)
{
spinlock_t prev;
/* Perform the 32-bit compare and set operation */
prev = xtensa_compareset((volatile uint32_t *)lock,
return xtensa_compareset((volatile uint32_t *)lock,
SP_UNLOCKED, SP_LOCKED);
/* xtensa_compareset() should return either SP_UNLOCKED if the spinlock
* was locked or SP_LOCKED or possibly ~SP_UNLOCKED if the spinlock was
* not locked:
*
* "In the RE-2013.0 release and after, there is a slight change in the
* semantics of the S32C1I instruction. Nothing is changed about the
* operation on memory. In rare cases the resulting value in register
* at can be different in this and later releases. The rule still holds
* that memory has been written if and only if the register result
* equals SCOMPARE1.
*
* "The difference is that in some cases where memory has not been
* written, the instruction returns ~SCOMPARE1 instead of the current
* value of memory. Although this change can, in principle, affect
* the operation of code, scanning all internal Cadence code produced
* no examples where this change would change the operation of the
* code."
*
* In any case, the return value of SP_UNLOCKED can be trusted and will
* always mean that the spinlock was set.
*/
return (prev == SP_UNLOCKED) ? SP_UNLOCKED : SP_LOCKED;
}
#endif /* CONFIG_SPINLOCK */

View File

@@ -26,16 +26,29 @@ BOOTLOADER_SRCDIR = $(CHIPDIR)/esp-nuttx-bootloader
BOOTLOADER_VERSION = main
BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader
BOOTLOADER_OUTDIR = out
BOOTLOADER_CONFIG = $(CHIPDIR)/bootloader.conf
$(BOOTLOADER_SRCDIR):
$(Q) git clone $(BOOTLOADER_URL) $(BOOTLOADER_SRCDIR) -b $(BOOTLOADER_VERSION)
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
BOOTLOADER_CONFIG = $(CHIPDIR)/mcuboot.conf
$(BOOTLOADER_CONFIG): $(TOPDIR)/.config
$(Q) echo "Creating Bootloader configuration"
$(Q) { \
[ "$(CONFIG_ESP32_FLASH_2M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y"; \
[ "$(CONFIG_ESP32_FLASH_4M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y"; \
[ "$(CONFIG_ESP32_FLASH_8M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y"; \
[ "$(CONFIG_ESP32_FLASH_16M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y"; \
[ "$(CONFIG_ESP32_FLASH_MODE_DIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DIO=y"; \
[ "$(CONFIG_ESP32_FLASH_MODE_DOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y"; \
[ "$(CONFIG_ESP32_FLASH_MODE_QIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QIO=y"; \
[ "$(CONFIG_ESP32_FLASH_MODE_QOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y"; \
[ "$(CONFIG_ESP32_FLASH_FREQ_80M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_80M=y"; \
[ "$(CONFIG_ESP32_FLASH_FREQ_40M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_40M=y"; \
[ "$(CONFIG_ESP32_FLASH_FREQ_26M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_26M=y"; \
[ "$(CONFIG_ESP32_FLASH_FREQ_20M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_20M=y"; \
true; \
} > $(BOOTLOADER_CONFIG)
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
$(Q) { \
echo "CONFIG_ESP_BOOTLOADER_SIZE=0xF000"; \
echo "CONFIG_ESP_APPLICATION_PRIMARY_START_ADDRESS=$(CONFIG_ESP32_OTA_PRIMARY_SLOT_OFFSET)"; \
@@ -44,7 +57,15 @@ $(BOOTLOADER_CONFIG): $(TOPDIR)/.config
echo "CONFIG_ESP_MCUBOOT_WDT_ENABLE=y"; \
echo "CONFIG_ESP_SCRATCH_OFFSET=$(CONFIG_ESP32_OTA_SCRATCH_OFFSET)"; \
echo "CONFIG_ESP_SCRATCH_SIZE=$(CONFIG_ESP32_OTA_SCRATCH_SIZE)"; \
} > $(BOOTLOADER_CONFIG)
} >> $(BOOTLOADER_CONFIG)
else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
$(Q) { \
echo "CONFIG_PARTITION_TABLE_CUSTOM=y"; \
echo "CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions.csv\""; \
} >> $(BOOTLOADER_CONFIG)
endif
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
$(Q) echo "Building Bootloader binaries"
@@ -58,27 +79,6 @@ clean_bootloader:
else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
BOOTLOADER_CONFIG = $(CHIPDIR)/sdkconfig
$(BOOTLOADER_CONFIG): $(TOPDIR)/.config
$(Q) echo "Creating Bootloader configuration"
$(Q) { \
[ "$(CONFIG_ESP32_FLASH_2M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y"; \
[ "$(CONFIG_ESP32_FLASH_4M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y"; \
[ "$(CONFIG_ESP32_FLASH_8M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y"; \
[ "$(CONFIG_ESP32_FLASH_16M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y"; \
[ "$(CONFIG_ESP32_FLASH_MODE_DIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DIO=y"; \
[ "$(CONFIG_ESP32_FLASH_MODE_DOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y"; \
[ "$(CONFIG_ESP32_FLASH_MODE_QIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QIO=y"; \
[ "$(CONFIG_ESP32_FLASH_MODE_QOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y"; \
[ "$(CONFIG_ESP32_FLASH_FREQ_80M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_80M=y"; \
[ "$(CONFIG_ESP32_FLASH_FREQ_40M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_40M=y"; \
[ "$(CONFIG_ESP32_FLASH_FREQ_26M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_26M=y"; \
[ "$(CONFIG_ESP32_FLASH_FREQ_20M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_20M=y"; \
echo "CONFIG_PARTITION_TABLE_CUSTOM=y"; \
echo "CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions.csv\""; \
} > $(BOOTLOADER_CONFIG)
bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
$(Q) echo "Building Bootloader binaries"
$(Q) $(BOOTLOADER_SRCDIR)/build_idfboot.sh -c esp32 -s -f $(BOOTLOADER_CONFIG)

View File

@@ -48,7 +48,7 @@
*
****************************************************************************/
static int esp32_fromcpu_interrupt(int fromcpu)
static int IRAM_ATTR esp32_fromcpu_interrupt(int fromcpu)
{
uintptr_t regaddr;
@@ -80,12 +80,12 @@ static int esp32_fromcpu_interrupt(int fromcpu)
*
****************************************************************************/
int esp32_fromcpu0_interrupt(int irq, void *context, void *arg)
int IRAM_ATTR esp32_fromcpu0_interrupt(int irq, void *context, void *arg)
{
return esp32_fromcpu_interrupt(0);
}
int esp32_fromcpu1_interrupt(int irq, void *context, void *arg)
int IRAM_ATTR esp32_fromcpu1_interrupt(int irq, void *context, void *arg)
{
return esp32_fromcpu_interrupt(1);
}
@@ -98,7 +98,7 @@ int esp32_fromcpu1_interrupt(int irq, void *context, void *arg)
*
****************************************************************************/
int xtensa_intercpu_interrupt(int tocpu, int intcode)
int IRAM_ATTR xtensa_intercpu_interrupt(int tocpu, int intcode)
{
int fromcpu;

View File

@@ -59,6 +59,12 @@
* Pre-processor Definitions
****************************************************************************/
/* Used in spiflash_cachestate_s structure even when SMP is disabled. */
#ifndef CONFIG_SMP_NCPUS
# define CONFIG_SMP_NCPUS 1
#endif
#define SPI_FLASH_WRITE_BUF_SIZE (32)
#define SPI_FLASH_READ_BUF_SIZE (64)
@@ -161,8 +167,11 @@ struct spiflash_map_req
struct spiflash_cachestate_s
{
int cpu;
#ifdef CONFIG_SMP
int other;
#endif
irqstate_t flags;
uint32_t val[2];
uint32_t val[CONFIG_SMP_NCPUS];
};
/****************************************************************************
@@ -405,25 +414,23 @@ static inline void spi_reset_regbits(struct esp32_spiflash_s *priv,
static inline void IRAM_ATTR
esp32_spiflash_opstart(struct spiflash_cachestate_s *state)
{
#ifdef CONFIG_SMP
int other;
#endif
state->flags = enter_critical_section();
state->cpu = up_cpu_index();
#ifdef CONFIG_SMP
other = state->cpu ? 0 : 1;
state->other = state->cpu ? 0 : 1;
#endif
DEBUGASSERT(state->cpu == 0 || state->cpu == 1);
#ifdef CONFIG_SMP
DEBUGASSERT(other == 0 || other == 1);
DEBUGASSERT(state->other == 0 || state->other == 1);
DEBUGASSERT(state->other != state->cpu);
up_cpu_pause(state->other);
#endif
spi_disable_cache(state->cpu, &state->val[state->cpu]);
#ifdef CONFIG_SMP
spi_disable_cache(other, &state->val[other]);
spi_disable_cache(state->other, &state->val[state->other]);
#endif
}
@@ -438,22 +445,16 @@ static inline void IRAM_ATTR
static inline void IRAM_ATTR
esp32_spiflash_opdone(const struct spiflash_cachestate_s *state)
{
#ifdef CONFIG_SMP
int other;
#endif
#ifdef CONFIG_SMP
other = state->cpu ? 0 : 1;
#endif
DEBUGASSERT(state->cpu == 0 || state->cpu == 1);
#ifdef CONFIG_SMP
DEBUGASSERT(other == 0 || other == 1);
DEBUGASSERT(state->other == 0 || state->other == 1);
DEBUGASSERT(state->other != state->cpu);
#endif
spi_enable_cache(state->cpu, state->val[state->cpu]);
#ifdef CONFIG_SMP
spi_enable_cache(other, state->val[other]);
spi_enable_cache(state->other, state->val[state->other]);
up_cpu_resume(state->other);
#endif
leave_critical_section(state->flags);

View File

@@ -26,16 +26,29 @@ BOOTLOADER_SRCDIR = $(CHIPDIR)/esp-nuttx-bootloader
BOOTLOADER_VERSION = main
BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader
BOOTLOADER_OUTDIR = out
BOOTLOADER_CONFIG = $(CHIPDIR)/bootloader.conf
$(BOOTLOADER_SRCDIR):
$(Q) git clone $(BOOTLOADER_URL) $(BOOTLOADER_SRCDIR) -b $(BOOTLOADER_VERSION)
ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
BOOTLOADER_CONFIG = $(CHIPDIR)/mcuboot.conf
$(BOOTLOADER_CONFIG): $(TOPDIR)/.config
$(Q) echo "Creating Bootloader configuration"
$(Q) { \
[ "$(CONFIG_ESP32S2_FLASH_2M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y"; \
[ "$(CONFIG_ESP32S2_FLASH_4M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y"; \
[ "$(CONFIG_ESP32S2_FLASH_8M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y"; \
[ "$(CONFIG_ESP32S2_FLASH_16M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y"; \
[ "$(CONFIG_ESP32S2_FLASH_MODE_DIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DIO=y"; \
[ "$(CONFIG_ESP32S2_FLASH_MODE_DOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y"; \
[ "$(CONFIG_ESP32S2_FLASH_MODE_QIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QIO=y"; \
[ "$(CONFIG_ESP32S2_FLASH_MODE_QOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y"; \
[ "$(CONFIG_ESP32S2_FLASH_FREQ_80M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_80M=y"; \
[ "$(CONFIG_ESP32S2_FLASH_FREQ_40M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_40M=y"; \
[ "$(CONFIG_ESP32S2_FLASH_FREQ_26M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_26M=y"; \
[ "$(CONFIG_ESP32S2_FLASH_FREQ_20M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_20M=y"; \
true; \
} > $(BOOTLOADER_CONFIG)
ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
$(Q) { \
echo "CONFIG_ESP_BOOTLOADER_SIZE=0xF000"; \
echo "CONFIG_ESP_APPLICATION_PRIMARY_START_ADDRESS=$(CONFIG_ESP32S2_OTA_PRIMARY_SLOT_OFFSET)"; \
@@ -44,7 +57,15 @@ $(BOOTLOADER_CONFIG): $(TOPDIR)/.config
echo "CONFIG_ESP_MCUBOOT_WDT_ENABLE=y"; \
echo "CONFIG_ESP_SCRATCH_OFFSET=$(CONFIG_ESP32S2_OTA_SCRATCH_OFFSET)"; \
echo "CONFIG_ESP_SCRATCH_SIZE=$(CONFIG_ESP32S2_OTA_SCRATCH_SIZE)"; \
} > $(BOOTLOADER_CONFIG)
} >> $(BOOTLOADER_CONFIG)
else ifeq ($(CONFIG_ESP32S2_APP_FORMAT_LEGACY),y)
$(Q) { \
echo "CONFIG_PARTITION_TABLE_CUSTOM=y"; \
echo "CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions.csv\""; \
} >> $(BOOTLOADER_CONFIG)
endif
ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
$(Q) echo "Building Bootloader binaries"
@@ -58,27 +79,6 @@ clean_bootloader:
else ifeq ($(CONFIG_ESP32S2_APP_FORMAT_LEGACY),y)
BOOTLOADER_CONFIG = $(CHIPDIR)/sdkconfig
$(BOOTLOADER_CONFIG): $(TOPDIR)/.config
$(Q) echo "Creating Bootloader configuration"
$(Q) { \
[ "$(CONFIG_ESP32S2_FLASH_2M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y"; \
[ "$(CONFIG_ESP32S2_FLASH_4M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y"; \
[ "$(CONFIG_ESP32S2_FLASH_8M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y"; \
[ "$(CONFIG_ESP32S2_FLASH_16M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y"; \
[ "$(CONFIG_ESP32S2_FLASH_MODE_DIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DIO=y"; \
[ "$(CONFIG_ESP32S2_FLASH_MODE_DOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y"; \
[ "$(CONFIG_ESP32S2_FLASH_MODE_QIO)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QIO=y"; \
[ "$(CONFIG_ESP32S2_FLASH_MODE_QOUT)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y"; \
[ "$(CONFIG_ESP32S2_FLASH_FREQ_80M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_80M=y"; \
[ "$(CONFIG_ESP32S2_FLASH_FREQ_40M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_40M=y"; \
[ "$(CONFIG_ESP32S2_FLASH_FREQ_26M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_26M=y"; \
[ "$(CONFIG_ESP32S2_FLASH_FREQ_20M)" = "y" ] && echo "CONFIG_ESPTOOLPY_FLASHFREQ_20M=y"; \
echo "CONFIG_PARTITION_TABLE_CUSTOM=y"; \
echo "CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions.csv\""; \
} > $(BOOTLOADER_CONFIG)
bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
$(Q) echo "Building Bootloader binaries"
$(Q) $(BOOTLOADER_SRCDIR)/build_idfboot.sh -c esp32s2 -s -f $(BOOTLOADER_CONFIG)

View File

@@ -72,6 +72,18 @@ SECTIONS
*(.iram1 .iram1.*)
*librtc.a:(.literal .text .literal.* .text.*)
*libarch.a:esp32_spiflash.*(.literal .text .literal.* .text.*)
*libarch.a:xtensa_cpupause.*(.literal .text .literal.* .text.*)
*libarch.a:xtensa_copystate.*(.literal .text .literal.* .text.*)
*libarch.a:xtensa_interruptcontext.*(.literal .text .literal.* .text.*)
*libarch.a:xtensa_testset.*(.literal .text .literal.* .text.*)
*libsched.a:sched_suspendscheduler.*(.literal .text .literal.* .text.*)
*libsched.a:sched_note.*(.literal .text .literal.* .text.*)
*libsched.a:sched_thistask.*(.literal .text .literal.* .text.*)
*libsched.a:spinlock.*(.literal .text .literal.* .text.*)
*libsched.a:irq_csection.*(.literal .text .literal.* .text.*)
*libsched.a:irq_dispatch.*(.literal .text .literal.* .text.*)
*(.wifirxiram .wifirxiram.*)
*(.wifi0iram .wifi0iram.*)
*(.wifislpiram .wifislpiram.*)
@@ -119,6 +131,18 @@ SECTIONS
*(.gnu.linkonce.b.*)
*(COMMON)
*libarch.a:esp32_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)
*libarch.a:xtensa_testset.*(.bss .bss.* COMMON)
*libsched.a:sched_suspendscheduler.*(.bss .bss.* COMMON)
*libsched.a:sched_thistask.*(.bss .bss.* COMMON)
*libsched.a:sched_note.*(.bss .bss.* COMMON)
*libsched.a:spinlock.*(.bss .bss.* COMMON)
*libsched.a:irq_csection.*(.bss .bss.* COMMON)
*libsched.a:irq_dispatch.*(.bss .bss.* COMMON)
. = ALIGN(8);
_bss_end = ABSOLUTE(.);
_ebss = ABSOLUTE(.);
@@ -160,6 +184,18 @@ SECTIONS
*(.dram1 .dram1.*)
*libphy.a:(.rodata .rodata.*)
*libarch.a:esp32_spiflash.*(.rodata .rodata.*)
*libarch.a:xtensa_cpupause.*(.rodata .rodata.*)
*libarch.a:xtensa_copystate.*(.rodata .rodata.*)
*libarch.a:xtensa_interruptcontext.*(.rodata .rodata.*)
*libarch.a:xtensa_testset.*(.rodata .rodata.*)
*libsched.a:sched_suspendscheduler.*(.rodata .rodata.*)
*libsched.a:sched_thistask.*(.rodata .rodata.*)
*libsched.a:sched_note.*(.rodata .rodata.*)
*libsched.a:spinlock.*(.rodata .rodata.*)
*libsched.a:irq_csection.*(.rodata .rodata.*)
*libsched.a:irq_dispatch.*(.rodata .rodata.*)
. = ALIGN(4);
_edata = ABSOLUTE(.);

View File

@@ -64,6 +64,8 @@ static void mq_inode_release(FAR struct inode *inode)
nxmq_free_msgq(msgq);
inode->i_private = NULL;
}
inode_release(inode);
}
}