mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-22 21:23:07 +03:00
Merge remote-tracking branch 'upstream/esp8266' into esp8266
This commit is contained in:
commit
348efba5b2
91
boards.txt
91
boards.txt
@ -154,11 +154,6 @@ huzzah.build.variant=adafruit
|
||||
huzzah.build.flash_mode=qio
|
||||
huzzah.build.flash_size=4M
|
||||
huzzah.build.flash_freq=40
|
||||
huzzah.build.flash_ld=eagle.flash.4m.ld
|
||||
huzzah.build.spiffs_start=0x100000
|
||||
huzzah.build.spiffs_end=0x3FB000
|
||||
huzzah.build.spiffs_pagesize=256
|
||||
huzzah.build.spiffs_blocksize=8192
|
||||
|
||||
huzzah.menu.CpuFrequency.80=80 MHz
|
||||
huzzah.menu.CpuFrequency.80.build.f_cpu=80000000L
|
||||
@ -176,6 +171,23 @@ huzzah.menu.UploadSpeed.256000.upload.speed=256000
|
||||
huzzah.menu.UploadSpeed.921600=921600
|
||||
huzzah.menu.UploadSpeed.921600.upload.speed=921600
|
||||
|
||||
huzzah.menu.FlashSize.4M3M=4M (3M SPIFFS)
|
||||
huzzah.menu.FlashSize.4M3M.build.flash_size=4M
|
||||
huzzah.menu.FlashSize.4M3M.build.flash_ld=eagle.flash.4m.ld
|
||||
huzzah.menu.FlashSize.4M3M.build.spiffs_start=0x100000
|
||||
huzzah.menu.FlashSize.4M3M.build.spiffs_end=0x3FB000
|
||||
huzzah.menu.FlashSize.4M3M.build.spiffs_blocksize=8192
|
||||
huzzah.menu.FlashSize.4M3M.build.spiffs_pagesize=256
|
||||
huzzah.menu.FlashSize.4M3M.upload.maximum_size=1044464
|
||||
|
||||
huzzah.menu.FlashSize.4M1M=4M (1M SPIFFS)
|
||||
huzzah.menu.FlashSize.4M1M.build.flash_size=4M
|
||||
huzzah.menu.FlashSize.4M1M.build.flash_ld=eagle.flash.4m1m.ld
|
||||
huzzah.menu.FlashSize.4M1M.build.spiffs_start=0x300000
|
||||
huzzah.menu.FlashSize.4M1M.build.spiffs_end=0x3FB000
|
||||
huzzah.menu.FlashSize.4M1M.build.spiffs_blocksize=8192
|
||||
huzzah.menu.FlashSize.4M3M.build.spiffs_pagesize=256
|
||||
|
||||
##############################################################
|
||||
nodemcu.name=NodeMCU 0.9 (ESP-12 Module)
|
||||
|
||||
@ -196,11 +208,6 @@ nodemcu.build.variant=nodemcu
|
||||
nodemcu.build.flash_mode=qio
|
||||
nodemcu.build.flash_size=4M
|
||||
nodemcu.build.flash_freq=40
|
||||
nodemcu.build.flash_ld=eagle.flash.4m.ld
|
||||
nodemcu.build.spiffs_start=0x100000
|
||||
nodemcu.build.spiffs_end=0x3FB000
|
||||
nodemcu.build.spiffs_pagesize=256
|
||||
nodemcu.build.spiffs_blocksize=8192
|
||||
|
||||
nodemcu.menu.CpuFrequency.80=80 MHz
|
||||
nodemcu.menu.CpuFrequency.80.build.f_cpu=80000000L
|
||||
@ -227,6 +234,23 @@ nodemcu.menu.UploadSpeed.512000.upload.speed=512000
|
||||
nodemcu.menu.UploadSpeed.921600=921600
|
||||
nodemcu.menu.UploadSpeed.921600.upload.speed=921600
|
||||
|
||||
nodemcu.menu.FlashSize.4M3M=4M (3M SPIFFS)
|
||||
nodemcu.menu.FlashSize.4M3M.build.flash_size=4M
|
||||
nodemcu.menu.FlashSize.4M3M.build.flash_ld=eagle.flash.4m.ld
|
||||
nodemcu.menu.FlashSize.4M3M.build.spiffs_start=0x100000
|
||||
nodemcu.menu.FlashSize.4M3M.build.spiffs_end=0x3FB000
|
||||
nodemcu.menu.FlashSize.4M3M.build.spiffs_blocksize=8192
|
||||
nodemcu.menu.FlashSize.4M3M.build.spiffs_pagesize=256
|
||||
nodemcu.menu.FlashSize.4M3M.upload.maximum_size=1044464
|
||||
|
||||
nodemcu.menu.FlashSize.4M1M=4M (1M SPIFFS)
|
||||
nodemcu.menu.FlashSize.4M1M.build.flash_size=4M
|
||||
nodemcu.menu.FlashSize.4M1M.build.flash_ld=eagle.flash.4m1m.ld
|
||||
nodemcu.menu.FlashSize.4M1M.build.spiffs_start=0x300000
|
||||
nodemcu.menu.FlashSize.4M1M.build.spiffs_end=0x3FB000
|
||||
nodemcu.menu.FlashSize.4M1M.build.spiffs_blocksize=8192
|
||||
nodemcu.menu.FlashSize.4M3M.build.spiffs_pagesize=256
|
||||
|
||||
##############################################################
|
||||
nodemcuv2.name=NodeMCU 1.0 (ESP-12E Module)
|
||||
|
||||
@ -247,11 +271,6 @@ nodemcuv2.build.variant=nodemcu
|
||||
nodemcuv2.build.flash_mode=dio
|
||||
nodemcuv2.build.flash_size=4M
|
||||
nodemcuv2.build.flash_freq=40
|
||||
nodemcuv2.build.flash_ld=eagle.flash.4m.ld
|
||||
nodemcuv2.build.spiffs_start=0x100000
|
||||
nodemcuv2.build.spiffs_end=0x3FB000
|
||||
nodemcuv2.build.spiffs_pagesize=256
|
||||
nodemcuv2.build.spiffs_blocksize=8192
|
||||
|
||||
nodemcuv2.menu.CpuFrequency.80=80 MHz
|
||||
nodemcuv2.menu.CpuFrequency.80.build.f_cpu=80000000L
|
||||
@ -278,6 +297,25 @@ nodemcuv2.menu.UploadSpeed.512000.upload.speed=512000
|
||||
nodemcuv2.menu.UploadSpeed.921600=921600
|
||||
nodemcuv2.menu.UploadSpeed.921600.upload.speed=921600
|
||||
|
||||
nodemcuv2.menu.FlashSize.4M3M=4M (3M SPIFFS)
|
||||
nodemcuv2.menu.FlashSize.4M3M.build.flash_size=4M
|
||||
nodemcuv2.menu.FlashSize.4M3M.build.flash_ld=eagle.flash.4m.ld
|
||||
nodemcuv2.menu.FlashSize.4M3M.build.spiffs_start=0x100000
|
||||
nodemcuv2.menu.FlashSize.4M3M.build.spiffs_end=0x3FB000
|
||||
nodemcuv2.menu.FlashSize.4M3M.build.spiffs_blocksize=8192
|
||||
nodemcuv2.menu.FlashSize.4M3M.build.spiffs_pagesize=256
|
||||
nodemcuv2.menu.FlashSize.4M3M.upload.maximum_size=1044464
|
||||
|
||||
nodemcuv2.menu.FlashSize.4M1M=4M (1M SPIFFS)
|
||||
nodemcuv2.menu.FlashSize.4M1M.build.flash_size=4M
|
||||
nodemcuv2.menu.FlashSize.4M1M.build.flash_ld=eagle.flash.4m1m.ld
|
||||
nodemcuv2.menu.FlashSize.4M1M.build.spiffs_start=0x300000
|
||||
nodemcuv2.menu.FlashSize.4M1M.build.spiffs_end=0x3FB000
|
||||
nodemcuv2.menu.FlashSize.4M1M.build.spiffs_blocksize=8192
|
||||
nodemcuv2.menu.FlashSize.4M3M.build.spiffs_pagesize=256
|
||||
nodemcuv2.menu.FlashSize.4M1M.upload.maximum_size=1044464
|
||||
|
||||
|
||||
##############################################################
|
||||
modwifi.name=Olimex MOD-WIFI-ESP8266(-DEV)
|
||||
|
||||
@ -355,6 +393,7 @@ thing.build.flash_freq=40
|
||||
thing.build.spiffs_start=0x6B000
|
||||
thing.build.spiffs_end=0x7B000
|
||||
thing.build.spiffs_blocksize=4096
|
||||
thing.build.spiffs_pagesize=256
|
||||
|
||||
thing.menu.CpuFrequency.80=80 MHz
|
||||
thing.menu.CpuFrequency.80.build.f_cpu=80000000L
|
||||
@ -400,11 +439,6 @@ esp210.build.variant=generic
|
||||
esp210.build.flash_mode=qio
|
||||
esp210.build.flash_size=4M
|
||||
esp210.build.flash_freq=40
|
||||
esp210.build.flash_ld=eagle.flash.4m.ld
|
||||
esp210.build.spiffs_start=0x100000
|
||||
esp210.build.spiffs_end=0x3FB000
|
||||
esp210.build.spiffs_pagesize=256
|
||||
esp210.build.spiffs_blocksize=8192
|
||||
|
||||
esp210.menu.CpuFrequency.80=80 MHz
|
||||
esp210.menu.CpuFrequency.80.build.f_cpu=80000000L
|
||||
@ -429,6 +463,23 @@ esp210.menu.UploadSpeed.512000.upload.speed=512000
|
||||
esp210.menu.UploadSpeed.921600=921600
|
||||
esp210.menu.UploadSpeed.921600.upload.speed=921600
|
||||
|
||||
esp210.menu.FlashSize.4M3M=4M (3M SPIFFS)
|
||||
esp210.menu.FlashSize.4M3M.build.flash_size=4M
|
||||
esp210.menu.FlashSize.4M3M.build.flash_ld=eagle.flash.4m.ld
|
||||
esp210.menu.FlashSize.4M3M.build.spiffs_start=0x100000
|
||||
esp210.menu.FlashSize.4M3M.build.spiffs_end=0x3FB000
|
||||
esp210.menu.FlashSize.4M3M.build.spiffs_blocksize=8192
|
||||
esp210.menu.FlashSize.4M3M.build.spiffs_pagesize=256
|
||||
esp210.menu.FlashSize.4M3M.upload.maximum_size=1044464
|
||||
|
||||
esp210.menu.FlashSize.4M1M=4M (1M SPIFFS)
|
||||
esp210.menu.FlashSize.4M1M.build.flash_size=4M
|
||||
esp210.menu.FlashSize.4M1M.build.flash_ld=eagle.flash.4m1m.ld
|
||||
esp210.menu.FlashSize.4M1M.build.spiffs_start=0x300000
|
||||
esp210.menu.FlashSize.4M1M.build.spiffs_end=0x3FB000
|
||||
esp210.menu.FlashSize.4M1M.build.spiffs_blocksize=8192
|
||||
esp210.menu.FlashSize.4M3M.build.spiffs_pagesize=256
|
||||
|
||||
##############################################################
|
||||
# wifio.name=Wifio
|
||||
#
|
||||
|
@ -291,7 +291,7 @@ uint32_t EspClass::getFlashChipSizeByChipId(void) {
|
||||
String EspClass::getResetInfo(void) {
|
||||
if(resetInfo.reason != 0) {
|
||||
char buff[200];
|
||||
sprintf(&buff[0], "Fatal exception:%d flag:%d (%s) epc1:0x%08x epc2:0x%08x epc3:0x%08x excvaddr:0x%08x depc:0x%08x", resetInfo.exccause, resetInfo.reason, (resetInfo.reason == 0 ? "DEFAULT" : resetInfo.reason == 1 ? "WDT" : resetInfo.reason == 2 ? "EXCEPTION" : resetInfo.reason == 3 ? "SOFT_WDT" : resetInfo.reason == 4 ? "SOFT_RESTART" : resetInfo.reason == 5 ? "DEEP_SLEEP_AWAKE" : "???"), resetInfo.epc1, resetInfo.epc2, resetInfo.epc3, resetInfo.excvaddr, resetInfo.depc);
|
||||
sprintf(&buff[0], "Fatal exception:%d flag:%d (%s) epc1:0x%08x epc2:0x%08x epc3:0x%08x excvaddr:0x%08x depc:0x%08x", resetInfo.exccause, resetInfo.reason, (resetInfo.reason == 0 ? "DEFAULT" : resetInfo.reason == 1 ? "WDT" : resetInfo.reason == 2 ? "EXCEPTION" : resetInfo.reason == 3 ? "SOFT_WDT" : resetInfo.reason == 4 ? "SOFT_RESTART" : resetInfo.reason == 5 ? "DEEP_SLEEP_AWAKE" : resetInfo.reason == 6 ? "EXT_SYS_RST" : "???"), resetInfo.epc1, resetInfo.epc2, resetInfo.epc3, resetInfo.excvaddr, resetInfo.depc);
|
||||
return String(buff);
|
||||
}
|
||||
return String("flag: 0");
|
||||
|
@ -290,6 +290,7 @@ uart_t* uart_init(int uart_nr, int baudrate, byte config, byte mode) {
|
||||
uart->txPin = (uart->txEnabled)?1:255;
|
||||
if(uart->rxEnabled) pinMode(uart->rxPin, SPECIAL);
|
||||
if(uart->txEnabled) pinMode(uart->txPin, SPECIAL);
|
||||
IOSWAP &= ~(1 << IOSWAPU0);
|
||||
break;
|
||||
case UART1:
|
||||
uart->rxEnabled = false;
|
||||
|
@ -221,13 +221,9 @@ public:
|
||||
: _fs(fs)
|
||||
, _fd(fd)
|
||||
, _stat({0})
|
||||
, _written(false)
|
||||
{
|
||||
CHECKFD();
|
||||
auto rc = SPIFFS_fstat(_fs->getFs(), _fd, &_stat);
|
||||
if (rc != SPIFFS_OK) {
|
||||
DEBUGV("SPIFFS_fstat rc=%d\r\n", rc);
|
||||
_stat = {0};
|
||||
}
|
||||
_getStat();
|
||||
}
|
||||
|
||||
~SPIFFSFileImpl() override {
|
||||
@ -242,7 +238,7 @@ public:
|
||||
DEBUGV("SPIFFS_write rc=%d\r\n", result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
_written = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -265,11 +261,16 @@ public:
|
||||
if (rc < 0) {
|
||||
DEBUGV("SPIFFS_fflush rc=%d\r\n", rc);
|
||||
}
|
||||
_written = true;
|
||||
}
|
||||
|
||||
bool seek(uint32_t pos, SeekMode mode) override {
|
||||
CHECKFD();
|
||||
|
||||
int32_t offset = static_cast<int32_t>(pos);
|
||||
if (mode == SeekEnd) {
|
||||
offset = -offset;
|
||||
}
|
||||
auto rc = SPIFFS_lseek(_fs->getFs(), _fd, pos, (int) mode);
|
||||
if (rc < 0) {
|
||||
DEBUGV("SPIFFS_lseek rc=%d\r\n", rc);
|
||||
@ -293,7 +294,9 @@ public:
|
||||
|
||||
size_t size() const override {
|
||||
CHECKFD();
|
||||
|
||||
if (_written) {
|
||||
_getStat();
|
||||
}
|
||||
return _stat.size;
|
||||
}
|
||||
|
||||
@ -311,15 +314,27 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void _getStat() const{
|
||||
CHECKFD();
|
||||
auto rc = SPIFFS_fstat(_fs->getFs(), _fd, &_stat);
|
||||
if (rc != SPIFFS_OK) {
|
||||
DEBUGV("SPIFFS_fstat rc=%d\r\n", rc);
|
||||
_stat = {0};
|
||||
}
|
||||
_written = false;
|
||||
}
|
||||
|
||||
SPIFFSImpl* _fs;
|
||||
spiffs_file _fd;
|
||||
spiffs_stat _stat;
|
||||
mutable spiffs_stat _stat;
|
||||
mutable bool _written;
|
||||
};
|
||||
|
||||
class SPIFFSDirImpl : public DirImpl {
|
||||
public:
|
||||
SPIFFSDirImpl(SPIFFSImpl* fs, spiffs_DIR& dir)
|
||||
: _fs(fs)
|
||||
SPIFFSDirImpl(const String& pattern, SPIFFSImpl* fs, spiffs_DIR& dir)
|
||||
: _pattern(pattern)
|
||||
, _fs(fs)
|
||||
, _dir(dir)
|
||||
, _valid(false)
|
||||
{
|
||||
@ -359,12 +374,16 @@ public:
|
||||
}
|
||||
|
||||
bool next() override {
|
||||
spiffs_dirent* result = SPIFFS_readdir(&_dir, &_dirent);
|
||||
_valid = (result != nullptr);
|
||||
const int n = _pattern.length();
|
||||
do {
|
||||
spiffs_dirent* result = SPIFFS_readdir(&_dir, &_dirent);
|
||||
_valid = (result != nullptr);
|
||||
} while(_valid && strncmp((const char*) _dirent.name, _pattern.c_str(), n) != 0);
|
||||
return _valid;
|
||||
}
|
||||
|
||||
protected:
|
||||
String _pattern;
|
||||
SPIFFSImpl* _fs;
|
||||
spiffs_DIR _dir;
|
||||
spiffs_dirent _dirent;
|
||||
@ -394,7 +413,7 @@ DirImplPtr SPIFFSImpl::openDir(const char* path) {
|
||||
DEBUGV("SPIFFSImpl::openDir: path=`%s` err=%d\r\n", path, _fs.err_code);
|
||||
return DirImplPtr();
|
||||
}
|
||||
return std::make_shared<SPIFFSDirImpl>(this, dir);
|
||||
return std::make_shared<SPIFFSDirImpl>(path, this, dir);
|
||||
}
|
||||
|
||||
int getSpiffsMode(OpenMode openMode, AccessMode accessMode) {
|
||||
|
@ -48,6 +48,9 @@ int32_t spiffs_hal_read(uint32_t addr, uint32_t size, uint8_t *dst) {
|
||||
uint32_t result = SPIFFS_OK;
|
||||
uint32_t alignedBegin = (addr + 3) & (~3);
|
||||
uint32_t alignedEnd = (addr + size) & (~3);
|
||||
if (alignedEnd < alignedBegin) {
|
||||
alignedEnd = alignedBegin;
|
||||
}
|
||||
|
||||
if (addr < alignedBegin) {
|
||||
uint32_t nb = alignedBegin - addr;
|
||||
@ -101,6 +104,9 @@ int32_t spiffs_hal_write(uint32_t addr, uint32_t size, uint8_t *src) {
|
||||
|
||||
uint32_t alignedBegin = (addr + 3) & (~3);
|
||||
uint32_t alignedEnd = (addr + size) & (~3);
|
||||
if (alignedEnd < alignedBegin) {
|
||||
alignedEnd = alignedBegin;
|
||||
}
|
||||
|
||||
if (addr < alignedBegin) {
|
||||
uint32_t nb = alignedBegin - addr;
|
||||
|
@ -121,12 +121,12 @@ Generic module | 512k | 64k
|
||||
Generic module | 1M | 64k, 128k, 256k, 512k
|
||||
Generic module | 2M | 1M
|
||||
Generic module | 4M | 3M
|
||||
Adafruit HUZZAH | 4M | 3M
|
||||
NodeMCU 0.9 | 4M | 3M
|
||||
NodeMCU 1.0 | 4M | 3M
|
||||
Adafruit HUZZAH | 4M | 1M, 3M
|
||||
NodeMCU 0.9 | 4M | 1M, 3M
|
||||
NodeMCU 1.0 | 4M | 1M, 3M
|
||||
Olimex MOD-WIFI-ESP8266(-DEV)| 2M | 1M
|
||||
SparkFun Thing | 512k | 64k
|
||||
SweetPea ESP-210 | 4M | 3M
|
||||
SweetPea ESP-210 | 4M | 1M, 3M
|
||||
|
||||
**Note:** to use any of file system functions in the sketch, add the following include to the sketch:
|
||||
|
||||
@ -134,6 +134,21 @@ SweetPea ESP-210 | 4M | 3M
|
||||
#include "FS.h"
|
||||
```
|
||||
|
||||
### Uploading files to file system
|
||||
|
||||
*ESP8266FS* is a tool which integrates into the Arduino IDE. It adds a menu item to *Tools* menu for uploading the contents of sketch data directory into ESP8266 flash file system.
|
||||
|
||||
- Download the tool: http://arduino.esp8266.com/ESP8266FS-1.6.5-1092-g6c7557b.zip
|
||||
- In your Arduino sketchbook directory, create `tools` directory if it doesn't exist yet
|
||||
- Unpack the tool into `tools` directory (the path will look like `<home_dir>/Arduino/tools/ESP8266FS/tool/esp8266fs.jar`)
|
||||
- Restart Arduino IDE
|
||||
- Open a sketch (or create a new one and save it)
|
||||
- Go to sketch directory (choose Sketch > Show Sketch Folder)
|
||||
- Create a directory named `data` and any files you want in the file system there
|
||||
- Make sure you have selected a board, port, and closed Serial Monitor
|
||||
- Select Tools > ESP8266 Sketch Data Upload. This should start uploading the files into ESP8266 flash file system. When done, IDE status bar will display `SPIFFS Image Uploaded` message.
|
||||
|
||||
|
||||
### File system object (SPIFFS)
|
||||
|
||||
#### begin
|
||||
|
@ -2,8 +2,6 @@
|
||||
#include <lwip/def.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#define DEBUG
|
||||
#define DEBUG_OUTPUT Serial
|
||||
|
||||
DNSServer::DNSServer()
|
||||
{
|
||||
|
@ -43,10 +43,11 @@ extern "C" void esp_yield();
|
||||
ESP8266WiFiClass::ESP8266WiFiClass()
|
||||
: _smartConfigStarted(false)
|
||||
, _smartConfigDone(false)
|
||||
, _useApMode(false)
|
||||
, _useClientMode(false)
|
||||
, _useStaticIp(false)
|
||||
{
|
||||
uint8 m = wifi_get_opmode();
|
||||
_useClientMode = (m & WIFI_STA);
|
||||
_useApMode = (m & WIFI_AP_STA);
|
||||
wifi_set_event_handler_cb((wifi_event_handler_cb_t)&ESP8266WiFiClass::_eventCallback);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user