Skip to content

Commit f91b58c

Browse files
committed
Merge branch 'master' into DigestAuth
2 parents 36940cd + 2ffcb3e commit f91b58c

25 files changed

+568
-213
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and
2020

2121
Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).
2222

23-
- Install Arduino 1.8.2 from the [Arduino website](http://www.arduino.cc/en/main/software).
23+
- Install the current upstream Arduino IDE at the 1.8 level or later. The current version is at the [Arduino website](http://www.arduino.cc/en/main/software).
2424
- Start Arduino and open Preferences window.
2525
- Enter ```http://arduino.esp8266.com/stable/package_esp8266com_index.json``` into *Additional Board Manager URLs* field. You can add multiple URLs, separating them with commas.
2626
- Open Boards Manager from Tools > Board menu and install *esp8266* platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).

Diff for: boards.txt

+65
Original file line numberDiff line numberDiff line change
@@ -2021,3 +2021,68 @@ gen4iod.menu.UploadSpeed.512000.windows=512000
20212021
gen4iod.menu.UploadSpeed.512000.upload.speed=512000
20222022
gen4iod.menu.UploadSpeed.921600=921600
20232023
gen4iod.menu.UploadSpeed.921600.upload.speed=921600
2024+
2025+
##############################################################
2026+
oak.name=DigiStump Oak
2027+
2028+
oak.upload.tool=esptool
2029+
oak.upload.speed=115200
2030+
oak.upload.resetmethod=ck
2031+
oak.upload.maximum_size=1040368
2032+
oak.upload.maximum_data_size=81920
2033+
oak.upload.wait_for_upload_port=true
2034+
oak.serial.disableDTR=true
2035+
oak.serial.disableRTS=true
2036+
2037+
oak.build.mcu=esp8266
2038+
oak.build.f_cpu=80000000L
2039+
oak.build.board=ESP8266_OAK
2040+
oak.build.core=esp8266
2041+
oak.build.variant=oak
2042+
oak.build.flash_mode=dio
2043+
oak.build.flash_size=4M
2044+
oak.build.flash_freq=40
2045+
oak.build.debug_port=
2046+
oak.build.debug_level=
2047+
2048+
oak.menu.CpuFrequency.80=80 MHz
2049+
oak.menu.CpuFrequency.80.build.f_cpu=80000000L
2050+
oak.menu.CpuFrequency.160=160 MHz
2051+
oak.menu.CpuFrequency.160.build.f_cpu=160000000L
2052+
2053+
oak.menu.UploadSpeed.921600=921600
2054+
oak.menu.UploadSpeed.921600.upload.speed=921600
2055+
oak.menu.UploadSpeed.115200=115200
2056+
oak.menu.UploadSpeed.115200.upload.speed=115200
2057+
oak.menu.UploadSpeed.9600=9600
2058+
oak.menu.UploadSpeed.9600.upload.speed=9600
2059+
oak.menu.UploadSpeed.57600=57600
2060+
oak.menu.UploadSpeed.57600.upload.speed=57600
2061+
oak.menu.UploadSpeed.256000.windows=256000
2062+
oak.menu.UploadSpeed.256000.upload.speed=256000
2063+
oak.menu.UploadSpeed.230400.linux=230400
2064+
oak.menu.UploadSpeed.230400.macosx=230400
2065+
oak.menu.UploadSpeed.230400.macosx=230400
2066+
oak.menu.UploadSpeed.230400.upload.speed=230400
2067+
oak.menu.UploadSpeed.460800.linux=460800
2068+
oak.menu.UploadSpeed.460800.macosx=460800
2069+
oak.menu.UploadSpeed.460800.upload.speed=460800
2070+
oak.menu.UploadSpeed.512000.windows=512000
2071+
oak.menu.UploadSpeed.512000.upload.speed=512000
2072+
2073+
2074+
oak.menu.FlashSize.4M3M=4M (3M SPIFFS)
2075+
oak.menu.FlashSize.4M3M.build.flash_size=4M
2076+
oak.menu.FlashSize.4M3M.build.flash_ld=eagle.flash.4m.ld
2077+
oak.menu.FlashSize.4M3M.build.spiffs_start=0x100000
2078+
oak.menu.FlashSize.4M3M.build.spiffs_end=0x3FB000
2079+
oak.menu.FlashSize.4M3M.build.spiffs_blocksize=8192
2080+
oak.menu.FlashSize.4M3M.build.spiffs_pagesize=256
2081+
2082+
oak.menu.FlashSize.4M1M=4M (1M SPIFFS)
2083+
oak.menu.FlashSize.4M1M.build.flash_size=4M
2084+
oak.menu.FlashSize.4M1M.build.flash_ld=eagle.flash.4m1m.ld
2085+
oak.menu.FlashSize.4M1M.build.spiffs_start=0x300000
2086+
oak.menu.FlashSize.4M1M.build.spiffs_end=0x3FB000
2087+
oak.menu.FlashSize.4M1M.build.spiffs_blocksize=8192
2088+
oak.menu.FlashSize.4M1M.build.spiffs_pagesize=256

Diff for: cores/esp8266/FunctionalInterrupt.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <FunctionalInterrupt.h>
2+
3+
4+
// Duplicate typedefs from core_esp8266_wiring_digital_c
5+
typedef void (*voidFuncPtr)(void);
6+
7+
// Helper functions for Functional interrupt routines
8+
extern "C" void ICACHE_RAM_ATTR __attachInterruptArg(uint8_t pin, voidFuncPtr userFunc, void*fp , int mode);
9+
10+
// Structure for communication
11+
struct ArgStructure {
12+
std::function<void(void)> reqFunction;
13+
};
14+
15+
void interruptFunctional(void* arg)
16+
{
17+
((ArgStructure*)arg)->reqFunction();
18+
}
19+
20+
void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode)
21+
{
22+
// use the local interrupt routine which takes the ArgStructure as argument
23+
__attachInterruptArg (pin, (voidFuncPtr)interruptFunctional, new ArgStructure{intRoutine}, mode);
24+
}

