Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit656a33e

Browse files
BREAKING - Use IRAM_ATTR in place of ICACHE_RAM_ATTR (esp8266#7921)
Update the core to use the define that the ESP32 uses, IRAM_ATTR, forplacing code in DRAM.
1 parent6743a65 commit656a33e

26 files changed

+126
-126
lines changed

‎cores/esp8266/FunctionalInterrupt.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ typedef void (*voidFuncPtrArg)(void*);
1010
extern"C"void__attachInterruptFunctionalArg(uint8_t pin, voidFuncPtr userFunc,void*fp,int mode,bool functional);
1111

1212

13-
voidICACHE_RAM_ATTRinterruptFunctional(void* arg)
13+
voidIRAM_ATTRinterruptFunctional(void* arg)
1414
{
1515
ArgStructure* localArg = (ArgStructure*)arg;
1616
if (localArg->functionInfo->reqScheduledFunction)

‎cores/esp8266/cbuf.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ size_t cbuf::resize(size_t newSize) {
6767
return _size;
6868
}
6969

70-
size_tICACHE_RAM_ATTRcbuf::available()const {
70+
size_tIRAM_ATTRcbuf::available()const {
7171
if(_end >= _begin) {
7272
return _end - _begin;
7373
}
@@ -108,7 +108,7 @@ size_t cbuf::peek(char *dst, size_t size) {
108108
return size_read;
109109
}
110110

111-
intICACHE_RAM_ATTRcbuf::read() {
111+
intIRAM_ATTRcbuf::read() {
112112
if(empty())
113113
return -1;
114114

@@ -133,7 +133,7 @@ size_t cbuf::read(char* dst, size_t size) {
133133
return size_read;
134134
}
135135

136-
size_tICACHE_RAM_ATTRcbuf::write(char c) {
136+
size_tIRAM_ATTRcbuf::write(char c) {
137137
if(full())
138138
return0;
139139

‎cores/esp8266/cont_util.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void cont_init(cont_t* cont) {
4242
}
4343
}
4444

45-
intICACHE_RAM_ATTRcont_check(cont_t* cont) {
45+
intIRAM_ATTRcont_check(cont_t* cont) {
4646
if(cont->stack_guard1 != CONT_STACKGUARD || cont->stack_guard2 != CONT_STACKGUARD)return1;
4747

4848
return0;
@@ -62,7 +62,7 @@ int cont_get_free_stack(cont_t* cont) {
6262
return freeWords *4;
6363
}
6464

65-
boolICACHE_RAM_ATTRcont_can_yield(cont_t* cont) {
65+
boolIRAM_ATTRcont_can_yield(cont_t* cont) {
6666
return !ETS_INTR_WITHINISR() &&
6767
cont->pc_ret !=0 && cont->pc_yield ==0;
6868
}

‎cores/esp8266/core_esp8266_i2s.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ typedef struct i2s_state {
6161
uint32_t * curr_slc_buf;// Current buffer for writing
6262
uint32_t curr_slc_buf_pos;// Position in the current buffer
6363
void (*callback) (void);
64-
// Callback function should be defined as 'voidICACHE_RAM_ATTR function_name()',
64+
// Callback function should be defined as 'voidIRAM_ATTR function_name()',
6565
// and be placed in IRAM for faster execution. Avoid long computational tasks in this
6666
// function, use it to set flags and process later.
6767
bool driveClocks;
@@ -139,7 +139,7 @@ uint16_t i2s_rx_available(){
139139
}
140140

141141
// Pop the top off of the queue and return it
142-
staticuint32_t *ICACHE_RAM_ATTRi2s_slc_queue_next_item(i2s_state_t *ch) {
142+
staticuint32_t *IRAM_ATTRi2s_slc_queue_next_item(i2s_state_t *ch) {
143143
uint8_t i;
144144
uint32_t *item = ch->slc_queue[0];
145145
ch->slc_queue_len--;
@@ -150,7 +150,7 @@ static uint32_t * ICACHE_RAM_ATTR i2s_slc_queue_next_item(i2s_state_t *ch) {
150150
}
151151

152152
// Append an item to the end of the queue from receive
153-
staticvoidICACHE_RAM_ATTRi2s_slc_queue_append_item(i2s_state_t *ch,uint32_t *item) {
153+
staticvoidIRAM_ATTRi2s_slc_queue_append_item(i2s_state_t *ch,uint32_t *item) {
154154
// Shift everything up, except for the one corresponding to this item
155155
for (int i=0, dest=0; i < ch->slc_queue_len; i++) {
156156
if (ch->slc_queue[i] != item) {
@@ -164,7 +164,7 @@ static void ICACHE_RAM_ATTR i2s_slc_queue_append_item(i2s_state_t *ch, uint32_t
164164
}
165165
}
166166

167-
staticvoidICACHE_RAM_ATTRi2s_slc_isr(void) {
167+
staticvoidIRAM_ATTRi2s_slc_isr(void) {
168168
ETS_SLC_INTR_DISABLE();
169169
uint32_t slc_intr_status = SLCIS;
170170
SLCIC =0xFFFFFFFF;

‎cores/esp8266/core_esp8266_phy.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,10 @@ static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
300300
staticbool spoof_init_data =false;
301301

302302
externint__real_spi_flash_read(uint32_t addr,uint32_t* dst,size_t size);
303-
externintICACHE_RAM_ATTR__wrap_spi_flash_read(uint32_t addr,uint32_t* dst,size_t size);
303+
externintIRAM_ATTR__wrap_spi_flash_read(uint32_t addr,uint32_t* dst,size_t size);
304304
externint__get_adc_mode();
305305

306-
externintICACHE_RAM_ATTR__wrap_spi_flash_read(uint32_t addr,uint32_t* dst,size_t size)
306+
externintIRAM_ATTR__wrap_spi_flash_read(uint32_t addr,uint32_t* dst,size_t size)
307307
{
308308
if (!spoof_init_data || size !=128) {
309309
return__real_spi_flash_read(addr, dst, size);
@@ -354,6 +354,6 @@ void user_rf_pre_init()
354354
}
355355

356356

357-
voidICACHE_RAM_ATTRuser_spi_flash_dio_to_qio_pre_init() {}
357+
voidIRAM_ATTRuser_spi_flash_dio_to_qio_pre_init() {}
358358

359359
};

‎cores/esp8266/core_esp8266_si2c.cpp‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,23 +103,23 @@ class Twi
103103
ETSTimer timer;
104104

105105
// Event/IRQ callbacks, so they can't use "this" and need to be static
106-
staticvoidICACHE_RAM_ATTRonSclChange(void);
107-
staticvoidICACHE_RAM_ATTRonSdaChange(void);
106+
staticvoidIRAM_ATTRonSclChange(void);
107+
staticvoidIRAM_ATTRonSdaChange(void);
108108
staticvoideventTask(ETSEvent *e);
109-
staticvoidICACHE_RAM_ATTRonTimer(void *unused);
109+
staticvoidIRAM_ATTRonTimer(void *unused);
110110

111111
// Allow not linking in the slave code if there is no call to setAddress
112112
bool _slaveEnabled =false;
113113

114114
// Internal use functions
115-
voidICACHE_RAM_ATTRbusywait(unsignedint v);
115+
voidIRAM_ATTRbusywait(unsignedint v);
116116
boolwrite_start(void);
117117
boolwrite_stop(void);
118118
boolwrite_bit(bool bit);
119119
boolread_bit(void);
120120
boolwrite_byte(unsignedchar byte);
121121
unsignedcharread_byte(bool nack);
122-
voidICACHE_RAM_ATTRonTwipEvent(uint8_t status);
122+
voidIRAM_ATTRonTwipEvent(uint8_t status);
123123

124124
// Handle the case where a slave needs to stretch the clock with a time-limited busy wait
125125
inlinevoidWAIT_CLOCK_STRETCH()
@@ -149,8 +149,8 @@ class Twi
149149
uint8_ttransmit(constuint8_t* data,uint8_t length);
150150
voidattachSlaveRxEvent(void (*function)(uint8_t*,size_t));
151151
voidattachSlaveTxEvent(void (*function)(void));
152-
voidICACHE_RAM_ATTRreply(uint8_t ack);
153-
voidICACHE_RAM_ATTRreleaseBus(void);
152+
voidIRAM_ATTRreply(uint8_t ack);
153+
voidIRAM_ATTRreleaseBus(void);
154154
voidenableSlave();
155155
};
156156

@@ -229,7 +229,7 @@ void Twi::enableSlave()
229229
}
230230
}
231231

232-
voidICACHE_RAM_ATTRTwi::busywait(unsignedint v)
232+
voidIRAM_ATTRTwi::busywait(unsignedint v)
233233
{
234234
unsignedint i;
235235
for (i =0; i < v; i++)// loop time is 5 machine cycles: 31.25ns @ 160MHz, 62.5ns @ 80MHz
@@ -472,9 +472,9 @@ void Twi::attachSlaveTxEvent(void (*function)(void))
472472
}
473473

474474
// DO NOT INLINE, inlining reply() in combination with compiler optimizations causes function breakup into
475-
// parts and theICACHE_RAM_ATTR isn't propagated correctly to all parts, which of course causes crashes.
475+
// parts and theIRAM_ATTR isn't propagated correctly to all parts, which of course causes crashes.
476476
// TODO: test with gcc 9.x and if it still fails, disable optimization with -fdisable-ipa-fnsplit
477-
voidICACHE_RAM_ATTRTwi::reply(uint8_t ack)
477+
voidIRAM_ATTRTwi::reply(uint8_t ack)
478478
{
479479
// transmit master read ready signal, with or without ack
480480
if (ack)
@@ -492,7 +492,7 @@ void ICACHE_RAM_ATTR Twi::reply(uint8_t ack)
492492
}
493493

494494

495-
voidICACHE_RAM_ATTRTwi::releaseBus(void)
495+
voidIRAM_ATTRTwi::releaseBus(void)
496496
{
497497
// release bus
498498
//TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT);
@@ -505,7 +505,7 @@ void ICACHE_RAM_ATTR Twi::releaseBus(void)
505505
}
506506

507507

508-
voidICACHE_RAM_ATTRTwi::onTwipEvent(uint8_t status)
508+
voidIRAM_ATTRTwi::onTwipEvent(uint8_t status)
509509
{
510510
twip_status = status;
511511
switch (status)
@@ -612,7 +612,7 @@ void ICACHE_RAM_ATTR Twi::onTwipEvent(uint8_t status)
612612
}
613613
}
614614

615-
voidICACHE_RAM_ATTRTwi::onTimer(void *unused)
615+
voidIRAM_ATTRTwi::onTimer(void *unused)
616616
{
617617
(void)unused;
618618
twi.releaseBus();
@@ -662,7 +662,7 @@ void Twi::eventTask(ETSEvent *e)
662662
// Shorthand for if the state is any of the or'd bitmask x
663663
#defineIFSTATE(x)if (twip_state_mask & (x))
664664

665-
voidICACHE_RAM_ATTRTwi::onSclChange(void)
665+
voidIRAM_ATTRTwi::onSclChange(void)
666666
{
667667
unsignedint sda;
668668
unsignedint scl;
@@ -860,7 +860,7 @@ void ICACHE_RAM_ATTR Twi::onSclChange(void)
860860
}
861861
}
862862

863-
voidICACHE_RAM_ATTRTwi::onSdaChange(void)
863+
voidIRAM_ATTRTwi::onSdaChange(void)
864864
{
865865
unsignedint sda;
866866
unsignedint scl;

‎cores/esp8266/core_esp8266_timer.cpp‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern "C" {
3131

3232
staticvolatile timercallback timer1_user_cb =NULL;
3333

34-
voidICACHE_RAM_ATTRtimer1_isr_handler(void *para,void *frame) {
34+
voidIRAM_ATTRtimer1_isr_handler(void *para,void *frame) {
3535
(void) para;
3636
(void) frame;
3737
if ((T1C & ((1 << TCAR) | (1 << TCIT))) ==0) TEIE &= ~TEIE1;//edge int disable
@@ -45,32 +45,32 @@ void ICACHE_RAM_ATTR timer1_isr_handler(void *para, void *frame) {
4545
}
4646
}
4747

48-
voidICACHE_RAM_ATTRtimer1_isr_init(){
48+
voidIRAM_ATTRtimer1_isr_init(){
4949
ETS_FRC_TIMER1_INTR_ATTACH(timer1_isr_handler,NULL);
5050
}
5151

52-
voidICACHE_RAM_ATTRtimer1_attachInterrupt(timercallback userFunc) {
52+
voidIRAM_ATTRtimer1_attachInterrupt(timercallback userFunc) {
5353
timer1_user_cb = userFunc;
5454
ETS_FRC1_INTR_ENABLE();
5555
}
5656

57-
voidICACHE_RAM_ATTRtimer1_detachInterrupt() {
57+
voidIRAM_ATTRtimer1_detachInterrupt() {
5858
timer1_user_cb =0;
5959
TEIE &= ~TEIE1;//edge int disable
6060
ETS_FRC1_INTR_DISABLE();
6161
}
6262

63-
voidICACHE_RAM_ATTRtimer1_enable(uint8_t divider,uint8_t int_type,uint8_t reload){
63+
voidIRAM_ATTRtimer1_enable(uint8_t divider,uint8_t int_type,uint8_t reload){
6464
T1C = (1 << TCTE) | ((divider &3) << TCPD) | ((int_type &1) << TCIT) | ((reload &1) << TCAR);
6565
T1I =0;
6666
}
6767

68-
voidICACHE_RAM_ATTRtimer1_write(uint32_t ticks){
68+
voidIRAM_ATTRtimer1_write(uint32_t ticks){
6969
T1L = ((ticks)&0x7FFFFF);
7070
if ((T1C & (1 << TCIT)) ==0) TEIE |= TEIE1;//edge int enable
7171
}
7272

73-
voidICACHE_RAM_ATTRtimer1_disable(){
73+
voidIRAM_ATTRtimer1_disable(){
7474
T1C =0;
7575
T1I =0;
7676
}
@@ -80,7 +80,7 @@ void ICACHE_RAM_ATTR timer1_disable(){
8080

8181
staticvolatile timercallback timer0_user_cb =NULL;
8282

83-
voidICACHE_RAM_ATTRtimer0_isr_handler(void *para,void *frame) {
83+
voidIRAM_ATTRtimer0_isr_handler(void *para,void *frame) {
8484
(void) para;
8585
(void) frame;
8686
if (timer0_user_cb) {
@@ -92,16 +92,16 @@ void ICACHE_RAM_ATTR timer0_isr_handler(void *para, void *frame) {
9292
}
9393
}
9494

95-
voidICACHE_RAM_ATTRtimer0_isr_init(){
95+
voidIRAM_ATTRtimer0_isr_init(){
9696
ETS_CCOMPARE0_INTR_ATTACH(timer0_isr_handler,NULL);
9797
}
9898

99-
voidICACHE_RAM_ATTRtimer0_attachInterrupt(timercallback userFunc) {
99+
voidIRAM_ATTRtimer0_attachInterrupt(timercallback userFunc) {
100100
timer0_user_cb = userFunc;
101101
ETS_CCOMPARE0_ENABLE();
102102
}
103103

104-
voidICACHE_RAM_ATTRtimer0_detachInterrupt() {
104+
voidIRAM_ATTRtimer0_detachInterrupt() {
105105
timer0_user_cb =NULL;
106106
ETS_CCOMPARE0_DISABLE();
107107
}

‎cores/esp8266/core_esp8266_waveform.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ int stopWaveform(uint8_t pin);
112112
// to determine whether or not to perform an operation.
113113
// Pass in NULL to disable the callback and, if no other waveforms being
114114
// generated, stop the timer as well.
115-
// Make sure the CB function has theICACHE_RAM_ATTR decorator.
115+
// Make sure the CB function has theIRAM_ATTR decorator.
116116
voidsetTimer1Callback(uint32_t (*fn)());
117117

118118

‎cores/esp8266/core_esp8266_waveform_phase.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ namespace {
111111
}
112112

113113
// Interrupt on/off control
114-
staticICACHE_RAM_ATTRvoidtimer1Interrupt();
114+
staticIRAM_ATTRvoidtimer1Interrupt();
115115

116116
// Non-speed critical bits
117117
#pragma GCC optimize ("Os")
@@ -125,7 +125,7 @@ static void initTimer() {
125125
timer1_write(IRQLATENCYCCYS);// Cause an interrupt post-haste
126126
}
127127

128-
staticvoidICACHE_RAM_ATTRdeinitTimer() {
128+
staticvoidIRAM_ATTRdeinitTimer() {
129129
ETS_FRC_TIMER1_NMI_INTR_ATTACH(NULL);
130130
timer1_disable();
131131
timer1_isr_init();
@@ -218,7 +218,7 @@ int startWaveformClockCycles_weak(uint8_t pin, uint32_t highCcys, uint32_t lowCc
218218
}
219219

220220
// Stops a waveform on a pin
221-
ICACHE_RAM_ATTRintstopWaveform_weak(uint8_t pin) {
221+
IRAM_ATTRintstopWaveform_weak(uint8_t pin) {
222222
// Can't possibly need to stop anything if there is no timer active
223223
if (!waveform.timer1Running) {
224224
returnfalse;
@@ -252,7 +252,7 @@ ICACHE_RAM_ATTR int stopWaveform_weak(uint8_t pin) {
252252

253253
// For dynamic CPU clock frequency switch in loop the scaling logic would have to be adapted.
254254
// Using constexpr makes sure that the CPU clock frequency is compile-time fixed.
255-
staticinlineICACHE_RAM_ATTRint32_tscaleCcys(constint32_t ccys,constbool isCPU2X) {
255+
staticinlineIRAM_ATTRint32_tscaleCcys(constint32_t ccys,constbool isCPU2X) {
256256
if (ISCPUFREQ160MHZ) {
257257
return isCPU2X ? ccys : (ccys >>1);
258258
}
@@ -261,7 +261,7 @@ static inline ICACHE_RAM_ATTR int32_t scaleCcys(const int32_t ccys, const bool i
261261
}
262262
}
263263

264-
staticICACHE_RAM_ATTRvoidtimer1Interrupt() {
264+
staticIRAM_ATTRvoidtimer1Interrupt() {
265265
constuint32_t isrStartCcy = ESP.getCycleCount();
266266
int32_t clockDrift = isrStartCcy - waveform.nextEventCcy;
267267
constbool isCPU2X = CPU2X &1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp