Skip to content

Commit e54e387

Browse files
Merge remote-tracking branch 'esp8266/master' into ssdp-fixes
2 parents 04deb7e + 5227b32 commit e54e387

File tree

10 files changed

+98
-28
lines changed

10 files changed

+98
-28
lines changed

.travis.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ addons:
1313
script:
1414
- set -e
1515
- export CXX="g++-4.8" CC="gcc-4.8" GCOV="gcov-4.8"
16+
- echo -e "travis_fold:start:host_tests"
1617
- pushd $TRAVIS_BUILD_DIR/tests/host
1718
- make
1819
- make clean-objects
20+
- echo -e "travis_fold:end:host_tests"
21+
- echo -e "travis_fold:start:sketch_test_env_prepare"
1922
- popd
2023
- wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
2124
- tar xf arduino.tar.xz
@@ -26,15 +29,18 @@ script:
2629
- ln -s $TRAVIS_BUILD_DIR esp8266
2730
- cd esp8266/tools
2831
- python get.py
29-
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
30-
- sleep 3
31-
- export DISPLAY=:1.0
32-
- export PATH="$HOME/arduino_ide:$PATH"
32+
- export PATH="$HOME/arduino_ide:$TRAVIS_BUILD_DIR/tools/xtensa-lx106-elf/bin:$PATH"
3333
- which arduino
3434
- cd $TRAVIS_BUILD_DIR
3535
- source tests/common.sh
3636
- install_libraries
37-
- build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR "python tools/build.py -l $HOME/Arduino/libraries -b generic -v"
37+
- echo -e "travis_fold:end:sketch_test_env_prepare"
38+
- echo -e "travis_fold:start:sketch_test"
39+
- build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR "-l $HOME/Arduino/libraries"
40+
- echo -e "travis_fold:end:sketch_test"
41+
- echo -e "travis_fold:start:size_report"
42+
- cat size.log
43+
- echo -e "travis_fold:end:size_report"
3844

3945
after_success:
4046
- pushd $TRAVIS_BUILD_DIR/tests/host

README.md

