diff --git a/boards.txt b/boards.txt index dde30c0..f696fe8 100644 --- a/boards.txt +++ b/boards.txt @@ -8,7 +8,111 @@ menu.RomConfig=ROM Config #menu.ResetMethod=Reset Method ############################################################## -oak.name=Oak by Digistump +oak1.name=Oak by Digistump (Pin 1 Safe Mode) + +oak1.upload.tool=oak_ota +oak1.upload.speed=115200 +oak1.upload.resetmethod=ck +oak1.upload.maximum_size=1040368 +oak1.upload.maximum_data_size=81920 +oak1.upload.wait_for_upload_port=false +oak1.serial.disableDTR=true +oak1.serial.disableRTS=true + +oak1.build.mcu=esp8266 +oak1.build.f_cpu=80000000L +oak1.build.board=ESP8266_OAK +oak1.build.core=oak +oak1.build.variant=oak1 +oak1.build.flash_mode=qio +oak1.build.flash_freq=40 +oak1.build.spiffs_pagesize=256 + + +oak1.menu.CpuFrequency.80=80 MHz +oak1.menu.CpuFrequency.80.build.f_cpu=80000000L +oak1.menu.CpuFrequency.160=160 MHz +oak1.menu.CpuFrequency.160.build.f_cpu=160000000L + +oak1.menu.UploadTool.oak_ota=Particle OTA +oak1.menu.UploadTool.oak_ota.upload.tool=oak_ota +oak1.menu.UploadTool.oak_ota.upload.verbose=-vv +oak1.menu.UploadTool.esptool_py=Serial (Expert Use Only - Requires Python) +oak1.menu.UploadTool.esptool_py.upload.tool=esptool_py +oak1.menu.UploadTool.esptool_py.upload.verbose=-vv + +oak1.menu.FlashSize.OAK=OAK (4M/1M SPIFFS) +#this is in megabits - only needed for serial upload +oak1.menu.FlashSize.oak1.build.flash_size=32m +oak1.menu.FlashSize.oak1.build.spiffs_start=0x300000 +oak1.menu.FlashSize.oak1.build.spiffs_end=0x3FB000 +oak1.menu.FlashSize.oak1.build.spiffs_blocksize=8192 +oak1.menu.FlashSize.oak1.build.spiffs_pagesize=256 + +oak1.menu.RomConfig.Full=Single - 1MB (Fullsize) +oak1.menu.RomConfig.Full.build.flash_ld=oak_full.ld +oak1.menu.RomConfig.Full.upload.maximum_size=1040368 +oak1.menu.RomConfig.Full.upload.flash_address=0x0002000 + +#oak1.menu.RomConfig.Half1=First Half - 512KB (Half) +#oak1.menu.RomConfig.Half1.build.flash_ld=oak_half1.ld +#oak1.menu.RomConfig.Half1.upload.maximum_size=520176 +#oak1.menu.RomConfig.Half1.upload.flash_address=0x0002000 + +#oak1.menu.RomConfig.Half2=Second Half - 512KB (Half) +#oak1.menu.RomConfig.Half2.build.flash_ld=oak_half2.ld +#oak1.menu.RomConfig.Half2.upload.maximum_size=520176 +#oak1.menu.RomConfig.Half2.upload.flash_address=0x0081000 + +oak6.name=Oak by Digistump (Pin 6 Safe Mode) + +oak6.upload.tool=oak_ota +oak6.upload.speed=115200 +oak6.upload.resetmethod=ck +oak6.upload.maximum_size=1040368 +oak6.upload.maximum_data_size=81920 +oak6.upload.wait_for_upload_port=false +oak6.serial.disableDTR=true +oak6.serial.disableRTS=true + +oak6.build.mcu=esp8266 +oak6.build.f_cpu=80000000L +oak6.build.board=ESP8266_OAK +oak6.build.core=oak +oak6.build.variant=oak6 +oak6.build.flash_mode=qio +oak6.build.flash_freq=40 +oak6.build.spiffs_pagesize=256 + + +oak6.menu.CpuFrequency.80=80 MHz +oak6.menu.CpuFrequency.80.build.f_cpu=80000000L +oak6.menu.CpuFrequency.160=160 MHz +oak6.menu.CpuFrequency.160.build.f_cpu=160000000L + +oak6.menu.UploadTool.oak_ota=Particle OTA +oak6.menu.UploadTool.oak_ota.upload.tool=oak_ota +oak6.menu.UploadTool.oak_ota.upload.verbose=-vv +oak6.menu.UploadTool.esptool_py=Serial (Expert Use Only - Requires Python) +oak6.menu.UploadTool.esptool_py.upload.tool=esptool_py +oak6.menu.UploadTool.esptool_py.upload.verbose=-vv + +oak6.menu.FlashSize.OAK=OAK (4M/1M SPIFFS) +#this is in megabits - only needed for serial upload +oak6.menu.FlashSize.oak6.build.flash_size=32m +oak6.menu.FlashSize.oak6.build.spiffs_start=0x300000 +oak6.menu.FlashSize.oak6.build.spiffs_end=0x3FB000 +oak6.menu.FlashSize.oak6.build.spiffs_blocksize=8192 +oak6.menu.FlashSize.oak6.build.spiffs_pagesize=256 + +oak6.menu.RomConfig.Full=Single - 1MB (Fullsize) +oak6.menu.RomConfig.Full.build.flash_ld=oak_full.ld +oak6.menu.RomConfig.Full.upload.maximum_size=1040368 +oak6.menu.RomConfig.Full.upload.flash_address=0x0002000 + + + +oak.name=Oak by Digistump (No Safe Mode - ADVANCED) oak.upload.tool=oak_ota oak.upload.speed=115200 @@ -43,23 +147,13 @@ oak.menu.UploadTool.esptool_py.upload.verbose=-vv oak.menu.FlashSize.OAK=OAK (4M/1M SPIFFS) #this is in megabits - only needed for serial upload -oak.menu.FlashSize.OAK.build.flash_size=32m -oak.menu.FlashSize.OAK.build.spiffs_start=0x300000 -oak.menu.FlashSize.OAK.build.spiffs_end=0x3FB000 -oak.menu.FlashSize.OAK.build.spiffs_blocksize=8192 -oak.menu.FlashSize.OAK.build.spiffs_pagesize=256 +oak.menu.FlashSize.oak.build.flash_size=32m +oak.menu.FlashSize.oak.build.spiffs_start=0x300000 +oak.menu.FlashSize.oak.build.spiffs_end=0x3FB000 +oak.menu.FlashSize.oak.build.spiffs_blocksize=8192 +oak.menu.FlashSize.oak.build.spiffs_pagesize=256 oak.menu.RomConfig.Full=Single - 1MB (Fullsize) oak.menu.RomConfig.Full.build.flash_ld=oak_full.ld oak.menu.RomConfig.Full.upload.maximum_size=1040368 -oak.menu.RomConfig.Full.upload.flash_address=0x0002000 - -#oak.menu.RomConfig.Half1=First Half - 512KB (Half) -#oak.menu.RomConfig.Half1.build.flash_ld=oak_half1.ld -#oak.menu.RomConfig.Half1.upload.maximum_size=520176 -#oak.menu.RomConfig.Half1.upload.flash_address=0x0002000 - -#oak.menu.RomConfig.Half2=Second Half - 512KB (Half) -#oak.menu.RomConfig.Half2.build.flash_ld=oak_half2.ld -#oak.menu.RomConfig.Half2.upload.maximum_size=520176 -#oak.menu.RomConfig.Half2.upload.flash_address=0x0081000 \ No newline at end of file +oak.menu.RomConfig.Full.upload.flash_address=0x0002000 \ No newline at end of file diff --git a/cores/oak/OakParticle/particle_core.cpp b/cores/oak/OakParticle/particle_core.cpp index 8f158f6..4a80dc8 100644 --- a/cores/oak/OakParticle/particle_core.cpp +++ b/cores/oak/OakParticle/particle_core.cpp @@ -1889,9 +1889,9 @@ void notify_update_done(uint8_t* buf) bool handle_chunk(msg& message) { - #ifdef DEBUG_SETUP - Serial.println("CHUNK"); - #endif + #ifdef DEBUG_SETUP + Serial.println("CHUNK"); + #endif last_chunk_millis = millis(); //Faults without this. internal_delay(10); @@ -3874,7 +3874,9 @@ void init_bootloader_flags(void){ set_oakboot_defaults(1); } void check_safe_mode(void){ - #ifndef OAK_SYSTEM_ROM_4F616B + #ifdef SAFE_MODE_PIN + if(OAK_SYSTEM_ROM_4F616B == 82) + return; pinMode(SAFE_MODE_PIN,INPUT_PULLUP); if(digitalRead(SAFE_MODE_PIN) == LOW){ uint32_t startHold = millis(); diff --git a/cores/oak/OakParticle/particle_globals.h b/cores/oak/OakParticle/particle_globals.h index e3dfc5c..91ae831 100644 --- a/cores/oak/OakParticle/particle_globals.h +++ b/cores/oak/OakParticle/particle_globals.h @@ -5,7 +5,6 @@ //#define OAK_SYSTEM_ROM_4F616B 82 -#define SAFE_MODE_PIN 1 #define PRODUCT_ID 82 #define PLATFORM_ID 82 diff --git a/variants/oak1/pins_arduino.cpp b/variants/oak1/pins_arduino.cpp new file mode 100644 index 0000000..92d7779 --- /dev/null +++ b/variants/oak1/pins_arduino.cpp @@ -0,0 +1,6 @@ +typedef unsigned short uint8_t; +#include "pins_arduino.h" + + ///0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 +unsigned short esp8266_pinToGpio[12] = {2, 5, 0, 3, 1, 4, 15, 13, 12, 14, 16, 17}; +unsigned short esp8266_gpioToPin[18] = {2, 4, 0, 3, 5, 1, 255, 255, 255, 255, 255, 255, 8, 7, 9, 6, 10, 11}; diff --git a/variants/oak1/pins_arduino.h b/variants/oak1/pins_arduino.h new file mode 100644 index 0000000..243d93a --- /dev/null +++ b/variants/oak1/pins_arduino.h @@ -0,0 +1,85 @@ +/* + 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. + Modified for Oak by Digistump, 2016. + + 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 + +//for compat with libraries +#ifndef ARDUINO_ARCH_ESP8266 +#define ARDUINO_ARCH_ESP8266 1 +#endif +#ifndef ESP8266 +#define ESP8266 1 +#endif + +#define SAFE_MODE_PIN 1 + +#define EXTERNAL_NUM_INTERRUPTS 10 +#define NUM_DIGITAL_PINS 11 +#define NUM_ANALOG_INPUTS 1 + +#define analogInputToDigitalPin(p) ((p > 0)?NOT_A_PIN:0) +#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)?p:NOT_A_PIN) +#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS)?p:NOT_A_PIN) + +static const uint8_t SDA = 0; +static const uint8_t SCL = 2; + +static const uint8_t SS = 6; +static const uint8_t MOSI = 7; +static const uint8_t MISO = 8; +static const uint8_t SCK = 9; + +static const uint8_t BUILTIN_LED = 1; + +static const uint8_t A0 = 17; + ///0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 +//uint8_t esp8266_pinToGpio[12] = {2, 5, 0, 3, 1, 4, 15, 13, 12, 14, 16, 17}; +//uint8_t esp8266_gpioToPin[18] = {2, 4, 0, 3, 5, 1, 255, 255, 255, 255, 255, 255, 8, 7, 9, 6, 10, 11}; +extern unsigned short esp8266_pinToGpio[12]; +extern unsigned short esp8266_gpioToPin[18]; + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_MONITOR Serial +#define SERIAL_PORT_USBVIRTUAL Serial +#define SERIAL_PORT_HARDWARE Serial +#define SERIAL_PORT_HARDWARE_OPEN Serial + +#endif /* Pins_Arduino_h */ diff --git a/variants/oak6/pins_arduino.cpp b/variants/oak6/pins_arduino.cpp new file mode 100644 index 0000000..92d7779 --- /dev/null +++ b/variants/oak6/pins_arduino.cpp @@ -0,0 +1,6 @@ +typedef unsigned short uint8_t; +#include "pins_arduino.h" + + ///0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 +unsigned short esp8266_pinToGpio[12] = {2, 5, 0, 3, 1, 4, 15, 13, 12, 14, 16, 17}; +unsigned short esp8266_gpioToPin[18] = {2, 4, 0, 3, 5, 1, 255, 255, 255, 255, 255, 255, 8, 7, 9, 6, 10, 11}; diff --git a/variants/oak6/pins_arduino.h b/variants/oak6/pins_arduino.h new file mode 100644 index 0000000..977ad8c --- /dev/null +++ b/variants/oak6/pins_arduino.h @@ -0,0 +1,85 @@ +/* + 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. + Modified for Oak by Digistump, 2016. + + 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 + +//for compat with libraries +#ifndef ARDUINO_ARCH_ESP8266 +#define ARDUINO_ARCH_ESP8266 1 +#endif +#ifndef ESP8266 +#define ESP8266 1 +#endif + +#define SAFE_MODE_PIN 6 + +#define EXTERNAL_NUM_INTERRUPTS 10 +#define NUM_DIGITAL_PINS 11 +#define NUM_ANALOG_INPUTS 1 + +#define analogInputToDigitalPin(p) ((p > 0)?NOT_A_PIN:0) +#define digitalPinToInterrupt(p) (((p) < EXTERNAL_NUM_INTERRUPTS)?p:NOT_A_PIN) +#define digitalPinHasPWM(p) (((p) < NUM_DIGITAL_PINS)?p:NOT_A_PIN) + +static const uint8_t SDA = 0; +static const uint8_t SCL = 2; + +static const uint8_t SS = 6; +static const uint8_t MOSI = 7; +static const uint8_t MISO = 8; +static const uint8_t SCK = 9; + +static const uint8_t BUILTIN_LED = 1; + +static const uint8_t A0 = 17; + ///0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 +//uint8_t esp8266_pinToGpio[12] = {2, 5, 0, 3, 1, 4, 15, 13, 12, 14, 16, 17}; +//uint8_t esp8266_gpioToPin[18] = {2, 4, 0, 3, 5, 1, 255, 255, 255, 255, 255, 255, 8, 7, 9, 6, 10, 11}; +extern unsigned short esp8266_pinToGpio[12]; +extern unsigned short esp8266_gpioToPin[18]; + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_MONITOR Serial +#define SERIAL_PORT_USBVIRTUAL Serial +#define SERIAL_PORT_HARDWARE Serial +#define SERIAL_PORT_HARDWARE_OPEN Serial + +#endif /* Pins_Arduino_h */