1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-07 16:23:38 +03:00

Merge remote-tracking branch 'esp8266/master' into ssdp-fixes

This commit is contained in:
Jeremy Green 2016-03-16 10:54:52 -04:00
commit e54e387ca8
10 changed files with 98 additions and 28 deletions

View File

@ -13,9 +13,12 @@ addons:
script: script:
- set -e - set -e
- export CXX="g++-4.8" CC="gcc-4.8" GCOV="gcov-4.8" - export CXX="g++-4.8" CC="gcc-4.8" GCOV="gcov-4.8"
- echo -e "travis_fold:start:host_tests"
- pushd $TRAVIS_BUILD_DIR/tests/host - pushd $TRAVIS_BUILD_DIR/tests/host
- make - make
- make clean-objects - make clean-objects
- echo -e "travis_fold:end:host_tests"
- echo -e "travis_fold:start:sketch_test_env_prepare"
- popd - popd
- wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz - wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
- tar xf arduino.tar.xz - tar xf arduino.tar.xz
@ -26,15 +29,18 @@ script:
- ln -s $TRAVIS_BUILD_DIR esp8266 - ln -s $TRAVIS_BUILD_DIR esp8266
- cd esp8266/tools - cd esp8266/tools
- python get.py - python get.py
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16 - export PATH="$HOME/arduino_ide:$TRAVIS_BUILD_DIR/tools/xtensa-lx106-elf/bin:$PATH"
- sleep 3
- export DISPLAY=:1.0
- export PATH="$HOME/arduino_ide:$PATH"
- which arduino - which arduino
- cd $TRAVIS_BUILD_DIR - cd $TRAVIS_BUILD_DIR
- source tests/common.sh - source tests/common.sh
- install_libraries - install_libraries
- build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR "python tools/build.py -l $HOME/Arduino/libraries -b generic -v" - echo -e "travis_fold:end:sketch_test_env_prepare"
- echo -e "travis_fold:start:sketch_test"
- build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR "-l $HOME/Arduino/libraries"
- echo -e "travis_fold:end:sketch_test"
- echo -e "travis_fold:start:size_report"
- cat size.log
- echo -e "travis_fold:end:size_report"
after_success: after_success:
- pushd $TRAVIS_BUILD_DIR/tests/host - pushd $TRAVIS_BUILD_DIR/tests/host

View File

