]> granicus.if.org Git - esp-idf/commitdiff
bootloader: move some functions out of IRAM when building in bootloader mode
authorIvan Grokhotkov <ivan@espressif.com>
Tue, 8 Nov 2016 03:25:40 +0000 (11:25 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Tue, 8 Nov 2016 12:17:08 +0000 (20:17 +0800)
Fixes https://github.com/espressif/esp-idf/issues/80

components/log/log.c
components/spi_flash/spi_flash_rom_patch.c

index a2b41d7e62feb6e37ac6539220ef90ed27afc9e7..9670b82dfdeee5447cab7c8b75d7b31b8da668c7 100644 (file)
@@ -284,7 +284,15 @@ static inline void heap_swap(int i, int j)
 }
 #endif //BOOTLOADER_BUILD
 
-IRAM_ATTR uint32_t esp_log_early_timestamp()
+
+#ifndef BOOTLOADER_BUILD
+#define ATTR IRAM_ATTR
+#else
+#define ATTR
+#endif // BOOTLOADER_BUILD
+
+
+uint32_t ATTR esp_log_early_timestamp()
 {
     return xthal_get_ccount() / (CPU_CLK_FREQ_ROM / 1000);
 }
@@ -305,9 +313,6 @@ uint32_t IRAM_ATTR esp_log_timestamp()
 
 #else
 
-uint32_t IRAM_ATTR esp_log_timestamp()
-{
-    return esp_log_early_timestamp();
-}
+uint32_t esp_log_timestamp() __attribute__((alias("esp_log_early_timestamp")));
 
 #endif //BOOTLOADER_BUILD
index 7e23beaea2198d522dc34abb1b2b9e44450bf98f..36e5bf823679d147a9c09e197a2d115858ee2c12 100644 (file)
@@ -19,9 +19,15 @@ static const uint32_t STATUS_QIE_BIT = (1 << 9); /* Quad Enable */
 #define SPI_IDX 1
 #define OTH_IDX 0
 
+#ifndef BOOTLOADER_BUILD
+#define ATTR IRAM_ATTR
+#else
+#define ATTR
+#endif // BOOTLOADER_BUILD
+
 extern SpiFlashChip SPI_flashchip_data;
 
-static void IRAM_ATTR Wait_SPI_Idle(void)
+static void ATTR Wait_SPI_Idle(void)
 {
   /* Wait for SPI state machine to be idle */
   while((REG_READ(SPI_EXT2_REG(SPI_IDX)) & SPI_ST)) {
@@ -42,7 +48,7 @@ static void IRAM_ATTR Wait_SPI_Idle(void)
    about interrupts, CPU coordination, flash mapping. However some of
    the functions in esp_spi_flash.c call it.
  */
-SpiFlashOpResult IRAM_ATTR SPIUnlock(void)
+SpiFlashOpResult ATTR SPIUnlock(void)
 {
   uint32_t status;