Diff for: cores/esp8266/FunctionalInterrupt.h

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#ifndef FUNCTIONALINTERRUPT_H
2+
#define FUNCTIONALINTERRUPT_H
3+
4+
#include <stddef.h>
5+
#include <stdint.h>
6+
#include <functional>
7+
8+
extern "C" {
9+
#include "c_types.h"
10+
#include "ets_sys.h"
11+
}
12+
13+
void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode);
14+
15+
#endif //INTERRUPTS_H

Diff for: cores/esp8266/core_esp8266_postmortem.c

+21-7
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@
2727
#include "user_interface.h"
2828
#include "esp8266_peri.h"
2929
#include "cont.h"
30+
#include "pgmspace.h"
3031

3132
extern void __real_system_restart_local();
3233
extern void gdb_do_break();
3334

3435
extern cont_t g_cont;
3536

37+
// These will be pointers to PROGMEM const strings
3638
static const char* s_panic_file = 0;
3739
static int s_panic_line = 0;
3840
static const char* s_panic_func = 0;
@@ -55,6 +57,14 @@ extern void __custom_crash_callback( struct rst_info * rst_info, uint32_t stack,
5557

5658
extern void custom_crash_callback( struct rst_info * rst_info, uint32_t stack, uint32_t stack_end ) __attribute__ ((weak, alias("__custom_crash_callback")));
5759

60+
static void ets_puts_P(const char *romString) {
61+
char c = pgm_read_byte(romString++);
62+
while (c) {
63+
ets_putc(c);
64+
c = pgm_read_byte(romString++);
65+
}
66+
}
67+
5868
void __wrap_system_restart_local() {
5969
if (crash_for_gdb) *((int*)0) = 0;
6070
register uint32_t sp asm("a1");
@@ -71,17 +81,21 @@ void __wrap_system_restart_local() {
7181
ets_install_putc1(&uart_write_char_d);
7282

7383
if (s_panic_line) {
74-
ets_printf("\nPanic %s:%d %s\n", s_panic_file, s_panic_line, s_panic_func);
84+
ets_puts_P(PSTR("\nPanic "));
85+
ets_puts_P(s_panic_file);
86+
ets_printf(":%d ", s_panic_line);
87+
ets_puts_P(s_panic_func);
88+
ets_puts_P(PSTR("\n"));
7589
}
7690
else if (s_abort_called) {
77-
ets_printf("Abort called\n");
91+
ets_puts_P(PSTR("Abort called\n"));
7892
}
7993
else if (rst_info.reason == REASON_EXCEPTION_RST) {
8094
ets_printf("\nException (%d):\nepc1=0x%08x epc2=0x%08x epc3=0x%08x excvaddr=0x%08x depc=0x%08x\n",
8195
rst_info.exccause, rst_info.epc1, rst_info.epc2, rst_info.epc3, rst_info.excvaddr, rst_info.depc);
8296
}
8397
else if (rst_info.reason == REASON_SOFT_WDT_RST) {
84-
ets_printf("\nSoft WDT reset\n");
98+
ets_puts_P(PSTR("\nSoft WDT reset\n"));
8599
}
86100

87101
uint32_t cont_stack_start = (uint32_t) &(g_cont.stack);
@@ -103,11 +117,11 @@ void __wrap_system_restart_local() {
103117
}
104118

105119
if (sp > cont_stack_start && sp < cont_stack_end) {
106-
ets_printf("\nctx: cont \n");
120+
ets_puts_P(PSTR("\nctx: cont \n"));
107121
stack_end = cont_stack_end;
108122
}
109123
else {
110-
ets_printf("\nctx: sys \n");
124+
ets_puts_P(("\nctx: sys \n"));
111125
stack_end = 0x3fffffb0;
112126
// it's actually 0x3ffffff0, but the stuff below ets_run
113127
// is likely not really relevant to the crash
@@ -126,7 +140,7 @@ void __wrap_system_restart_local() {
126140

127141

128142
static void print_stack(uint32_t start, uint32_t end) {
129-
ets_printf("\n>>>stack>>>\n");
143+
ets_puts_P(PSTR("\n>>>stack>>>\n"));
130144
for (uint32_t pos = start; pos < end; pos += 0x10) {
131145
uint32_t* values = (uint32_t*)(pos);
132146

@@ -136,7 +150,7 @@ static void print_stack(uint32_t start, uint32_t end) {
136150
ets_printf("%08x: %08x %08x %08x %08x %c\n",
137151
pos, values[0], values[1], values[2], values[3], (looksLikeStackFrame)?'<':' ');
138152
}
139-
ets_printf("<<<stack<<<\n");
153+
ets_puts_P(PSTR("<<<stack<<<\n"));
140154
}
141155

142156
/*

Diff for: cores/esp8266/core_esp8266_wiring_digital.c

+25-7
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,15 @@ extern int ICACHE_RAM_ATTR __digitalRead(uint8_t pin) {
105105
*/
106106

107107
typedef void (*voidFuncPtr)(void);
108+
typedef void (*voidFuncPtrArg)(void*);
108109

109110
typedef struct {
110111
uint8_t mode;
111112
void (*fn)(void);
113+
void * arg;
112114
} interrupt_handler_t;
113115

116+
114117
static interrupt_handler_t interrupt_handlers[16];
115118
static uint32_t interrupt_reg = 0;
116119

@@ -127,31 +130,44 @@ void ICACHE_RAM_ATTR interrupt_handler(void *arg) {
127130
while(!(changedbits & (1 << i))) i++;
128131
changedbits &= ~(1 << i);
129132
interrupt_handler_t *handler = &interrupt_handlers[i];
130-
if (handler->fn &&
131-
(handler->mode == CHANGE ||
133+
if (handler->fn &&
134+
(handler->mode == CHANGE ||
132135
(handler->mode & 1) == !!(levels & (1 << i)))) {
133136
// to make ISR compatible to Arduino AVR model where interrupts are disabled
134137
// we disable them before we call the client ISR
135-
uint32_t savedPS = xt_rsil(15); // stop other interrupts
136-
handler->fn();
137-
xt_wsr_ps(savedPS);
138+
uint32_t savedPS = xt_rsil(15); // stop other interrupts
139+
if (handler->arg)
140+
{
141+
((voidFuncPtrArg)handler->fn)(handler->arg);
142+
}
143+
else
144+
{
145+
handler->fn();
146+
}
147+
xt_wsr_ps(savedPS);
138148
}
139149
}
140150
ETS_GPIO_INTR_ENABLE();
141151
}
142152

143-
extern void ICACHE_RAM_ATTR __attachInterrupt(uint8_t pin, voidFuncPtr userFunc, int mode) {
153+
extern void ICACHE_RAM_ATTR __attachInterruptArg(uint8_t pin, voidFuncPtr userFunc, void *arg, int mode) {
144154
if(pin < 16) {
145155
interrupt_handler_t *handler = &interrupt_handlers[pin];
146156
handler->mode = mode;
147157
handler->fn = userFunc;
158+
handler->arg = arg;
148159
interrupt_reg |= (1 << pin);
149160
GPC(pin) &= ~(0xF << GPCI);//INT mode disabled
150161
GPIEC = (1 << pin); //Clear Interrupt for this pin
151162
GPC(pin) |= ((mode & 0xF) << GPCI);//INT mode "mode"
152163
}
153164
}
154165

166+
extern void ICACHE_RAM_ATTR __attachInterrupt(uint8_t pin, voidFuncPtr userFunc, int mode )
167+
{
168+
__attachInterruptArg (pin, userFunc, 0, mode);
169+
}
170+
155171
extern void ICACHE_RAM_ATTR __detachInterrupt(uint8_t pin) {
156172
if(pin < 16) {
157173
GPC(pin) &= ~(0xF << GPCI);//INT mode disabled
@@ -160,6 +176,7 @@ extern void ICACHE_RAM_ATTR __detachInterrupt(uint8_t pin) {
160176
interrupt_handler_t *handler = &interrupt_handlers[pin];
161177
handler->mode = 0;
162178
handler->fn = 0;
179+
handler->arg = 0;
163180
}
164181
}
165182

@@ -176,7 +193,7 @@ void initPins() {
176193
for (int i = 12; i <= 16; ++i) {
177194
pinMode(i, INPUT);
178195
}
179-
196+
180197
ETS_GPIO_INTR_ATTACH(interrupt_handler, &interrupt_reg);
181198
ETS_GPIO_INTR_ENABLE();
182199
}
@@ -186,3 +203,4 @@ extern void digitalWrite(uint8_t pin, uint8_t val) __attribute__ ((weak, alias("
186203
extern int digitalRead(uint8_t pin) __attribute__ ((weak, alias("__digitalRead")));
187204
extern void attachInterrupt(uint8_t pin, voidFuncPtr handler, int mode) __attribute__ ((weak, alias("__attachInterrupt")));
188205
extern void detachInterrupt(uint8_t pin) __attribute__ ((weak, alias("__detachInterrupt")));
206+

Diff for: cores/esp8266/umm_malloc/umm_malloc.c

+4
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@
493493

494494
#include <stdio.h>
495495
#include <string.h>
496+
#include <pgmspace.h>
496497

497498
#include "umm_malloc.h"
498499

@@ -512,6 +513,9 @@
512513
# define DBG_LOG_LEVEL DBG_LOG_LEVEL
513514
#endif
514515

516+
// Macro to place constant strings into PROGMEM and print them properly
517+
#define printf(fmt, ...) do { static const char fstr[] PROGMEM = fmt; char rstr[sizeof(fmt)]; for (size_t i=0; i<sizeof(rstr); i++) rstr[i] = fstr[i]; printf(rstr, ##__VA_ARGS__); } while (0)
518+
515519
/* -- dbglog {{{ */
516520

517521
/* ----------------------------------------------------------------------------

Diff for: doc/boards.rst

+9
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ WifInfo integrates the ESP-12 or ESP-07+Ext antenna module with a 3.3v regulator
131131

132132
For more information, please see WifInfo related `blog <http://hallard.me/category/wifinfo/>`__ entries, `github <https://github.com/hallard/WifInfo>`__ and `community <https://community.hallard.me/category/16/wifinfo>`__ forum.
133133

134+
DigiStump Oak
135+
-------------
136+
137+
The Oak requires an [adapter](#serial-adapter) for a serial connection or flashing; its micro USB port is only for power.
138+
139+
To make a serial connection, wire the adapter's **TX to P3**, **RX to P4**, and **GND** to **GND**. Supply 3.3v from the serial adapter if not already powered via USB.
140+
141+
To put the board into bootloader mode, configure a serial connection as above, connect **P2 to GND**, then re-apply power. Once flashing is complete, remove the connection from P2 to GND, then re-apply power to boot into normal mode.
142+
134143
Generic ESP8266 modules
135144
-----------------------
136145

0 commit comments

Comments
 (0)