Skip to content

Commit 4d17cc8

Browse files
Merge branch 'master' into unaligned
2 parents 897702f + a0108fe commit 4d17cc8

39 files changed

+1777
-741
lines changed

.travis.yml

+11
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ jobs:
6565
env:
6666
- BUILD_PARITY=odd
6767

68+
- name: "Build lwIP-v1.4 (1)"
69+
stage: build
70+
script: $TRAVIS_BUILD_DIR/tests/build1.sh
71+
env:
72+
- BUILD_PARITY=even
73+
- name: "Build lwIP-v1.4 (2)"
74+
stage: build
75+
script: $TRAVIS_BUILD_DIR/tests/build1.sh
76+
env:
77+
- BUILD_PARITY=odd
78+
6879
- name: "Host tests"
6980
stage: build
7081
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh

cores/esp8266/IPAddress.h

+20-5
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@
3535
#define IP_IS_V4_VAL(x) (1)
3636
#define IP_SET_TYPE_VAL(x,y) do { (void)0; } while (0)
3737
#define IP_ANY_TYPE (&ip_addr_any)
38+
#define IP4_ADDR_ANY IPADDR_ANY
3839
#define IP4_ADDR_ANY4 IPADDR_ANY
3940
#define IPADDR4_INIT(x) { x }
4041
#define CONST /* nothing: lwIP-v1 does not use const */
42+
#define ip4_addr_netcmp ip_addr_netcmp
43+
#define netif_dhcp_data(netif) ((netif)->dhcp)
4144
#else // lwIP-v2+
4245
#define CONST const
4346
#if !LWIP_IPV6
@@ -84,13 +87,15 @@ class IPAddress: public Printable {
8487

8588
// Overloaded cast operator to allow IPAddress objects to be used where a pointer
8689
// to a four-byte uint8_t array is expected
87-
operator uint32_t() const {
88-
return isV4()? v4(): (uint32_t)0;
89-
}
90+
operator uint32_t() const { return isV4()? v4(): (uint32_t)0; }
91+
operator uint32_t() { return isV4()? v4(): (uint32_t)0; }
92+
operator u32_t() const { return isV4()? v4(): (u32_t)0; }
93+
operator u32_t() { return isV4()? v4(): (u32_t)0; }
9094

91-
// the above uint32_t() cast can be ambiguous
92-
// if gcc complains, use instead isSet() or v4() according to what's relevant
9395
bool isSet () const;
96+
operator bool () const { return isSet(); } // <-
97+
operator bool () { return isSet(); } // <- both are needed
98+
9499
// generic IPv4 wrapper to uint32-view like arduino loves to see it
95100
const u32_t& v4() const { return ip_2_ip4(&_ip)->addr; } // for raw_address(const)
96101
u32_t& v4() { return ip_2_ip4(&_ip)->addr; }
@@ -115,6 +120,10 @@ class IPAddress: public Printable {
115120
}
116121
bool operator==(const uint8_t* addr) const;
117122

123+
int operator>>(int n) const {
124+
return isV4()? v4() >> n: 0;
125+
}
126+
118127
// Overloaded index operator to allow getting and setting individual octets of the address
119128
uint8_t operator[](int index) const {
120129
return isV4()? *(raw_address() + index): 0;
@@ -152,6 +161,9 @@ class IPAddress: public Printable {
152161
IPAddress(const ipv4_addr& fw_addr) { setV4(); v4() = fw_addr.addr; }
153162
IPAddress(const ipv4_addr* fw_addr) { setV4(); v4() = fw_addr->addr; }
154163

164+
IPAddress& operator=(const ipv4_addr& fw_addr) { setV4(); v4() = fw_addr.addr; return *this; }
165+
IPAddress& operator=(const ipv4_addr* fw_addr) { setV4(); v4() = fw_addr->addr; return *this; }
166+
155167
operator ip_addr_t () const { return _ip; }
156168
operator const ip_addr_t*() const { return &_ip; }
157169
operator ip_addr_t*() { return &_ip; }
@@ -166,6 +178,9 @@ class IPAddress: public Printable {
166178
IPAddress(const ip_addr_t& lwip_addr) { ip_addr_copy(_ip, lwip_addr); }
167179
IPAddress(const ip_addr_t* lwip_addr) { ip_addr_copy(_ip, *lwip_addr); }
168180

181+
IPAddress& operator=(const ip_addr_t& lwip_addr) { ip_addr_copy(_ip, lwip_addr); return *this; }
182+
IPAddress& operator=(const ip_addr_t* lwip_addr) { ip_addr_copy(_ip, *lwip_addr); return *this; }
183+
169184
uint16_t* raw6()
170185
{
171186
setV6();

cores/esp8266/gdb_hooks.c

+10-4
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@
2525
value is in register, it doesn't hurt to return a bool, so that the
2626
same stub can be used for gdb_present. */
2727

28-
bool ICACHE_RAM_ATTR __gdb_no_op()
28+
static bool ICACHE_RAM_ATTR __gdb_no_op()
2929
{
3030
return false;
3131
}
3232

33-
extern void gdb_init(void) __attribute__ ((weak, alias("__gdb_no_op")));
34-
extern void gdb_do_break(void) __attribute__ ((weak, alias("__gdb_no_op")));
35-
extern bool gdb_present(void) __attribute__ ((weak, alias("__gdb_no_op")));
33+
void gdb_init(void) __attribute__ ((weak, alias("__gdb_no_op")));
34+
void gdb_do_break(void) __attribute__ ((weak, alias("__gdb_no_op")));
35+
bool gdb_present(void) __attribute__ ((weak, alias("__gdb_no_op")));
36+
bool gdbstub_has_putc1_control(void) __attribute__ ((weak, alias("__gdb_no_op")));
37+
void gdbstub_set_putc1_callback(void (*func)(char)) __attribute__ ((weak, alias("__gdb_no_op")));
38+
bool gdbstub_has_uart_isr_control(void) __attribute__ ((weak, alias("__gdb_no_op")));
39+
void gdbstub_set_uart_isr_callback(void (*func)(void*, uint8_t), void* arg) __attribute__ ((weak, alias("__gdb_no_op")));
40+
void gdbstub_write_char(char c) __attribute__ ((weak, alias("__gdb_no_op")));
41+
void gdbstub_write(const char* buf, size_t size) __attribute__ ((weak, alias("__gdb_no_op")));
3642

cores/esp8266/gdb_hooks.h

+65
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,71 @@ void gdb_do_break(void);
5252
*/
5353
bool gdb_present(void);
5454

55+
// If gdbstub has these set true, then we will disable our own
56+
// usage of them, but use gdbstub's callbacks for them instead
57+
/**
58+
* @brief Check if GDB is installing a putc1 callback.
59+
*
60+
* By default, this function returns false. When GDBStub library is linked,
61+
* this function is overriden and returns true.
62+
*
63+
* @return true if GDB is installing a putc1 callback
64+
*/
65+
bool gdbstub_has_putc1_control(void);
66+
67+
/**
68+
* @brief Register a putc1 callback with GDB.
69+
* @param func function GDB will proxy putc1 data to
70+
*
71+
* By default, this function is a no-op. When GDBStub library is linked,
72+
* this function is overriden and sets GDB stub's secondary putc1 callback to
73+
* func. When GDB stub is linked, but a GDB session is not current attached,
74+
* then GDB stub will pass putc1 chars directly to this function.
75+
*/
76+
void gdbstub_set_putc1_callback(void (*func)(char));
77+
78+
/**
79+
* @brief Check if GDB is installing a uart0 isr callback.
80+
*
81+
* By default, this function returns false. When GDBStub library is linked,
82+
* this function is overriden and returns true.
83+
*
84+
* @return true if GDB is installing a uart0 isr callback
85+
*/
86+
bool gdbstub_has_uart_isr_control(void);
87+
88+
/**
89+
* @brief Register a uart0 isr callback with GDB.
90+
* @param func function GDB will proxy uart0 isr data to
91+
*
92+
* By default, this function is a no-op. When GDBStub library is linked,
93+
* this function is overriden and sets GDB stub's secondary uart0 isr callback
94+
* to func. When GDB stub is linked, but a GDB session is not current attached,
95+
* then GDB stub will pass uart0 isr data back to this function.
96+
*/
97+
void gdbstub_set_uart_isr_callback(void (*func)(void*, uint8_t), void* arg);
98+
99+
/**
100+
* @brief Write a character for output to a GDB session on uart0.
101+
* @param c character to write
102+
*
103+
* By default, this function is a no-op. When GDBStub library is linked,
104+
* this function is overriden and writes a char to either the GDB session on
105+
* uart0 or directly to uart0 if not GDB session is attached.
106+
*/
107+
void gdbstub_write_char(char c);
108+
109+
/**
110+
* @brief Write a char buffer for output to a GDB session on uart0.
111+
* @param buf buffer of data to write
112+
* @param size length of buffer
113+
*
114+
* By default, this function is a no-op. When GDBStub library is linked,
115+
* this function is overriden and writes a buffer to either the GDB session on
116+
* uart0 or directly to uart0 if not GDB session is attached.
117+
*/
118+
void gdbstub_write(const char* buf, size_t size);
119+
55120
#ifdef __cplusplus
56121
}
57122
#endif

cores/esp8266/spiffs_api.h

+3
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ class SPIFFSImpl : public FSImpl
154154
return;
155155
}
156156
SPIFFS_unmount(&_fs);
157+
_workBuf.reset(nullptr);
158+
_fdsBuf.reset(nullptr);
159+
_cacheBuf.reset(nullptr);
157160
}
158161

159162
bool format() override

0 commit comments

Comments
 (0)