Skip to content

Commit 9a84192

Browse files
committed
Merge pull request #7 from esp8266/esp8266
pull master
2 parents ad5b303 + cabb450 commit 9a84192

28 files changed

+895
-290
lines changed

hardware/esp8266com/esp8266/cores/esp8266/cont_util.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@
2525

2626
#define CONT_STACKGUARD 0xfeefeffe
2727

28-
void cont_init(cont_t* cont) {
28+
void ICACHE_RAM_ATTR cont_init(cont_t* cont) {
2929
cont->stack_guard1 = CONT_STACKGUARD;
3030
cont->stack_guard2 = CONT_STACKGUARD;
3131
cont->stack_end = cont->stack + (sizeof(cont->stack) / 4);
3232
cont->struct_start = (unsigned*) cont;
3333
}
3434

35-
int cont_check(cont_t* cont) {
35+
int ICACHE_RAM_ATTR cont_check(cont_t* cont) {
3636
if(cont->stack_guard1 != CONT_STACKGUARD || cont->stack_guard2 != CONT_STACKGUARD) return 1;
3737

3838
return 0;
3939
}
4040

41-
bool cont_can_yield(cont_t* cont) {
41+
bool ICACHE_RAM_ATTR cont_can_yield(cont_t* cont) {
4242
return !ETS_INTR_WITHINISR() &&
4343
cont->pc_ret != 0 && cont->pc_yield == 0;
4444
}

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_main.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,12 @@ static void do_global_ctors(void) {
129129
(*p)();
130130
}
131131

132+
extern "C" void __gdb_init() {}
133+
extern "C" void gdb_init(void) __attribute__ ((weak, alias("__gdb_init")));
134+
132135
void init_done() {
133136
system_set_os_print(1);
137+
gdb_init();
134138
do_global_ctors();
135139
esp_schedule();
136140
}

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_postmortem.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern void __real_system_restart_local();
3131
extern cont_t g_cont;
3232

3333

34-
static void uart_write_char_d(char c);
34+
void uart_write_char_d(char c);
3535
static void uart0_write_char_d(char c);
3636
static void uart1_write_char_d(char c);
3737
static void print_stack(uint32_t start, uint32_t end);
@@ -133,16 +133,16 @@ void uart_write_char_d(char c) {
133133
uart1_write_char_d(c);
134134
}
135135

136-
void uart0_write_char_d(char c) {
137-
while (((USS(0) >> USTXC) & 0xff) >= 0x7e) { }
136+
static void uart0_write_char_d(char c) {
137+
while (((USS(0) >> USTXC) & 0xff)) { }
138138

139139
if (c == '\n') {
140140
USF(0) = '\r';
141141
}
142142
USF(0) = c;
143143
}
144144

145-
void uart1_write_char_d(char c) {
145+
static void uart1_write_char_d(char c) {
146146
while (((USS(1) >> USTXC) & 0xff) >= 0x7e) { }
147147

148148
if (c == '\n') {

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_timer.c

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*
1+
/*
22
timer.c - Timer1 library for esp8266
33
44
Copyright (c) 2015 Hristo Gochkov. All rights reserved.
55
This file is part of the esp8266 core for Arduino environment.
6-
6+
77
This library is free software; you can redistribute it and/or
88
modify it under the terms of the GNU Lesser General Public
99
License as published by the Free Software Foundation; either
@@ -29,13 +29,13 @@
2929

3030
static volatile timercallback timer1_user_cb = NULL;
3131

32-
void timer1_isr_handler(void *para){
32+
void ICACHE_RAM_ATTR timer1_isr_handler(void *para){
3333
if ((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
3434
T1I = 0;
3535
if (timer1_user_cb) {
3636
// to make ISR compatible to Arduino AVR model where interrupts are disabled
3737
// we disable them before we call the client ISR
38-
uint32_t savedPS = xt_rsil(15); // stop other interrupts
38+
uint32_t savedPS = xt_rsil(15); // stop other interrupts
3939
timer1_user_cb();
4040
xt_wsr_ps(savedPS);
4141
}
@@ -61,7 +61,7 @@ void timer1_enable(uint8_t divider, uint8_t int_type, uint8_t reload){
6161
T1I = 0;
6262
}
6363

64-
void timer1_write(uint32_t ticks){
64+
void ICACHE_RAM_ATTR timer1_write(uint32_t ticks){
6565
T1L = ((ticks)& 0x7FFFFF);
6666
if ((T1C & (1 << TCIT)) == 0) TEIE |= TEIE1;//edge int enable
6767
}
@@ -76,7 +76,7 @@ void timer1_disable(){
7676

7777
static volatile timercallback timer0_user_cb = NULL;
7878

79-
void timer0_isr_handler(void* para){
79+
void ICACHE_RAM_ATTR timer0_isr_handler(void* para){
8080
if (timer0_user_cb) {
8181
// to make ISR compatible to Arduino AVR model where interrupts are disabled
8282
// we disable them before we call the client ISR
@@ -99,6 +99,3 @@ void timer0_detachInterrupt() {
9999
timer0_user_cb = NULL;
100100
ETS_CCOMPARE0_DISABLE();
101101
}
102-
103-
104-

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_pwm.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*
1+
/*
22
pwm.c - analogWrite implementation for esp8266
33
44
Copyright (c) 2015 Hristo Gochkov. All rights reserved.
55
This file is part of the esp8266 core for Arduino environment.
6-
6+
77
This library is free software; you can redistribute it and/or
88
modify it under the terms of the GNU Lesser General Public
99
License as published by the Free Software Foundation; either
@@ -88,7 +88,7 @@ void prep_pwm_steps(){
8888
ETS_FRC1_INTR_ENABLE();
8989
}
9090

91-
void pwm_timer_isr(){
91+
void ICACHE_RAM_ATTR pwm_timer_isr(){
9292
static uint8_t current_step = 0;
9393
static uint8_t stepcount = 0;
9494
static uint16_t steps[17];

0 commit comments

Comments
 (0)