Skip to content

Commit

Permalink
ESP_PORTC_32BIT_ATTR attribute in port.c to move 32/64 bit variable i…
Browse files Browse the repository at this point in the history
…n IRAM
  • Loading branch information
dsptech committed Mar 31, 2021
1 parent dfb3095 commit e6bf40d
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions components/freertos/port/esp8266/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,36 @@
#include "esp8266/rom_functions.h"
#include "driver/soc.h"

/* help to keep free precious 8bit dram */
#ifndef ESP_PORTC_32BIT_ATTR
#define ESP_PORTC_32BIT_ATTR
#endif

#define SET_STKREG(r,v) sp[(r) >> 2] = (uint32_t)(v)
#define PORT_ASSERT(x) do { if (!(x)) {ets_printf("%s %u\n", "rtos_port", __LINE__); while(1){}; }} while (0)

extern uint8_t NMIIrqIsOn;

uint32_t cpu_sr;

uint32_t _xt_tick_divisor;
uint32_t _xt_tick_divisor ESP_PORTC_32BIT_ATTR;

/* Each task maintains its own interrupt status in the critical nesting
variable. */
static uint32_t uxCriticalNesting = 0;
static uint32_t uxCriticalNesting ESP_PORTC_32BIT_ATTR = 0;

uint32_t g_esp_boot_ccount;
uint64_t g_esp_os_us;
uint32_t g_esp_boot_ccount ESP_PORTC_32BIT_ATTR;
uint64_t g_esp_os_us ESP_PORTC_32BIT_ATTR;

#ifdef ESP_ENABLE_ESP_OS_TICKS
/* apparently unused for at least a year. remove to free resources and increase performance */
uint64_t g_esp_os_ticks;
uint64_t g_esp_os_ticks ESP_PORTC_32BIT_ATTR;
#endif

#ifndef CONFIG_FREERTOS_RUN_TIME_STATS_USING_CPU_CLK
uint64_t g_esp_os_cpu_clk;
uint64_t g_esp_os_cpu_clk ESP_PORTC_32BIT_ATTR;
#endif
static uint32_t s_switch_ctx_flag;
static uint32_t s_switch_ctx_flag ESP_PORTC_32BIT_ATTR;

void vPortEnterCritical(void);
void vPortExitCritical(void);
Expand Down Expand Up @@ -309,7 +314,7 @@ void show_critical_info(void)
}

#ifdef ESP_DPORT_CLOSE_NMI
static int s_nmi_is_closed;
static int s_nmi_is_closed ESP_PORTC_32BIT_ATTR;

void esp_dport_close_nmi(void)
{
Expand Down Expand Up @@ -376,7 +381,7 @@ bool interrupt_is_disable(void)
return tmp & 0xFUL ? true : false;
}

static _xt_isr_entry s_isr[16];
static _xt_isr_entry s_isr[16] ESP_PORTC_32BIT_ATTR;
static uint8_t s_xt_isr_status = 0;

void _xt_isr_attach(uint8_t i, _xt_isr func, void* arg)
Expand Down

0 comments on commit e6bf40d

Please sign in to comment.