Lines changed: 2 additions & 2 deletions
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.6.5 from the [Arduino website](http://www.arduino.cc/en/main/software).
23+
- Install Arduino 1.6.8 from 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).
@@ -44,7 +44,7 @@ Documentation: [http://esp8266.github.io/Arduino/versions/2.1.0-rc2/](http://esp
4444
### Using git version
4545
[![Linux build status](https://travis-ci.org/esp8266/Arduino.svg)](https://travis-ci.org/esp8266/Arduino) [![codecov.io](https://codecov.io/github/esp8266/Arduino/coverage.svg?branch=master)](https://codecov.io/github/esp8266/Arduino?branch=master)
4646

47-
- Install Arduino 1.6.7
47+
- Install Arduino 1.6.8
4848
- Go to Arduino directory
4949
- Clone this repository into hardware/esp8266com/esp8266 directory (or clone it elsewhere and create a symlink)
5050
```bash

cores/esp8266/Esp.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ enum RFMode {
5555
RF_DISABLED = 4 // disable RF after deep-sleep wake up, just like modem sleep, there will be the smallest current.
5656
};
5757

58-
#define RF_MODE(mode) extern "C" int __get_rf_mode() { return mode; }
58+
#define RF_MODE(mode) int __get_rf_mode() { return mode; }
59+
#define RF_PRE_INIT() void __run_user_rf_pre_init()
5960

6061
// compatibility definitions
6162
#define WakeMode RFMode
@@ -71,7 +72,7 @@ enum ADCMode {
7172
ADC_VDD = 255
7273
};
7374

74-
#define ADC_MODE(mode) extern "C" int __get_adc_mode(void) { return (int) (mode); }
75+
#define ADC_MODE(mode) int __get_adc_mode(void) { return (int) (mode); }
7576

7677
typedef enum {
7778
FM_QIO = 0x00,

cores/esp8266/Tone.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,15 @@ void noTone(uint8_t _pin) {
113113
digitalWrite(_pin, LOW);
114114
}
115115

116-
void t1IntHandler() {
117-
if (toggle_counts[T1INDEX] > 0){
116+
ICACHE_RAM_ATTR void t1IntHandler() {
117+
if (toggle_counts[T1INDEX] != 0){
118118
// toggle the pin
119119
digitalWrite(tone_pins[T1INDEX], toggle_counts[T1INDEX] % 2);
120120
toggle_counts[T1INDEX]--;
121+
// handle the case of indefinite duration
122+
if (toggle_counts[T1INDEX] < -2){
123+
toggle_counts[T1INDEX] = -1;
124+
}
121125
}else{
122126
disableTimer(T1INDEX);
123127
digitalWrite(tone_pins[T1INDEX], LOW);

cores/esp8266/core_esp8266_phy.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,14 @@ static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
242242
[114] = 2
243243
};
244244

245+
// These functions will be overriden from C++ code.
246+
// Unfortunately, we can't use extern "C" because Arduino preprocessor
247+
// doesn't generate forward declarations for extern "C" functions correctly,
248+
// so we use mangled names here.
249+
#define __get_adc_mode _Z14__get_adc_modev
250+
#define __get_rf_mode _Z13__get_rf_modev
251+
#define __run_user_rf_pre_init _Z22__run_user_rf_pre_initv
252+
245253
extern int __real_register_chipv6_phy(uint8_t* init_data);
246254
extern int __wrap_register_chipv6_phy(uint8_t* init_data) {
247255
if (init_data != NULL) {
@@ -279,5 +287,6 @@ void user_rf_pre_init() {
279287
}
280288

281289
system_set_os_print(0);
290+
system_phy_set_rfoption(__get_rf_mode());
282291
__run_user_rf_pre_init();
283292
}

cores/esp8266/core_esp8266_wiring.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ void micros_overflow_tick(void* arg) {
5959
micros_at_last_overflow_tick = m;
6060
}
6161

62-
unsigned long millis() {
62+
unsigned long ICACHE_RAM_ATTR millis() {
6363
uint32_t m = system_get_time();
6464
uint32_t c = micros_overflow_count + ((m < micros_at_last_overflow_tick) ? 1 : 0);
6565
return c * 4294967 + m / 1000;
6666
}
6767

68-
unsigned long micros() {
68+
unsigned long ICACHE_RAM_ATTR micros() {
6969
return system_get_time();
7070
}
7171

72-
void delayMicroseconds(unsigned int us) {
72+
void ICACHE_RAM_ATTR delayMicroseconds(unsigned int us) {
7373
os_delay_us(us);
7474
}
7575

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*
1+
/*
22
analog.c - analogRead 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
@@ -17,20 +17,22 @@
1717
You should have received a copy of the GNU Lesser General Public
1818
License along with this library; if not, write to the Free Software
1919
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20-
21-
20+
21+
2222
18/06/2015 analogRead bugfix by Testato
2323
*/
2424

2525
#include "wiring_private.h"
2626
#include "pins_arduino.h"
2727

2828

29-
extern int __analogRead(uint8_t pin) {
30-
if(pin == 17){
31-
return system_adc_read();
32-
}
33-
return digitalRead(pin) * 1023;
29+
extern int __analogRead(uint8_t pin)
30+
{
31+
// accept both A0 constant and ADC channel number
32+
if(pin == 17 || pin == 0) {
33+
return system_adc_read();
34+
}
35+
return digitalRead(pin) * 1023;
3436
}
3537

3638
extern int analogRead(uint8_t pin) __attribute__ ((weak, alias("__analogRead")));

doc/installing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: Installation
77
This is the suggested installation method for end users.
88

99
### Prerequisites
10-
- Arduino 1.6.5, get it from [Arduino website](https://www.arduino.cc/en/Main/OldSoftwareReleases#previous). Arduino 1.6.6 has several issues, so we recommend to stick with 1.6.5 for now.
10+
- Arduino 1.6.8, get it from [Arduino website](https://www.arduino.cc/en/Main/OldSoftwareReleases#previous).
1111
- Internet connection
1212

1313
### Instructions
@@ -27,7 +27,7 @@ This is the suggested installation method for contributors and library developer
2727

2828
### Prerequisites
2929

30-
- Arduino 1.6.5 (or newer, if you know what you are doing)
30+
- Arduino 1.6.8 (or newer, if you know what you are doing)
3131
- git
3232
- python 2.7
3333
- terminal, console, or command prompt (depending on you OS)

tests/common.sh

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,49 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
3+
function print_size_info()
4+
{
5+
elf_file=$1
6+
7+
if [ -z "$elf_file" ]; then
8+
printf "sketch data rodata bss text irom0.text dram flash\n"
9+
return 0
10+
fi
11+
12+
elf_name=$(basename $elf_file)
13+
sketch_name="${elf_name%.*}"
14+
# echo $sketch_name
15+
declare -A segments
16+
while read -a tokens; do
17+
seg=${tokens[0]}
18+
seg=${seg//./}
19+
size=${tokens[1]}
20+
addr=${tokens[2]}
21+
if [ "$addr" -eq "$addr" -a "$addr" -ne "0" ] 2>/dev/null; then
22+
segments[$seg]=$size
23+
fi
24+
25+
26+
done < <(xtensa-lx106-elf-size --format=sysv $elf_file)
27+
28+
total_ram=$((${segments[data]} + ${segments[rodata]} + ${segments[bss]}))
29+
total_flash=$((${segments[data]} + ${segments[rodata]} + ${segments[text]} + ${segments[irom0text]}))
30+
31+
printf "%-28s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[data]} ${segments[rodata]} ${segments[bss]} ${segments[text]} ${segments[irom0text]} $total_ram $total_flash
32+
return 0
33+
}
234

335
function build_sketches()
436
{
537
set +e
638
local arduino=$1
739
local srcpath=$2
8-
local build_cmd=$3
9-
echo $build_cmd
40+
local build_arg=$3
41+
local build_dir=build.tmp
42+
mkdir -p $build_dir
43+
rm -rf $build_dir/*
44+
local build_cmd="python tools/build.py -b generic -v -k -p $PWD/$build_dir $build_arg "
1045
local sketches=$(find $srcpath -name *.ino)
46+
print_size_info >size.log
1147
export ARDUINO_IDE_PATH=$arduino
1248
for sketch in $sketches; do
1349
local sketchdir=$(dirname $sketch)
@@ -33,6 +69,7 @@ function build_sketches()
3369
return $result
3470
fi
3571
rm build.log
72+
print_size_info $build_dir/*.elf >>size.log
3673
done
3774
set -e
3875
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ADC_MODE(ADC_VCC);
2+
RF_MODE(RF_DISABLED);
3+
RF_PRE_INIT()
4+
{
5+
}
6+
7+
void setup() {
8+
}
9+
10+
void loop() {
11+
}

0 commit comments

Comments
 (0)