@ -20,7 +20,7 @@ ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and
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). 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).
- Install Arduino 1.6.5 from the [Arduino website](http://www.arduino.cc/en/main/software). - Install Arduino 1.6.8 from the [Arduino website](http://www.arduino.cc/en/main/software).
- Start Arduino and open Preferences window. - Start Arduino and open Preferences window.
- 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. - 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.
- 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). - 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
### Using git version ### Using git version
[![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) [![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)
- Install Arduino 1.6.7 - Install Arduino 1.6.8
- Go to Arduino directory - Go to Arduino directory
- Clone this repository into hardware/esp8266com/esp8266 directory (or clone it elsewhere and create a symlink) - Clone this repository into hardware/esp8266com/esp8266 directory (or clone it elsewhere and create a symlink)
```bash ```bash

View File

@ -55,7 +55,8 @@ enum RFMode {
RF_DISABLED = 4 // disable RF after deep-sleep wake up, just like modem sleep, there will be the smallest current. RF_DISABLED = 4 // disable RF after deep-sleep wake up, just like modem sleep, there will be the smallest current.
}; };
#define RF_MODE(mode) extern "C" int __get_rf_mode() { return mode; } #define RF_MODE(mode) int __get_rf_mode() { return mode; }
#define RF_PRE_INIT() void __run_user_rf_pre_init()
// compatibility definitions // compatibility definitions
#define WakeMode RFMode #define WakeMode RFMode
@ -71,7 +72,7 @@ enum ADCMode {
ADC_VDD = 255 ADC_VDD = 255
}; };
#define ADC_MODE(mode) extern "C" int __get_adc_mode(void) { return (int) (mode); } #define ADC_MODE(mode) int __get_adc_mode(void) { return (int) (mode); }
typedef enum { typedef enum {
FM_QIO = 0x00, FM_QIO = 0x00,

View File

@ -113,11 +113,15 @@ void noTone(uint8_t _pin) {
digitalWrite(_pin, LOW); digitalWrite(_pin, LOW);
} }
void t1IntHandler() { ICACHE_RAM_ATTR void t1IntHandler() {
if (toggle_counts[T1INDEX] > 0){ if (toggle_counts[T1INDEX] != 0){
// toggle the pin // toggle the pin
digitalWrite(tone_pins[T1INDEX], toggle_counts[T1INDEX] % 2); digitalWrite(tone_pins[T1INDEX], toggle_counts[T1INDEX] % 2);
toggle_counts[T1INDEX]--; toggle_counts[T1INDEX]--;
// handle the case of indefinite duration
if (toggle_counts[T1INDEX] < -2){
toggle_counts[T1INDEX] = -1;
}
}else{ }else{
disableTimer(T1INDEX); disableTimer(T1INDEX);
digitalWrite(tone_pins[T1INDEX], LOW); digitalWrite(tone_pins[T1INDEX], LOW);

View File

@ -242,6 +242,14 @@ static const uint8_t ICACHE_FLASH_ATTR phy_init_data[128] =
[114] = 2 [114] = 2
}; };
// These functions will be overriden from C++ code.
// Unfortunately, we can't use extern "C" because Arduino preprocessor
// doesn't generate forward declarations for extern "C" functions correctly,
// so we use mangled names here.
#define __get_adc_mode _Z14__get_adc_modev
#define __get_rf_mode _Z13__get_rf_modev
#define __run_user_rf_pre_init _Z22__run_user_rf_pre_initv
extern int __real_register_chipv6_phy(uint8_t* init_data); extern int __real_register_chipv6_phy(uint8_t* init_data);
extern int __wrap_register_chipv6_phy(uint8_t* init_data) { extern int __wrap_register_chipv6_phy(uint8_t* init_data) {
if (init_data != NULL) { if (init_data != NULL) {
@ -279,5 +287,6 @@ void user_rf_pre_init() {
} }
system_set_os_print(0); system_set_os_print(0);
system_phy_set_rfoption(__get_rf_mode());
__run_user_rf_pre_init(); __run_user_rf_pre_init();
} }

View File

@ -59,17 +59,17 @@ void micros_overflow_tick(void* arg) {
micros_at_last_overflow_tick = m; micros_at_last_overflow_tick = m;
} }
unsigned long millis() { unsigned long ICACHE_RAM_ATTR millis() {
uint32_t m = system_get_time(); uint32_t m = system_get_time();
uint32_t c = micros_overflow_count + ((m < micros_at_last_overflow_tick) ? 1 : 0); uint32_t c = micros_overflow_count + ((m < micros_at_last_overflow_tick) ? 1 : 0);
return c * 4294967 + m / 1000; return c * 4294967 + m / 1000;
} }
unsigned long micros() { unsigned long ICACHE_RAM_ATTR micros() {
return system_get_time(); return system_get_time();
} }
void delayMicroseconds(unsigned int us) { void ICACHE_RAM_ATTR delayMicroseconds(unsigned int us) {
os_delay_us(us); os_delay_us(us);
} }

View File

@ -1,9 +1,9 @@
/* /*
analog.c - analogRead implementation for esp8266 analog.c - analogRead implementation for esp8266
Copyright (c) 2015 Hristo Gochkov. All rights reserved. Copyright (c) 2015 Hristo Gochkov. All rights reserved.
This file is part of the esp8266 core for Arduino environment. This file is part of the esp8266 core for Arduino environment.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
@ -17,8 +17,8 @@
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18/06/2015 analogRead bugfix by Testato 18/06/2015 analogRead bugfix by Testato
*/ */
@ -26,11 +26,13 @@
#include "pins_arduino.h" #include "pins_arduino.h"
extern int __analogRead(uint8_t pin) { extern int __analogRead(uint8_t pin)
if(pin == 17){ {
return system_adc_read(); // accept both A0 constant and ADC channel number
} if(pin == 17 || pin == 0) {
return digitalRead(pin) * 1023; return system_adc_read();
}
return digitalRead(pin) * 1023;
} }
extern int analogRead(uint8_t pin) __attribute__ ((weak, alias("__analogRead"))); extern int analogRead(uint8_t pin) __attribute__ ((weak, alias("__analogRead")));

View File

@ -7,7 +7,7 @@ title: Installation
This is the suggested installation method for end users. This is the suggested installation method for end users.
### Prerequisites ### Prerequisites
- 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. - Arduino 1.6.8, get it from [Arduino website](https://www.arduino.cc/en/Main/OldSoftwareReleases#previous).
- Internet connection - Internet connection
### Instructions ### Instructions
@ -27,7 +27,7 @@ This is the suggested installation method for contributors and library developer
### Prerequisites ### Prerequisites
- Arduino 1.6.5 (or newer, if you know what you are doing) - Arduino 1.6.8 (or newer, if you know what you are doing)
- git - git
- python 2.7 - python 2.7
- terminal, console, or command prompt (depending on you OS) - terminal, console, or command prompt (depending on you OS)

View File

@ -1,13 +1,49 @@
#!/bin/bash #!/usr/bin/env bash
function print_size_info()
{
elf_file=$1
if [ -z "$elf_file" ]; then
printf "sketch data rodata bss text irom0.text dram flash\n"
return 0
fi
elf_name=$(basename $elf_file)
sketch_name="${elf_name%.*}"
# echo $sketch_name
declare -A segments
while read -a tokens; do
seg=${tokens[0]}
seg=${seg//./}
size=${tokens[1]}
addr=${tokens[2]}
if [ "$addr" -eq "$addr" -a "$addr" -ne "0" ] 2>/dev/null; then
segments[$seg]=$size
fi
done < <(xtensa-lx106-elf-size --format=sysv $elf_file)
total_ram=$((${segments[data]} + ${segments[rodata]} + ${segments[bss]}))
total_flash=$((${segments[data]} + ${segments[rodata]} + ${segments[text]} + ${segments[irom0text]}))
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
return 0
}
function build_sketches() function build_sketches()
{ {
set +e set +e
local arduino=$1 local arduino=$1
local srcpath=$2 local srcpath=$2
local build_cmd=$3 local build_arg=$3
echo $build_cmd local build_dir=build.tmp
mkdir -p $build_dir
rm -rf $build_dir/*
local build_cmd="python tools/build.py -b generic -v -k -p $PWD/$build_dir $build_arg "
local sketches=$(find $srcpath -name *.ino) local sketches=$(find $srcpath -name *.ino)
print_size_info >size.log
export ARDUINO_IDE_PATH=$arduino export ARDUINO_IDE_PATH=$arduino
for sketch in $sketches; do for sketch in $sketches; do
local sketchdir=$(dirname $sketch) local sketchdir=$(dirname $sketch)
@ -33,6 +69,7 @@ function build_sketches()
return $result return $result
fi fi
rm build.log rm build.log
print_size_info $build_dir/*.elf >>size.log
done done
set -e set -e
} }

View File

@ -0,0 +1,11 @@
ADC_MODE(ADC_VCC);
RF_MODE(RF_DISABLED);
RF_PRE_INIT()
{
}
void setup() {
}
void loop() {
}