授人以魚不如授人以漁,目的不是爲了教會你具體項目開發,而是學會學習的能力。但願你們分享給你周邊須要的朋友或者同窗,說不定大神成長之路有博哥的奠定石。。。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的燒錄配置,博主的建議是儘可能找到對應開發板的編譯配置(也就是說第一步要確認好目標板),而後實在找不到才考慮上面自定義編譯選項去知足需求。