授人以鱼不如授人以渔,目的不是为了教会你具体项目开发,而是学会学习的能力。但愿你们分享给你周边须要的朋友或者同窗,说不定大神成长之路有博哥的奠定石。。。php
QQ技术互动交流群:ESP8266&32 物联网开发 群号622368884,不喜勿喷node
1、基础篇linux
2、网络篇c++
- ESP8266开发之旅 网络篇① 认识一下Arduino Core For ESP8266
- ESP8266开发之旅 网络篇② ESP8266 工做模式与ESP8266WiFi库
- ESP8266开发之旅 网络篇③ Soft-AP——ESP8266WiFiAP库的使用
- ESP8266开发之旅 网络篇④ Station——ESP8266WiFiSTA库的使用
- ESP8266开发之旅 网络篇⑤ Scan WiFi——ESP8266WiFiScan库的使用
- ESP8266开发之旅 网络篇⑥ ESP8266WiFiGeneric——基础库
- ESP8266开发之旅 网络篇⑦ TCP Server & TCP Client
- ESP8266开发之旅 网络篇⑧ SmartConfig——一键配网
- ESP8266开发之旅 网络篇⑨ HttpClient——ESP8266HTTPClient库的使用
- ESP8266开发之旅 网络篇⑩ UDP服务
- ESP8266开发之旅 网络篇⑪ WebServer——ESP8266WebServer库的使用
- ESP8266开发之旅 网络篇⑫ 域名服务——ESP8266mDNS库
- ESP8266开发之旅 网络篇⑬ SPIFFS——ESP8266 Flash文件系统
- ESP8266开发之旅 网络篇⑭ web配网
- ESP8266开发之旅 网络篇⑮ 真正的域名服务——DNSServer
- ESP8266开发之旅 网络篇⑯ 无线更新——OTA固件更新
3、应用篇git
4、高级篇github
在学习ESP8266开发的过程当中,不少初学开发者很容易出现如下几种问题:web
归根到底,就是初学者不理解各个编译选项的含义,很容易选择错误的配置选项。因此,博主将在本篇讲解一下Arduino IDE For ESP8266烧录配置。redis
要想知道烧录配置所处的位置以及做用,先来看看博主理解的烧录配置,请看下图:macos
能够看出:bootstrap
这里就是咱们开发者须要了解的编译配置,能够看到分别有:
接下来博主会仔细讲解里面具体的用法。
注意:博主建议学习这篇的时候,请打开ArduinoIDE
表示咱们代码最终烧录的目标板子,目前支持以下:
( 'generic', { 'name': 'Generic ESP8266 Module', 'opts': { '.build.board': 'ESP8266_GENERIC', }, 'macro': [ 'resetmethod_menu', 'resetmethod_menu_extra', 'crystalfreq_menu', 'flashfreq_menu', 'flashmode_menu', '512K', '1M', '2M', '4M', '8M', '16M', 'led', ], 'desc': [ 'These modules come in different form factors and pinouts. See the page at ESP8266 community wiki for more info: `ESP8266 Module Family <http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family>`__.', '', 'Usually these modules have no bootstapping resistors on board, insufficient decoupling capacitors, no voltage regulator, no reset circuit, and no USB-serial adapter. This makes using them somewhat tricky, compared to development boards which add these features.', '', 'In order to use these modules, make sure to observe the following:', '', '- **Provide sufficient power to the module.** For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. Using the power available from USB to Serial adapter is not recommended, these adapters typically do not supply enough current to run ESP8266 reliably in every situation. An external supply or regulator alongwith filtering capacitors is preferred.', '', '- **Connect bootstapping resistors** to GPIO0, GPIO2, GPIO15 according to the schematics below.', '', '- **Put ESP8266 into bootloader mode** before uploading code.', '', 'Serial Adapter', '--------------', '', 'There are many different USB to Serial adapters / boards. To be able to put ESP8266 into bootloader mode using serial handshaking lines, you need the adapter which breaks out RTS and DTR outputs. CTS and DSR are not useful for upload (they are inputs). Make sure the adapter can work with 3.3V IO voltage: it should have a jumper or a switch to select between 5V and 3.3V, or be marked as 3.3V only.', '', 'Adapters based around the following ICs should work:', '', '- FT232RL', '- CP2102', '- CH340G', '', 'PL2303-based adapters are known not to work on Mac OS X. See https://github.com/igrr/esptool-ck/issues/9 for more info.', '', 'Minimal Hardware Setup for Bootloading and Usage', '------------------------------------------------', '', '+-----------------+------------+------------------+', '| PIN | Resistor | Serial Adapter |', '+=================+============+==================+', '| VCC | | VCC (3.3V) |', '+-----------------+------------+------------------+', '| GND | | GND |', '+-----------------+------------+------------------+', '| TX or GPIO2\* | | RX |', '+-----------------+------------+------------------+', '| RX | | TX |', '+-----------------+------------+------------------+', '| GPIO0 | PullUp | DTR |', '+-----------------+------------+------------------+', '| Reset\* | PullUp | RTS |', '+-----------------+------------+------------------+', '| GPIO15\* | PullDown | |', '+-----------------+------------+------------------+', '| CH\_PD | PullUp | |', '+-----------------+------------+------------------+', '', '- Note', '- GPIO15 is also named MTDO', '- Reset is also named RSBT or REST (adding PullUp improves the', ' stability of the module)', '- GPIO2 is alternative TX for the boot loader mode', '- **Directly connecting a pin to VCC or GND is not a substitute for a', ' PullUp or PullDown resistor, doing this can break upload management', ' and the serial console, instability has also been noted in some', ' cases.**', '', 'ESP to Serial', '-------------', '', '.. figure:: ESP_to_serial.png', ' :alt: ESP to Serial', '', ' ESP to Serial', '', 'Minimal Hardware Setup for Bootloading only', '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~', '', 'ESPxx Hardware', '', '+---------------+------------+------------------+', '| PIN | Resistor | Serial Adapter |', '+===============+============+==================+', '| VCC | | VCC (3.3V) |', '+---------------+------------+------------------+', '| GND | | GND |', '+---------------+------------+------------------+', '| TX or GPIO2 | | RX |', '+---------------+------------+------------------+', '| RX | | TX |', '+---------------+------------+------------------+', '| GPIO0 | | GND |', '+---------------+------------+------------------+', '| Reset | | RTS\* |', '+---------------+------------+------------------+', '| GPIO15 | PullDown | |', '+---------------+------------+------------------+', '| CH\_PD | PullUp | |', '+---------------+------------+------------------+', '', '- Note', '- if no RTS is used a manual power toggle is needed', '', 'Minimal Hardware Setup for Running only', '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~', '', 'ESPxx Hardware', '', '+----------+------------+----------------+', '| PIN | Resistor | Power supply |', '+==========+============+================+', '| VCC | | VCC (3.3V) |', '+----------+------------+----------------+', '| GND | | GND |', '+----------+------------+----------------+', '| GPIO0 | PullUp | |', '+----------+------------+----------------+', '| GPIO15 | PullDown | |', '+----------+------------+----------------+', '| CH\_PD | PullUp | |', '+----------+------------+----------------+', '', 'Minimal', '-------', '', '.. figure:: ESP_min.png', ' :alt: ESP min', '', ' ESP min', '', 'Improved Stability', '------------------', '', '.. figure:: ESP_improved_stability.png', ' :alt: ESP improved stability', '', ' ESP improved stability', '', 'Boot Messages and Modes', '-----------------------', '', 'The ESP module checks at every boot the Pins 0, 2 and 15. based on them its boots in different modes:', '', '+----------+---------+---------+------------------------------------+', '| GPIO15 | GPIO0 | GPIO2 | Mode |', '+==========+=========+=========+====================================+', '| 0V | 0V | 3.3V | Uart Bootloader |', '+----------+---------+---------+------------------------------------+', '| 0V | 3.3V | 3.3V | Boot sketch (SPI flash) |', '+----------+---------+---------+------------------------------------+', '| 3.3V | x | x | SDIO mode (not used for Arduino) |', '+----------+---------+---------+------------------------------------+', '', 'at startup the ESP prints out the current boot mode example:', '', '::', '', ' rst cause:2, boot mode:(3,6)', '', 'note: - GPIO2 is used as TX output and the internal Pullup is enabled on boot.', '', 'rst cause', '~~~~~~~~~', '', '+----------+------------------+', '| Number | Description |', '+==========+==================+', '| 0 | unknown |', '+----------+------------------+', '| 1 | normal boot |', '+----------+------------------+', '| 2 | reset pin |', '+----------+------------------+', '| 3 | software reset |', '+----------+------------------+', '| 4 | watchdog reset |', '+----------+------------------+', '', 'boot mode', '~~~~~~~~~', '', 'the first value respects the pin setup of the Pins 0, 2 and 15.', '', '+----------+----------+---------+---------+-------------+', '| Number | GPIO15 | GPIO0 | GPIO2 | Mode |', '+==========+==========+=========+=========+=============+', '| 0 | 0V | 0V | 0V | Not valid |', '+----------+----------+---------+---------+-------------+', '| 1 | 0V | 0V | 3.3V | Uart |', '+----------+----------+---------+---------+-------------+', '| 2 | 0V | 3.3V | 0V | Not valid |', '+----------+----------+---------+---------+-------------+', '| 3 | 0V | 3.3V | 3.3V | Flash |', '+----------+----------+---------+---------+-------------+', '| 4 | 3.3V | 0V | 0V | SDIO |', '+----------+----------+---------+---------+-------------+', '| 5 | 3.3V | 0V | 3.3V | SDIO |', '+----------+----------+---------+---------+-------------+', '| 6 | 3.3V | 3.3V | 0V | SDIO |', '+----------+----------+---------+---------+-------------+', '| 7 | 3.3V | 3.3V | 3.3V | SDIO |', '+----------+----------+---------+---------+-------------+', '', 'note: - number = ((GPIO15 << 2) \| (GPIO0 << 1) \| GPIO2);', ], })
( 'esp8285', { 'name': 'Generic ESP8285 Module', 'opts': { '.build.board': 'ESP8266_ESP01', }, 'macro': [ 'resetmethod_menu', 'resetmethod_menu_extra', 'crystalfreq_menu', 'flashmode_dout', 'flashfreq_40', '1M', 'led', ], 'desc': [ 'ESP8285 (`datasheet <http://www.espressif.com/sites/default/files/0a-esp8285_datasheet_en_v1.0_20160422.pdf>`__) is a multi-chip package which contains ESP8266 and 1MB flash. All points related to bootstrapping resistors and recommended circuits listed above apply to ESP8285 as well.', '', 'Note that since ESP8285 has SPI flash memory internally connected in DOUT mode, pins 9 and 10 may be used as GPIO / I2C / PWM pins.', ], })
( 'espduino', { 'name': 'ESPDuino (ESP-13 Module)', 'opts': collections.OrderedDict([ ( '.build.board', 'ESP8266_ESP13' ), ( '.build.variant', 'ESPDuino' ), ( '.menu.ResetMethod.v2', 'ESPduino-V2' ), ( '.menu.ResetMethod.v2.upload.resetmethod', 'nodemcu' ), ( '.menu.ResetMethod.v1', 'ESPduino-V1' ), ( '.menu.ResetMethod.v1.upload.resetmethod', 'ck' ), ( '.menu.UploadTool.esptool', 'Serial' ), ( '.menu.UploadTool.esptool.upload.tool', 'esptool' ), ( '.menu.UploadTool.esptool.upload.verbose', '-vv' ), ( '.menu.UploadTool.espota', 'OTA' ), ( '.menu.UploadTool.espota.upload.tool', 'espota' ), ]), 'macro': [ 'flashmode_dio', 'flashfreq_40', '4M', ], 'desc': [ '*TODO*' ], })
( 'nodemcu', { 'name': 'NodeMCU 0.9 (ESP-12 Module)', 'opts': { '.build.board': 'ESP8266_NODEMCU', '.build.variant': 'nodemcu', }, 'macro': [ 'resetmethod_nodemcu', 'flashmode_qio', 'flashfreq_40', '4M', ], 'desc': [ 'Pin mapping', '~~~~~~~~~~~', '', 'Pin numbers written on the board itself do not correspond to ESP8266 GPIO pin numbers. Constants are defined to make using this board easier:', '', '.. code:: c++', '', ' static const uint8_t D0 = 16;', ' static const uint8_t D1 = 5;', ' static const uint8_t D2 = 4;', ' static const uint8_t D3 = 0;', ' static const uint8_t D4 = 2;', ' static const uint8_t D5 = 14;', ' static const uint8_t D6 = 12;', ' static const uint8_t D7 = 13;', ' static const uint8_t D8 = 15;', ' static const uint8_t D9 = 3;', ' static const uint8_t D10 = 1;', '', 'If you want to use NodeMCU pin 5, use D5 for pin number, and it will be translated to \'real\' GPIO pin 14.', ], })
能够看出,NodeMcu 0.9 flashmode是qio,这个须要注意一下;
( 'nodemcuv2', { 'name': 'NodeMCU 1.0 (ESP-12E Module)', 'opts': { '.build.board': 'ESP8266_NODEMCU', '.build.variant': 'nodemcu', }, 'macro': [ 'resetmethod_nodemcu', 'flashmode_dio', 'flashfreq_40', '4M', ], 'desc': [ 'This module is sold under many names for around $6.50 on AliExpress and it\'s one of the cheapest, fully integrated ESP8266 solutions.', '', 'It\'s an open hardware design with an ESP-12E core and 4 MB of SPI flash.', '', 'According to the manufacturer, "with a micro USB cable, you can connect NodeMCU devkit to your laptop and flash it without any trouble". This is more or less true: the board comes with a CP2102 onboard USB to serial adapter which just works, well, the majority of the time. Sometimes flashing fails and you have to reset the board by holding down FLASH +', 'RST, then releasing FLASH, then releasing RST. This forces the CP2102 device to power cycle and to be re-numbered by Linux.', '', 'The board also features a NCP1117 voltage regulator, a blue LED on GPIO16 and a 220k/100k Ohm voltage divider on the ADC input pin.', 'The ESP-12E usually has a led connected on GPIO2.', '', 'Full pinout and PDF schematics can be found `here <https://github.com/nodemcu/nodemcu-devkit-v1.0>`__', ], })
能够看出,NodeMcu 1.0 flashmode是dio,这个须要注意一下;
( 'd1', { 'name': 'WeMos D1 R1', 'opts': { '.build.board': 'ESP8266_WEMOS_D1R1', '.build.variant': 'd1', }, 'macro': [ 'resetmethod_nodemcu', 'flashmode_dio', 'flashfreq_40', '4M', ], 'serial': '921', 'desc': [ 'Product page: https://www.wemos.cc/' ], })
( 'wifiduino', { 'name': 'WiFiduino', 'opts': { '.build.board': 'WIFIDUINO_ESP8266', '.build.variant': 'wifiduino', }, 'macro': [ 'resetmethod_nodemcu', 'flashmode_dio', 'flashfreq_40', '4M', ], 'serial': '921', 'desc': [ 'Product page: https://wifiduino.com/esp8266' ], })
博主建议,尽可能用对应开发板,好比咱们经常使用NodeMcu。若是具体开发板不知足要求,再去考虑Generic ESP8266 或者Generic ESP8285。
####################### serial 's9': collections.OrderedDict([ ( '.menu.UploadSpeed.9600', '9600' ), ( '.menu.UploadSpeed.9600.upload.speed', '9600' ), ]), 's57': collections.OrderedDict([ ( '.menu.UploadSpeed.57600', '57600' ), ( '.menu.UploadSpeed.57600.upload.speed', '57600' ), ]), 's115': collections.OrderedDict([ ( '.menu.UploadSpeed.115200', '115200' ), ( '.menu.UploadSpeed.115200.upload.speed', '115200' ), ]), 's256': collections.OrderedDict([ ( '.menu.UploadSpeed.256000.windows', '256000' ), ( '.menu.UploadSpeed.256000.upload.speed', '256000' ), ]), 's230': collections.OrderedDict([ ( '.menu.UploadSpeed.230400.linux', '230400' ), ( '.menu.UploadSpeed.230400.macosx', '230400' ), ( '.menu.UploadSpeed.230400.upload.speed', '230400' ), ]), 's460': collections.OrderedDict([ ( '.menu.UploadSpeed.460800.linux', '460800' ), ( '.menu.UploadSpeed.460800.macosx', '460800' ), ( '.menu.UploadSpeed.460800.upload.speed', '460800' ), ]), 's512': collections.OrderedDict([ ( '.menu.UploadSpeed.512000.windows', '512000' ), ( '.menu.UploadSpeed.512000.upload.speed', '512000' ), ]), 's921': collections.OrderedDict([ ( '.menu.UploadSpeed.921600', '921600' ), ( '.menu.UploadSpeed.921600.upload.speed', '921600' ), ]),
注意,根据目标板的不一样,不必定会存在上面全部的数值选项。
'cpufreq_menu': collections.OrderedDict([ ( '.menu.CpuFrequency.80', '80 MHz' ), ( '.menu.CpuFrequency.80.build.f_cpu', '80000000L' ), ( '.menu.CpuFrequency.160', '160 MHz' ), ( '.menu.CpuFrequency.160.build.f_cpu', '160000000L' ), ]),
'crystalfreq_menu': collections.OrderedDict([ ( '.menu.CrystalFreq.26', '26 MHz' ), ( '.menu.CrystalFreq.40', '40 MHz' ), ( '.menu.CrystalFreq.40.build.extra_flags', '-DF_CRYSTAL=40000000 -DESP8266' ), ]),
设置目标板子的flash大小。
f512 = flash_size(0x80000, '512K', '512K0', 'eagle.flash.512k0.ld', 'no SPIFFS', 499696, 0x7B000) f512.update(flash_size(0x80000, '512K', '512K32', 'eagle.flash.512k32.ld', '32K SPIFFS', 466928, 0x73000, 0x8000, 4096)) f512.update(flash_size(0x80000, '512K', '512K64', 'eagle.flash.512k64.ld', '64K SPIFFS', 434160, 0x6B000, 0x10000, 4096)) f512.update(flash_size(0x80000, '512K', '512K128', 'eagle.flash.512k128.ld', '128K SPIFFS', 368624, 0x5B000, 0x20000, 4096)) f1m = flash_size(0x100000, '1M', '1M0', 'eagle.flash.1m0.ld', 'no SPIFFS', 1023984, 0xFB000) f1m.update( flash_size(0x100000, '1M', '1M64', 'eagle.flash.1m64.ld', '64K SPIFFS', 958448, 0xEB000, 0x10000, 4096)) f1m.update( flash_size(0x100000, '1M', '1M128', 'eagle.flash.1m128.ld', '128K SPIFFS', 892912, 0xDB000, 0x20000, 4096)) f1m.update( flash_size(0x100000, '1M', '1M144', 'eagle.flash.1m144.ld', '144K SPIFFS', 876528, 0xD7000, 0x24000, 4096)) f1m.update( flash_size(0x100000, '1M', '1M160', 'eagle.flash.1m160.ld', '160K SPIFFS', 860144, 0xD3000, 0x28000, 4096)) f1m.update( flash_size(0x100000, '1M', '1M192', 'eagle.flash.1m192.ld', '192K SPIFFS', 827376, 0xCB000, 0x30000, 4096)) f1m.update( flash_size(0x100000, '1M', '1M256', 'eagle.flash.1m256.ld', '256K SPIFFS', 761840, 0xBB000, 0x40000, 4096)) f1m.update( flash_size(0x100000, '1M', '1M512', 'eagle.flash.1m512.ld', '512K SPIFFS', 499696, 0x7B000, 0x80000, 8192)) f2m = flash_size(0x200000, '2M', '2M', 'eagle.flash.2m.ld', '1M SPIFFS', 1044464, 0x100000, 0xFB000, 8192) f4m = flash_size(0x400000, '4M', '4M1M', 'eagle.flash.4m1m.ld', '1M SPIFFS', 1044464, 0x300000, 0xFB000, 8192) f4m.update( flash_size(0x400000, '4M', '4M2M', 'eagle.flash.4m2m.ld', '2M SPIFFS', 1044464, 0x200000, 0x1FB000, 8192)) f4m.update( flash_size(0x400000, '4M', '4M3M', 'eagle.flash.4m.ld', '3M SPIFFS', 1044464, 0x100000, 0x2FB000, 8192)) f8m = flash_size(0x800000, '8M', '8M7M', 'eagle.flash.8m.ld', '7M SPIFFS', 1044464, 0x100000, 0x6FB000, 8192) f16m = flash_size(0x1000000, '16M', '16M15M', 'eagle.flash.16m.ld', '15M SPIFFS', 1044464, 0x100000, 0xEFB000, 8192)
系统会根据咱们选择的flashsize而后找到对应的flash映射文件。好比,咱们选择了1M 256K SPIFFS,那么系统就会找到 eagle.flash.1m256.ld文件,而后映射里面对应的flash地址。
/* Flash Split for 1M chips */ /* sketch 743KB */ /* spiffs 256KB */ /* eeprom 20KB */ MEMORY { dport0_0_seg : org = 0x3FF00000, len = 0x10 dram0_0_seg : org = 0x3FFE8000, len = 0x14000 iram1_0_seg : org = 0x40100000, len = 0x8000 irom0_0_seg : org = 0x40201010, len = 0xb9ff0 } PROVIDE ( _SPIFFS_start = 0x402BB000 ); PROVIDE ( _SPIFFS_end = 0x402FB000 ); PROVIDE ( _SPIFFS_page = 0x100 ); PROVIDE ( _SPIFFS_block = 0x1000 ); INCLUDE "eagle.app.v6.common.ld"
设置flash传输模式。
####################### menu.FlashMode 'flashmode_menu': collections.OrderedDict([ ( '.menu.FlashMode.qio', 'QIO' ), ( '.menu.FlashMode.qio.build.flash_mode', 'qio' ), ( '.menu.FlashMode.qout', 'QOUT' ), ( '.menu.FlashMode.qout.build.flash_mode', 'qout' ), ( '.menu.FlashMode.dio', 'DIO' ), ( '.menu.FlashMode.dio.build.flash_mode', 'dio' ), ( '.menu.FlashMode.dout', 'DOUT' ), ( '.menu.FlashMode.dout.build.flash_mode', 'dout' ), ]), ####################### default flash_mode 'flashmode_dio': collections.OrderedDict([ ( '.build.flash_mode', 'dio' ), ]), 'flashmode_qio': collections.OrderedDict([ ( '.build.flash_mode', 'qio' ), ]), 'flashmode_dout': collections.OrderedDict([ ( '.build.flash_mode', 'dout' ), ]), 'flashmode_qout': collections.OrderedDict([ ( '.build.flash_mode', 'qout' ), ]),
那么它们之间的区别在哪里呢?
1)QIO , for flash that support quad r/w operation(e.g. W25Q flash芯片)
2)QOUT, for flash that support quad read operation(e.g. W25Q flash芯片)
3)DIO, for flash that support dual r/w operation(e.g. W25Q &W25X flash芯片)
4)DOUT, for flash that support dual read operation(e.g. W25Q &W25X flash芯片)
它们之间的区别能够简单理解为传输速率的区别,quad是四倍传输速率,dual是两倍传输速率。
经测试:
Winbond 25Q32B 可工做于 DIO / DOUT / QIO /QOUT (Noduino Falcon);
BergMicro 25Q32A 只可工做于 DIO / DOUT (NodeMCU V1.0 多是 ESP-12E 接线的问题);
MXIC 25L80 (小 K mini)只可工做于 DOUT;
注意:
这一点是不少初学者容易忽略的地方,有时候烧写失败或者烧写成功可是显示一堆乱码,每每就是flashmode引发的,这一点须要特别注意。
flash的运行频率,通常有40MHz或者80MHz,默认是40MHz。
'flashfreq_menu': collections.OrderedDict([ ( '.menu.FlashFreq.40', '40MHz' ), ( '.menu.FlashFreq.40.build.flash_freq', '40' ), ( '.menu.FlashFreq.80', '80MHz' ), ( '.menu.FlashFreq.80.build.flash_freq', '80' ), ]), 'flashfreq_40': collections.OrderedDict([ ( '.build.flash_freq', '40' ), ]), 'flashfreq_80': collections.OrderedDict([ ( '.build.flash_freq', '80' ), ]),
模块重启方法。通常选择ck,nodemcu选择nodemcu。
####################### menu.resetmethod 'resetmethod_menu': collections.OrderedDict([ ( '.menu.ResetMethod.ck', 'ck' ), ( '.menu.ResetMethod.ck.upload.resetmethod', 'ck' ), ( '.menu.ResetMethod.nodemcu', 'nodemcu' ), ( '.menu.ResetMethod.nodemcu.upload.resetmethod', 'nodemcu' ), ]), 'resetmethod_menu_extra': collections.OrderedDict([ ( '.menu.ResetMethod.none', 'none' ), ( '.menu.ResetMethod.none.upload.resetmethod', 'none' ), ( '.menu.ResetMethod.dtrset', 'dtrset' ), ( '.menu.ResetMethod.dtrset.upload.resetmethod', 'dtrset' ), ]), ####################### upload.resetmethod 'resetmethod_ck': collections.OrderedDict([ ( '.upload.resetmethod', 'ck' ), ]), 'resetmethod_nodemcu': collections.OrderedDict([ ( '.upload.resetmethod', 'nodemcu' ), ]), 'resetmethod_none': collections.OrderedDict([ ( '.upload.resetmethod', 'none' ), ]), 'resetmethod_dtrset': collections.OrderedDict([ ( '.upload.resetmethod', 'dtrset' ), ]),
设置调试信息打印串口端口,disabled表示不打印。有如下选项:
generic.menu.Debug.Disabled=Disabled generic.menu.Debug.Disabled.build.debug_port= generic.menu.Debug.Serial=Serial generic.menu.Debug.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial generic.menu.Debug.Serial1=Serial1 generic.menu.Debug.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1
设置调试信息打印,用于开启须要打印哪些调试信息。常见选项以下:
generic.menu.DebugLevel.None____=None generic.menu.DebugLevel.None____.build.debug_level= generic.menu.DebugLevel.SSL=SSL generic.menu.DebugLevel.SSL.build.debug_level= -DDEBUG_ESP_SSL generic.menu.DebugLevel.TLS_MEM=TLS_MEM generic.menu.DebugLevel.TLS_MEM.build.debug_level= -DDEBUG_ESP_TLS_MEM generic.menu.DebugLevel.HTTP_CLIENT=HTTP_CLIENT generic.menu.DebugLevel.HTTP_CLIENT.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT generic.menu.DebugLevel.HTTP_SERVER=HTTP_SERVER generic.menu.DebugLevel.HTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_SERVER generic.menu.DebugLevel.SSLTLS_MEM=SSL+TLS_MEM generic.menu.DebugLevel.SSLTLS_MEM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM generic.menu.DebugLevel.SSLHTTP_CLIENT=SSL+HTTP_CLIENT generic.menu.DebugLevel.SSLHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT generic.menu.DebugLevel.SSLHTTP_SERVER=SSL+HTTP_SERVER generic.menu.DebugLevel.SSLHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_SERVER generic.menu.DebugLevel.TLS_MEMHTTP_CLIENT=TLS_MEM+HTTP_CLIENT generic.menu.DebugLevel.TLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT generic.menu.DebugLevel.TLS_MEMHTTP_SERVER=TLS_MEM+HTTP_SERVER generic.menu.DebugLevel.TLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER generic.menu.DebugLevel.HTTP_CLIENTHTTP_SERVER=HTTP_CLIENT+HTTP_SERVER generic.menu.DebugLevel.HTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER generic.menu.DebugLevel.SSLTLS_MEMHTTP_CLIENT=SSL+TLS_MEM+HTTP_CLIENT generic.menu.DebugLevel.SSLTLS_MEMHTTP_CLIENT.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT generic.menu.DebugLevel.SSLTLS_MEMHTTP_SERVER=SSL+TLS_MEM+HTTP_SERVER generic.menu.DebugLevel.SSLTLS_MEMHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_SERVER generic.menu.DebugLevel.SSLHTTP_CLIENTHTTP_SERVER=SSL+HTTP_CLIENT+HTTP_SERVER generic.menu.DebugLevel.SSLHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER generic.menu.DebugLevel.TLS_MEMHTTP_CLIENTHTTP_SERVER=TLS_MEM+HTTP_CLIENT+HTTP_SERVER generic.menu.DebugLevel.TLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER generic.menu.DebugLevel.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER generic.menu.DebugLevel.SSLTLS_MEMHTTP_CLIENTHTTP_SERVER.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER generic.menu.DebugLevel.CORE=CORE generic.menu.DebugLevel.CORE.build.debug_level= -DDEBUG_ESP_CORE generic.menu.DebugLevel.WIFI=WIFI generic.menu.DebugLevel.WIFI.build.debug_level= -DDEBUG_ESP_WIFI generic.menu.DebugLevel.HTTP_UPDATE=HTTP_UPDATE generic.menu.DebugLevel.HTTP_UPDATE.build.debug_level= -DDEBUG_ESP_HTTP_UPDATE generic.menu.DebugLevel.UPDATER=UPDATER generic.menu.DebugLevel.UPDATER.build.debug_level= -DDEBUG_ESP_UPDATER generic.menu.DebugLevel.OTA=OTA generic.menu.DebugLevel.OTA.build.debug_level= -DDEBUG_ESP_OTA generic.menu.DebugLevel.OOM=OOM generic.menu.DebugLevel.OOM.build.debug_level= -DDEBUG_ESP_OOM generic.menu.DebugLevel.COREWIFIHTTP_UPDATEUPDATEROTAOOM=CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM generic.menu.DebugLevel.COREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM generic.menu.DebugLevel.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM=SSL+TLS_MEM+HTTP_CLIENT+HTTP_SERVER+CORE+WIFI+HTTP_UPDATE+UPDATER+OTA+OOM generic.menu.DebugLevel.SSLTLS_MEMHTTP_CLIENTHTTP_SERVERCOREWIFIHTTP_UPDATEUPDATEROTAOOM.build.debug_level= -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM generic.menu.DebugLevel.NoAssert-NDEBUG=NoAssert-NDEBUG generic.menu.DebugLevel.NoAssert-NDEBUG.build.debug_level= -DNDEBUG
默认是不开启打印调试信息。
跟网络协议相关,博主不懂,暂时跳过,默认就好;
C++中虚函数链存放位置,默认不改。有如下选项:
'vtable_menu': collections.OrderedDict([ ( '.menu.VTable.flash', 'Flash'), ( '.menu.VTable.flash.build.vtable_flags', '-DVTABLES_IN_FLASH'), ( '.menu.VTable.heap', 'Heap'), ( '.menu.VTable.heap.build.vtable_flags', '-DVTABLES_IN_DRAM'), ( '.menu.VTable.iram', 'IRAM'), ( '.menu.VTable.iram.build.vtable_flags', '-DVTABLES_IN_IRAM'), ]),
博主没有看到这个选项用于什么地方,猜想跟是否抛出异常相关,默认是关闭。
用于设置板载led的引脚位置。咱们能够看看NodeMcu的板载灯设置:
/* pins_arduino.h - Pin definition functions for Arduino Part of Arduino - http://www.arduino.cc/ Copyright (c) 2007 David A. Mellis Modified for ESP8266 platform by Ivan Grokhotkov, 2014-2015. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ */ #ifndef Pins_Arduino_h #define Pins_Arduino_h #define PIN_WIRE_SDA (4) #define PIN_WIRE_SCL (5) static const uint8_t SDA = PIN_WIRE_SDA; static const uint8_t SCL = PIN_WIRE_SCL; #define LED_BUILTIN 16 static const uint8_t D0 = 16; static const uint8_t D1 = 5; static const uint8_t D2 = 4; static const uint8_t D3 = 0; static const uint8_t D4 = 2; static const uint8_t D5 = 14; static const uint8_t D6 = 12; static const uint8_t D7 = 13; static const uint8_t D8 = 15; static const uint8_t D9 = 3; static const uint8_t D10 = 1; #include "../generic/common.h" #endif /* Pins_Arduino_h */
LED_BUILTIN就是板载灯的引脚位置,固然若是咱们想自定义位置,那么就能够经过这个编译选项去配置。
烧写固件时擦除flash的方式,有如下几种选项:
####################### flash erase 'flash_erase_menu': collections.OrderedDict([ ( '.menu.FlashErase.none', 'Only Sketch' ), ( '.menu.FlashErase.none.upload.erase_cmd', '' ), ( '.menu.FlashErase.sdk', 'Sketch + WiFi Settings' ), ( '.menu.FlashErase.sdk.upload.erase_cmd', '-ca "{build.rfcal_addr}" -cz 0x4000' ), ( '.menu.FlashErase.all', 'All Flash Contents' ), ( '.menu.FlashErase.all.upload.erase_cmd', '-ca 0x0 -cz "{build.flash_size_bytes}"' ), ]), }
至于用哪种,得看具体需求,由于清除的内容越多就意味着烧写时间越长。
本篇主要讲解了Arduino IDE For 8266的烧录配置,博主的建议是尽可能找到对应开发板的编译配置(也就是说第一步要确认好目标板),而后实在找不到才考虑上面自定义编译选项去知足需求。