From 075446318df651216be42966e721c30d822b48e2 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 17 Jan 2017 00:42:55 +0800 Subject: [PATCH] spi_flash: define spi_flash_guard_{start,stop} with IRAM_ATTR These functions are marked as inline and are called from functions which are in IRAM. In release (-Os) builds, the compiler may decide not to inline these functions. Placing these functions into IRAM explicitly works around this. --- components/spi_flash/flash_ops.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/spi_flash/flash_ops.c b/components/spi_flash/flash_ops.c index fffe487bd1..a74558a96f 100644 --- a/components/spi_flash/flash_ops.c +++ b/components/spi_flash/flash_ops.c @@ -103,16 +103,18 @@ SpiFlashOpResult IRAM_ATTR spi_flash_unlock() return SPI_FLASH_RESULT_OK; } -static inline void spi_flash_guard_start() +static inline void IRAM_ATTR spi_flash_guard_start() { - if (s_flash_guard_ops) + if (s_flash_guard_ops) { s_flash_guard_ops->start(); + } } -static inline void spi_flash_guard_end() +static inline void IRAM_ATTR spi_flash_guard_end() { - if (s_flash_guard_ops) + if (s_flash_guard_ops) { s_flash_guard_ops->end(); + } } esp_err_t IRAM_ATTR spi_flash_erase_sector(size_t sec)