Skip to content

Commit 20ed1cb

Browse files
Merge branch 'master' into webserver-template
2 parents 3a8e1d4 + c5efb92 commit 20ed1cb

File tree

12 files changed

+117
-36
lines changed

12 files changed

+117
-36
lines changed

cores/esp8266/FunctionalInterrupt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ typedef void (*voidFuncPtrArg)(void*);
1111
extern "C" void ICACHE_RAM_ATTR __attachInterruptArg(uint8_t pin, voidFuncPtr userFunc, void*fp , int mode);
1212

1313

14-
void interruptFunctional(void* arg)
14+
void ICACHE_RAM_ATTR interruptFunctional(void* arg)
1515
{
1616
ArgStructure* localArg = (ArgStructure*)arg;
1717
if (localArg->functionInfo->reqScheduledFunction)

cores/esp8266/PolledTimeout.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class timeoutTemplate
142142
{
143143
public:
144144
using timeType = typename TimePolicyT::timeType;
145+
static_assert(std::is_unsigned<timeType>::value == true, "timeType must be unsigned");
145146

146147
static constexpr timeType alwaysExpired = 0;
147148
static constexpr timeType neverExpires = std::numeric_limits<timeType>::max();

cores/esp8266/WString.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,17 +829,24 @@ void String::trim(void) {
829829
// /*********************************************/
830830

831831
long String::toInt(void) const {
832-
if(buffer())
832+
if (buffer())
833833
return atol(buffer());
834834
return 0;
835835
}
836836

837837
float String::toFloat(void) const {
838-
if(buffer())
838+
if (buffer())
839839
return atof(buffer());
840840
return 0;
841841
}
842842

843+
double String::toDouble(void) const
844+
{
845+
if (buffer())
846+
return atof(buffer());
847+
return 0.0;
848+
}
849+
843850
// global empty string to allow returning const String& with nothing
844851

845852
const String emptyString;

cores/esp8266/WString.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ class String {
241241
// parsing/conversion
242242
long toInt(void) const;
243243
float toFloat(void) const;
244+
double toDouble(void) const;
244245

245246
protected:
246247
// Contains the string info when we're not in SSO mode

cores/esp8266/core_esp8266_wiring_digital.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,16 @@ void ICACHE_RAM_ATTR interrupt_handler(void *arg) {
171171
extern void cleanupFunctional(void* arg);
172172

173173
extern void ICACHE_RAM_ATTR __attachInterruptArg(uint8_t pin, voidFuncPtr userFunc, void *arg, int mode) {
174+
175+
// #5780
176+
// https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map
177+
if ((uint32_t)userFunc >= 0x40200000)
178+
{
179+
// ISR not in IRAM
180+
::printf((PGM_P)F("ISR not in IRAM!\r\n"));
181+
abort();
182+
}
183+
174184
if(pin < 16) {
175185
ETS_GPIO_INTR_DISABLE();
176186
interrupt_handler_t *handler = &interrupt_handlers[pin];

doc/esp8266wifi/station-class.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ Function returns value of the ``String`` type.
535535
BSSID
536536
^^^^^
537537

538-
Return the mac address the access point where ESP module is connected to. This address is formally called `Basic Service Set Identification (BSSID) <http://www.juniper.net/techpubs/en_US/network-director1.1/topics/concept/wireless-ssid-bssid-essid.html#jd0e47>`__.
538+
Return the mac address of the access point to which the ESP module was directed to connect to. This address is formally called `Basic Service Set Identification (BSSID) <http://www.juniper.net/techpubs/en_US/network-director1.1/topics/concept/wireless-ssid-bssid-essid.html#jd0e47>`__. The returned pointer is what the user configured when calling begin() with a bssid argument. It does _not_ necessarily reflect the mac address of the access point to which the ESP module's station interface is currently connected to.
539539

540540
.. code:: cpp
541541

doc/installing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Instructions - Windows 10
105105
106106
.. code:: bash
107107
108-
cd %USERPROFILE%\Documents\hardware\esp8266com\esp8266
108+
cd %USERPROFILE%\Documents\Arduino\hardware\esp8266com\esp8266
109109
git submodule update --init
110110
111111
If error messages about missing files related to ``SoftwareSerial`` are encountered during the build process, it should be because this step was missed and is required.
@@ -125,7 +125,7 @@ Instructions - Windows 10
125125
126126
.. code:: bash
127127
128-
cd %USERPROFILE%\Documents\hardware\esp8266com\esp8266
128+
cd %USERPROFILE%\Documents\Arduino\hardware\esp8266com\esp8266
129129
git status
130130
git pull
131131

tests/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ If you want to add emulation of a certain feature, add it into tests/host/common
1919

2020
### Running test cases
2121

22+
**NOTE!** The test-on-host environment is dependent on some submodules. Make sure to run `git submodule update --init` before running any test.
23+
2224
To run test cases, go to tests/host/ directory and run `make`. This will compile and run the tests.
2325

2426
If all tests pass, you will see "All tests passed" message and the exit code will be 0.

tests/host/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ FLAGS += -DLWIP_IPV6=0
145145
FLAGS += -DHOST_MOCK=1
146146
FLAGS += -DNONOSDK221=1
147147
FLAGS += $(MKFLAGS)
148-
CXXFLAGS += -std=c++11 $(FLAGS)
148+
CXXFLAGS += -std=c++11 -fno-rtti $(FLAGS)
149149
CFLAGS += -std=c99 $(FLAGS)
150150
LDFLAGS += -coverage $(OPTZ) -g $(M32)
151151
VALGRINDFLAGS += --leak-check=full --track-origins=yes --error-limit=no --show-leak-kinds=all --error-exitcode=999

tools/makecorever.py

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,53 @@
2121
import os
2222
import subprocess
2323

24-
parser = argparse.ArgumentParser(description='Generate core_version.h')
25-
parser.add_argument('-b', '--build_path', action='store', required=True, help='build.path variable')
26-
parser.add_argument('-p', '--platform_path', action='store', required=True, help='platform.path variable')
27-
parser.add_argument('-v', '--version', action='store', required=True, help='version variable')
28-
29-
args = parser.parse_args()
30-
31-
core = args.build_path + '/core'
32-
try:
33-
os.makedirs(core)
34-
except:
35-
pass
36-
37-
out = open(core + '/core_version.h', "w")
38-
39-
try:
40-
p = subprocess.Popen(['git', '--git-dir', args.platform_path + '/.git', 'rev-parse', '--short=8', 'HEAD'], stdout = subprocess.PIPE )
41-
git_ver = '0x' + p.stdout.readlines()[0].strip()
42-
p = subprocess.Popen(['git', '--git-dir', args.platform_path + '/.git', 'describe', '--tags'], stdout = subprocess.PIPE )
43-
git_desc = p.stdout.readlines()[0].strip()
44-
except:
45-
git_ver = '0xffffffff'
46-
git_desc = args.version
47-
48-
out.write('#define ARDUINO_ESP8266_GIT_VER ' + git_ver + '\n')
49-
out.write('#define ARDUINO_ESP8266_GIT_DESC ' + git_desc + '\n')
50-
51-
out.close()
24+
25+
def generate(path, platform_path, git_ver="0xffffffff", git_desc="unspecified"):
26+
def git(*args):
27+
cmd = ["git", "-C", platform_path]
28+
cmd.extend(args)
29+
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True)
30+
return proc.stdout.readlines()[0].strip()
31+
32+
try:
33+
git_ver = git("rev-parse", "--short=8", "HEAD")
34+
git_desc = git("describe", "--tags")
35+
except:
36+
pass
37+
38+
with open(path, "w") as out:
39+
out.write("#define ARDUINO_ESP8266_GIT_VER 0x{}\n".format(git_ver))
40+
out.write("#define ARDUINO_ESP8266_GIT_DESC {}\n".format(git_desc))
41+
42+
43+
if __name__ == "__main__":
44+
parser = argparse.ArgumentParser(description="Generate core_version.h")
45+
46+
parser.add_argument(
47+
"-b", "--build_path", action="store", required=True, help="build.path variable"
48+
)
49+
parser.add_argument(
50+
"-p",
51+
"--platform_path",
52+
action="store",
53+
required=True,
54+
help="platform.path variable",
55+
)
56+
parser.add_argument(
57+
"-v", "--version", action="store", required=True, help="version variable"
58+
)
59+
parser.add_argument("-i", "--include_dir", default="core")
60+
61+
args = parser.parse_args()
62+
63+
include_dir = os.path.join(args.build_path, args.include_dir)
64+
try:
65+
os.makedirs(include_dir)
66+
except:
67+
pass
68+
69+
generate(
70+
os.path.join(include_dir, "core_version.h"),
71+
args.platform_path,
72+
git_desc=args.version,
73+
)

tools/platformio-build.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
# Extends: https://github.com/platformio/platform-espressif8266/blob/develop/builder/main.py
2626

27+
import os
28+
import subprocess
29+
2730
from os.path import isdir, join
2831

2932
from SCons import Builder, Util
@@ -220,6 +223,41 @@ def scons_patched_match_splitext(path, suffixes=None):
220223
"Generating LD script $TARGET"))
221224
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", app_ld)
222225

226+
#
227+
# Dynamic core_version.h for staging builds
228+
#
229+
230+
def platform_txt_version(default):
231+
with open(join(FRAMEWORK_DIR, "platform.txt"), "r") as platform_txt:
232+
for line in platform_txt:
233+
if not line:
234+
continue
235+
k, delim, v = line.partition("=")
236+
if not delim:
237+
continue
238+
if k == "version":
239+
return v.strip()
240+
241+
return default
242+
243+
if isdir(join(FRAMEWORK_DIR, ".git")):
244+
cmd = '"$PYTHONEXE" "{script}" -b "$BUILD_DIR" -p "{framework_dir}" -v {version}'
245+
fmt = {
246+
"script": join(FRAMEWORK_DIR, "tools", "makecorever.py"),
247+
"framework_dir": FRAMEWORK_DIR,
248+
"version": platform_txt_version("unspecified")
249+
}
250+
251+
env.Prepend(CPPPATH=[
252+
join("$BUILD_DIR", "core")
253+
])
254+
core_version = env.Command(
255+
join("$BUILD_DIR", "core", "core_version.h"),
256+
join(FRAMEWORK_DIR, ".git"),
257+
env.VerboseAction(cmd.format(**fmt), "Generating $TARGET")
258+
)
259+
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", core_version)
260+
223261

224262
#
225263
# Target: Build Core Library

0 commit comments

Comments
 (0)