1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-01 03:47:23 +03:00

Merge branch 'esp8266' of https://github.com/esp8266/Arduino into esp8266-esp8266

blah
This commit is contained in:
ficeto
2015-05-18 16:48:48 +03:00
697 changed files with 38631 additions and 13018 deletions

View File

@ -16,8 +16,6 @@ yun.pid.2=0x0041
yun.vid.3=0x2A03
yun.pid.3=0x8041
yun.vid.0x2A03.warning=Uncertified
yun.upload.tool=avrdude
yun.upload.protocol=avr109
yun.upload.maximum_size=28672
@ -56,8 +54,6 @@ uno.pid.1=0x0001
uno.vid.2=0x2A03
uno.pid.2=0x0043
uno.vid.0x2A03.warning=Uncertified
uno.upload.tool=avrdude
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
@ -182,8 +178,6 @@ mega.pid.2=0x0010
mega.vid.3=0x2A03
mega.pid.3=0x0042
mega.vid.0x2A03.warning=Uncertified
mega.upload.tool=avrdude
mega.upload.maximum_data_size=8192
@ -241,8 +235,6 @@ megaADK.pid.2=0x003f
megaADK.vid.3=0x2A03
megaADK.pid.3=0x0044
megaADK.vid.0x2A03.warning=Uncertified
megaADK.upload.tool=avrdude
megaADK.upload.protocol=wiring
megaADK.upload.maximum_size=253952
@ -275,8 +267,6 @@ leonardo.pid.2=0x0036
leonardo.vid.3=0x2A03
leonardo.pid.3=0x8036
leonardo.vid.0x2A03.warning=Uncertified
leonardo.upload.tool=avrdude
leonardo.upload.protocol=avr109
leonardo.upload.maximum_size=28672
@ -316,8 +306,6 @@ micro.pid.2=0x0037
micro.vid.3=0x2A03
micro.pid.3=0x8037
micro.vid.0x2A03.warning=Uncertified
micro.upload.tool=avrdude
micro.upload.protocol=avr109
micro.upload.maximum_size=28672
@ -357,8 +345,6 @@ esplora.pid.2=0x003C
esplora.vid.3=0x2A03
esplora.pid.3=0x803C
esplora.vid.0x2A03.warning=Uncertified
esplora.upload.tool=avrdude
esplora.upload.protocol=avr109
esplora.upload.maximum_size=28672
@ -739,8 +725,6 @@ robotControl.pid.2=0x0038
robotControl.vid.3=0x2A03
robotControl.pid.3=0x8038
robotControl.vid.0x2A03.warning=Uncertified
robotControl.upload.tool=avrdude
robotControl.upload.protocol=avr109
robotControl.upload.maximum_size=28672
@ -780,8 +764,6 @@ robotMotor.pid.2=0x0039
robotMotor.vid.3=0x2A03
robotMotor.pid.3=0x8039
robotMotor.vid.0x2A03.warning=Uncertified
robotMotor.upload.tool=avrdude
robotMotor.upload.protocol=avr109
robotMotor.upload.maximum_size=28672
@ -809,3 +791,27 @@ robotMotor.build.core=arduino
robotMotor.build.variant=robot_motor
robotMotor.build.extra_flags={build.usb_flags}
##############################################################
gemma.vid.0=0x2341
gemma.pid.0=0x0c9f
gemma.name=Arduino Gemma
gemma.bootloader.low_fuses=0xF1
gemma.bootloader.high_fuses=0xD5
gemma.bootloader.extended_fuses=0xFE
gemma.bootloader.tool=avrdude
gemma.bootloader.lock_bits=
gemma.bootloader.unlock_bits=
gemma.bootloader.file=gemma/gemma_v1.hex
gemma.build.mcu=attiny85
gemma.build.f_cpu=8000000L
gemma.build.core=arduino
gemma.build.variant=gemma
gemma.build.board=AVR_GEMMA
gemma.upload.tool=avrdude
gemma.upload.maximum_size=5310

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,182 @@
:100000005FCA5FCA5FCA5FCA5FCA5FCA5FCA5FCAA8
:1014C00033C05FC08BC05DC05CC05BC05AC059C038
:1014D00058C057C056C055C054C053C052C009026E
:1014E0001200010100803209040000000000000029
:1014F00012011001FF00000841239F0C00010102AE
:1015000000010C03470065006D006D0061001603CB
:10151000410072006400750069006E006F002E00CB
:10152000630063000403090411241FBECFE5D2E069
:10153000DEBFCDBF84B7877F84BF88E10FB6F89444
:1015400081BD11BC0FBE91E080E80FB6F89486BD56
:1015500096BD0FBE0AEA0F9310E0A0E6B0E0EEEDF4
:10156000FFE102C005900D92A236B107D9F711E054
:10157000A2E6B0E001C01D92A832B107E1F7EDD3B9
:101580002CC59ECFA82FB92F80E090E041E050EA13
:10159000609530E009C02D9182279795879510F0CE
:1015A00084279527305EC8F36F5FA8F30895EADFBC
:1015B0008D939D930895A6E088279927AA9569F0B1
:1015C0000197E1F3B399FCCFB39BFECF81E099275C
:1015D000A6B3019611F0A871D9F70895CF93CFB7AC
:1015E000CF93C0915F02CA3A21F0CF91CFBFCF9184
:1015F00065CFCC27C395B39BE9F7B39B0BC0B39BD7
:1016000009C0B39B07C0B39B05C0B39B03C0B39B8A
:1016100001C0D3C00F92DF93C0910B01DD27CE5ED6
:10162000DE4F012EB39B03C0DF910F90E6CF2F93C7
:101630000F931F934F932FEF4F6F06B303FB20F9C8
:101640005F933F9350E03BE065C016B301265029FD
:1016500053FDC89556B3012703FB25F92F7306B335
:10166000B1F05027102713FB26F906B22230F0F014
:1016700000C016B3012703FB27F90126502906B243
:101680002430E8F54F77206816B30000F6CF5027D6
:101690004F7D206206B2102F000000C006B3002666
:1016A0005029102713FB26F906B2E2CF4F7B06B371
:1016B000206400C0DACF01265029187106B269F102
:1016C0004E7F2160012F16B328C0002650294D7F80
:1016D00006B22260102F29C0012650294B7F06B286
:1016E0002460012F2DC016B301265029477F2860A2
:1016F000000006B22EC04F7E06B3206130C04227E4
:1017000006B3499300265029102706B24FEF13FB6A
:1017100020F9297F16B379F2187159F10126502961
:1017200006B2012703FB21F9237F06B371F20026DD
:1017300050293150D0F006B2102713FB22F9277E32
:1017400016B351F201265029012703FB06B223F9F3
:101750002F7C49F2000006B3102713FB24F9002662
:10176000502906B22F7939F270CF10E21ABF002744
:1017700017C03B503195C31BD04010E21ABF0881FF
:10178000033CF9F00B34E9F0209109011981110FA4
:101790001213EDCF093651F10D3211F0013E39F738
:1017A000009310013F915F914F911F910F912F91E5
:1017B000DF910F90CAB7C5FD1DCFCF91CFBFCF919D
:1017C000189520911001222369F310910E01112325
:1017D00021F5343022F130930E0120930A0110914B
:1017E0000B013BE0311B30930B0119C000910E013E
:1017F00001309CF40AE53091610034FD11C0009382
:101800006100CEEFD0E010C0052710E000C021C07D
:10181000052710E0C89508BB14C03AE501C032EDB9
:10182000032EC0E0D0E032E017B31861C39A08B3CA
:1018300017BB58E120E84FEF20FF052708BB27958D
:1018400017951C3F28F700004552B0F720FF0527E9
:10185000279508BB17951C3FB8F629913A9561F773
:10186000077E10910F01110F08BBC250D04011F03C
:101870001093090110E21ABF086017B3177E402FBA
:10188000477E54E05A95F1F708BB17BB48BB8ACF97
:101890002091F9003091FA002D3B3441B8F421E059
:1018A0002093F600F894E091F900F091FA000C0111
:1018B00020935700E895112478948091F900909135
:1018C000FA0002969093FA008093F90008958091AF
:1018D000F600882309F43DC08091F9009091FA0048
:1018E000813C944108F035C0F8948091F9009091C2
:1018F000FA008238944118F1809166009091670057
:101900008F559A409F70906CEEEBF4E121E00C0152
:1019100020935700E895112480916E0090916F00FC
:101920008C559A409F70906CECEBF4E10C01209385
:101930005700E8951124789481E080936400E09149
:10194000F900F091FA00329785E080935700E8950E
:1019500078941092F6000895FF920F931F93CF93FF
:10196000DF9380910E01835087FD5AC190910B0146
:10197000ACE0B0E0A91BB109AE5EBE4F31E03093E0
:10198000620090910A019D3209F00AC1883009F085
:1019900045C183EC8093FE008AE58093610010923C
:1019A000FD008C91807609F47DC01092F3001092B6
:1019B000F5001092F40011962C911197213009F442
:1019C00069C0263021F481E08093FC0067C0273095
:1019D00009F040C03093FC0089EE90E090930D0137
:1019E00080930C0113969C9113979093EB001092A7
:1019F000EC0012968C911297803379F491114CC0BF
:101A00001496EC911497F0E0EE0FFF1F81E28093A3
:101A10005700E491E093EC003FC08C3A81F4903899
:101A2000D9F514968C911497811136C015968C9126
:101A30001597811131C081E08093E8002DC08C346E
:101A400059F515968C911597811126C081E08093E8
:101A5000E70022C0283009F4B6CF14968D919C91EE
:101A600015979093FA008093F90016968C9116972B
:101A70008093F10087EF820F843080F48FE788BD78
:101A80003093FB002093F2002A3051F081E08093E4
:101A9000FC0006C021E077C024E075C020E073C0E0
:101AA0002FEF68C012969C91129710920701119621
:101AB0008C911197811106C01092080187E091E086
:101AC00022E052C0853019F490930F013FC0863058
:101AD000B9F513968C911397813019F480EF94E146
:101AE00004C0823041F48EED94E190930D01809317
:101AF0000C0122E121C08330F1F4911108C084E28D
:101B000095E190930D0180930C0124E015C0913074
:101B100041F48EE095E190930D0180930C0126E154
:101B20000BC0923041F482E095E190930D018093D7
:101B30000C012CE001C020E080E48093FD0018C07F
:101B4000883079F0893031F49093110187E091E089
:101B500020E00AC021E08A3009F020E087E091E02F
:101B600003C081E191E021E090930D0180930C018D
:101B70002F3F49F48C9187FF02C016962C9180E884
:101B80008093FD000AC017968C911797811105C0AC
:101B900016968C91821708F4282F209360003EC07F
:101BA0009091FD0097FF3AC09091F100182F98177F
:101BB00008F4192F092F011B0093F1001092FC006B
:101BC0008091F2008A3029F0011128C01092600043
:101BD00025C0FA2ECA2FDB2F8C2F8F198117A0F763
:101BE0008091F9009091FA008034910590F421E001
:101BF00020936500FC01EE0FFF1FEA59FF4F28817B
:101C000039813183208302969093FA008093F90002
:101C100003C0888199813CDE2296DECF10920E01AE
:101C20008091610084FF7BC0809160008F3F09F448
:101C300076C0182F893008F018E0811B809360006F
:101C40008091FE0098E889278093FE00112309F413
:101C50005AC08091FD0087FF38C08091F100811744
:101C600008F4182F811B8093F1003091F200E0916D
:101C7000F900F091FA0020E0AFEFB0E0211700F595
:101C80003B3009F4FFCF3930D9F7E034F10560F487
:101C9000EF01CC0FDD1FCA59DF4F888199818D93E9
:101CA0009D932E5F3296EACFEC3B84E1F80710F06B
:101CB0008FEF01C084918C9311962F5F3196DECF08
:101CC000F093FA00E093F9001EC0E0910C01F0914E
:101CD0000D0186FF0BC08FEF90E0DC0124912D9366
:101CE0003196212F280F2A13F9CF09C08FEF90E0EA
:101CF000DC0121912D93212F280F2A13FACFF09385
:101D00000D01E0930C01612F8FEF90E050DC1C5F20
:101D10001C3019F08FEF809360001093610084E114
:101D200096B3987131F48150D9F710920F01109247
:101D30000901C1E08111C0E0809163008C1739F086
:101D4000C11103C0F89401D17894C0936300DF916E
:101D5000CF911F910F91FF900895C1B7B99A83E277
:101D60008ABD81E083BFAC9A8BB780628BBFBB9A80
:101D70002FE132E18AE0215030408040E1F700C09D
:101D80000000BB987894E8DD8091E800882321F179
:101D900082E090E09093F8008093F70013C0CF01A9
:101DA0008F739927892B21F483E080935700E8955E
:101DB000D3DD8091F7009091F80002969093F8009F
:101DC0008093F700E091F700F091F800E03C94E197
:101DD000F90728F31092E8008091E700882329F0A2
:101DE000BBDD75DD1092E700B7DD809162008823CE
:101DF00041F08091FC00811104C08091FB008111B1
:101E0000C2CF80916200882371F08091E600811139
:101E10000AC088B5805F88BD88B5811104C08AB5C5
:101E200090E189278ABD8091E6008F5F8093E6006C
:101E30008EEC90E00197F1F78091F4009091F5001D
:101E400001969093F5008093F4002091F3000097A1
:101E500011F42F5F00C02093F30030916200311124
:101E600005C081323EE4930708F05AC03091FC006F
:101E7000332321F08131974208F052C080916200F3
:101E8000882309F480CF8091FB0081117CCF23301F
:101E900008F479CF45C080916400811149C08CEB72
:101EA00094E19093FA008093F90081E08093F6002A
:101EB0000EDD3EC0DF01AA0FBB1FAA59BF4F8D9197
:101EC0009C919F012B7F232B31F4E054FB4E859195
:101ED0009491805A954FDCDCE091F900F091FA0082
:101EE000E034F10538F3F3DC10925F0217BA13BE49
:101EF0001ABC03C081B78F5F81BF81B78C17D0F345
:101F000003C081B7815081BF81B7C817D0F391E07A
:101F100080E80FB6F89486BD96BD0FBED0CA13C038
:101F200015BA1BBEF894809165008111B4CFDCCF47
:101F3000E0E0F0E083E080935700E8951092FA002B
:101F40001092F900C9CF80E090E0DF92EF92FF920B
:101F50000F931F93CF93DF9390E080E80FB6F89430
:101F600086BD96BD0FBE08E010E0F12C80E8E82E9B
:101F7000DF2CDE0CD1BE1FDBEC01C43389E0D807B7
:101F80000CF4FD2CE694015011090115110581F79F
:101F90001F2D8FEF8F0D81BF21B730E0812F90E093
:101FA00001968217930784F006DB8453994097FFCC
:101FB00003C09195819591098C179D0714F4F1B692
:101FC000EC0181B78F5FE7CFF1BEDF91CF911F9119
:0E1FD0000F91FF90EF90DF900895F894FFCFEF
:021FDE00FF5AA8
:04000003000014C025
:00000001FF

View File

@ -34,12 +34,17 @@
// location from which to read.
// NOTE: a "power of 2" buffer size is reccomended to dramatically
// optimize all the modulo operations for ring buffers.
#if !(defined(SERIAL_TX_BUFFER_SIZE) && defined(SERIAL_RX_BUFFER_SIZE))
#if !defined(SERIAL_TX_BUFFER_SIZE)
#if (RAMEND < 1000)
#define SERIAL_TX_BUFFER_SIZE 16
#define SERIAL_RX_BUFFER_SIZE 16
#else
#define SERIAL_TX_BUFFER_SIZE 64
#endif
#endif
#if !defined(SERIAL_RX_BUFFER_SIZE)
#if (RAMEND < 1000)
#define SERIAL_RX_BUFFER_SIZE 16
#else
#define SERIAL_RX_BUFFER_SIZE 64
#endif
#endif

View File

@ -18,6 +18,8 @@
Created July 2011
parsing functions based on TextFinder library by Michael Margolis
findMulti/findUntil routines written by Jim Leonard/Xuth
*/
#include "Arduino.h"
@ -75,7 +77,7 @@ void Stream::setTimeout(unsigned long timeout) // sets the maximum number of mi
// find returns true if the target string is found
bool Stream::find(char *target)
{
return findUntil(target, (char*)"");
return findUntil(target, strlen(target), NULL, 0);
}
// reads data from the stream until the target string of given length is found
@ -96,32 +98,13 @@ bool Stream::findUntil(char *target, char *terminator)
// returns true if target string is found, false if terminated or timed out
bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t termLen)
{
size_t index = 0; // maximum target string length is 64k bytes!
size_t termIndex = 0;
int c;
if( *target == 0)
return true; // return true if target is a null string
while( (c = timedRead()) > 0){
if(c != target[index])
index = 0; // reset index if any char does not match
if( c == target[index]){
//////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1);
if(++index >= targetLen){ // return true if all chars in the target match
return true;
}
}
if(termLen > 0 && c == terminator[termIndex]){
if(++termIndex >= termLen)
return false; // return false if terminate string found before target string
}
else
termIndex = 0;
if (terminator == NULL) {
MultiTarget t[1] = {{target, targetLen, 0}};
return findMulti(t, 1) == 0 ? true : false;
} else {
MultiTarget t[2] = {{target, targetLen, 0}, {terminator, termLen, 0}};
return findMulti(t, 2) == 0 ? true : false;
}
return false;
}
@ -137,7 +120,7 @@ long Stream::parseInt()
// this allows format characters (typically commas) in values to be ignored
long Stream::parseInt(char skipChar)
{
boolean isNegative = false;
bool isNegative = false;
long value = 0;
int c;
@ -173,10 +156,10 @@ float Stream::parseFloat()
// as above but the given skipChar is ignored
// this allows format characters (typically commas) in values to be ignored
float Stream::parseFloat(char skipChar){
boolean isNegative = false;
boolean isFraction = false;
bool isNegative = false;
bool isFraction = false;
long value = 0;
int c;
char c;
float fraction = 1.0;
c = peekNextDigit();
@ -268,3 +251,67 @@ String Stream::readStringUntil(char terminator)
return ret;
}
int Stream::findMulti( struct Stream::MultiTarget *targets, int tCount) {
// any zero length target string automatically matches and would make
// a mess of the rest of the algorithm.
for (struct MultiTarget *t = targets; t < targets+tCount; ++t) {
if (t->len <= 0)
return t - targets;
}
while (1) {
int c = timedRead();
if (c < 0)
return -1;
for (struct MultiTarget *t = targets; t < targets+tCount; ++t) {
// the simple case is if we match, deal with that first.
if (c == t->str[t->index]) {
if (++t->index == t->len)
return t - targets;
else
continue;
}
// if not we need to walk back and see if we could have matched further
// down the stream (ie '1112' doesn't match the first position in '11112'
// but it will match the second position so we can't just reset the current
// index to 0 when we find a mismatch.
if (t->index == 0)
continue;
int origIndex = t->index;
do {
--t->index;
// first check if current char works against the new current index
if (c != t->str[t->index])
continue;
// if it's the only char then we're good, nothing more to check
if (t->index == 0) {
t->index++;
break;
}
// otherwise we need to check the rest of the found string
int diff = origIndex - t->index;
size_t i;
for (i = 0; i < t->index; ++i) {
if (t->str[i] != t->str[i + diff])
break;
}
// if we successfully got through the previous loop then our current
// index is good.
if (i == t->index) {
t->index++;
break;
}
// otherwise we just try the next index
} while (t->index);
}
}
// unreachable
return -1;
}

View File

@ -97,6 +97,17 @@ class Stream : public Print
// this allows format characters (typically commas) in values to be ignored
float parseFloat(char skipChar); // as above but the given skipChar is ignored
struct MultiTarget {
const char *str; // string you're searching for
size_t len; // length of string you're searching for
size_t index; // index used by the search routine.
};
// This allows you to search for an arbitrary number of strings.
// Returns index of the target that is found first or -1 if timeout occurs.
int findMulti(struct MultiTarget *targets, int tCount);
};
#endif

View File

@ -30,6 +30,8 @@ Version Modified By Date Comments
0006 D Mellis 09/12/29 Replaced objects with functions
0007 M Sproul 10/08/29 Changed #ifdefs from cpu to register
0008 S Kanemoto 12/06/22 Fixed for Leonardo by @maris_HY
0009 J Reucker 15/04/10 Issue #292 Fixed problems with ATmega8 (thanks to Pete62)
0010 jipp 15/04/13 added additional define check #2923
*************************************************/
#include <avr/interrupt.h>
@ -151,7 +153,7 @@ static int8_t toneBegin(uint8_t _pin)
// whereas 16 bit timers are set to either ck/1 or ck/64 prescalar
switch (_timer)
{
#if defined(TCCR0A) && defined(TCCR0B)
#if defined(TCCR0A) && defined(TCCR0B) && defined(WGM01)
case 0:
// 8 bit timer
TCCR0A = 0;
@ -296,13 +298,13 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
#if defined(TCCR0B)
if (_timer == 0)
{
TCCR0B = prescalarbits;
TCCR0B = (TCCR0B & 0b11111000) | prescalarbits;
}
else
#endif
#if defined(TCCR2B)
{
TCCR2B = prescalarbits;
TCCR2B = (TCCR2B & 0b11111000) | prescalarbits;
}
#else
{
@ -389,7 +391,7 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
break;
#endif
#if defined(TIMSK3)
#if defined(OCR3A) && defined(TIMSK3) && defined(OCIE3A)
case 3:
OCR3A = ocr;
timer3_toggle_count = toggle_count;
@ -397,7 +399,7 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
break;
#endif
#if defined(TIMSK4)
#if defined(OCR4A) && defined(TIMSK4) && defined(OCIE4A)
case 4:
OCR4A = ocr;
timer4_toggle_count = toggle_count;
@ -454,21 +456,21 @@ void disableTimer(uint8_t _timer)
#endif
break;
#if defined(TIMSK3)
#if defined(TIMSK3) && defined(OCIE3A)
case 3:
TIMSK3 = 0;
bitWrite(TIMSK3, OCIE3A, 0);
break;
#endif
#if defined(TIMSK4)
#if defined(TIMSK4) && defined(OCIE4A)
case 4:
TIMSK4 = 0;
bitWrite(TIMSK4, OCIE4A, 0);
break;
#endif
#if defined(TIMSK5)
#if defined(TIMSK5) && defined(OCIE5A)
case 5:
TIMSK5 = 0;
bitWrite(TIMSK5, OCIE5A, 0);
break;
#endif
}

View File

@ -59,11 +59,16 @@ extern USBDevice_ USBDevice;
struct ring_buffer;
#ifndef SERIAL_BUFFER_SIZE
#if (RAMEND < 1000)
#define SERIAL_BUFFER_SIZE 16
#else
#define SERIAL_BUFFER_SIZE 64
#endif
#endif
#if (SERIAL_BUFFER_SIZE>256)
#error Please lower the CDC Buffer size
#endif
class Serial_ : public Stream
{

View File

@ -1,50 +0,0 @@
/*
EEPROM.cpp - EEPROM library
Copyright (c) 2006 David A. Mellis. All right reserved.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/******************************************************************************
* Includes
******************************************************************************/
#include <avr/eeprom.h>
#include "Arduino.h"
#include "EEPROM.h"
/******************************************************************************
* Definitions
******************************************************************************/
/******************************************************************************
* Constructors
******************************************************************************/
/******************************************************************************
* User API
******************************************************************************/
uint8_t EEPROMClass::read(int address)
{
return eeprom_read_byte((unsigned char *) address);
}
void EEPROMClass::write(int address, uint8_t value)
{
eeprom_write_byte((unsigned char *) address, value);
}
EEPROMClass EEPROM;

View File

@ -1,6 +1,7 @@
/*
EEPROM.h - EEPROM library
Copyright (c) 2006 David A. Mellis. All right reserved.
Original Copyright (c) 2006 David A. Mellis. All right reserved.
New version by Christopher Andrews 2015.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -21,15 +22,125 @@
#define EEPROM_h
#include <inttypes.h>
#include <avr/eeprom.h>
#include <avr/io.h>
class EEPROMClass
{
public:
uint8_t read(int);
void write(int, uint8_t);
/***
EERef class.
This object references an EEPROM cell.
Its purpose is to mimic a typical byte of RAM, however its storage is the EEPROM.
This class has an overhead of two bytes, similar to storing a pointer to an EEPROM cell.
***/
struct EERef{
EERef( const int index )
: index( index ) {}
//Access/read members.
uint8_t operator*() const { return eeprom_read_byte( (uint8_t*) index ); }
operator const uint8_t() const { return **this; }
//Assignment/write members.
EERef &operator=( const EERef &ref ) { return *this = *ref; }
EERef &operator=( uint8_t in ) { return eeprom_write_byte( (uint8_t*) index, in ), *this; }
EERef &operator +=( uint8_t in ) { return *this = **this + in; }
EERef &operator -=( uint8_t in ) { return *this = **this - in; }
EERef &operator *=( uint8_t in ) { return *this = **this * in; }
EERef &operator /=( uint8_t in ) { return *this = **this / in; }
EERef &operator ^=( uint8_t in ) { return *this = **this ^ in; }
EERef &operator %=( uint8_t in ) { return *this = **this % in; }
EERef &operator &=( uint8_t in ) { return *this = **this & in; }
EERef &operator |=( uint8_t in ) { return *this = **this | in; }
EERef &operator <<=( uint8_t in ) { return *this = **this << in; }
EERef &operator >>=( uint8_t in ) { return *this = **this >> in; }
EERef &update( uint8_t in ) { return in != *this ? *this = in : *this; }
/** Prefix increment/decrement **/
EERef& operator++() { return *this += 1; }
EERef& operator--() { return *this -= 1; }
/** Postfix increment/decrement **/
uint8_t operator++ (int){
uint8_t ret = **this;
return ++(*this), ret;
}
uint8_t operator-- (int){
uint8_t ret = **this;
return --(*this), ret;
}
int index; //Index of current EEPROM cell.
};
extern EEPROMClass EEPROM;
/***
EEPtr class.
This object is a bidirectional pointer to EEPROM cells represented by EERef objects.
Just like a normal pointer type, this can be dereferenced and repositioned using
increment/decrement operators.
***/
#endif
struct EEPtr{
EEPtr( const int index )
: index( index ) {}
operator const int() const { return index; }
EEPtr &operator=( int in ) { return index = in, *this; }
//Iterator functionality.
bool operator!=( const EEPtr &ptr ) { return index != ptr.index; }
EERef operator*() { return index; }
/** Prefix & Postfix increment/decrement **/
EEPtr& operator++() { return ++index, *this; }
EEPtr& operator--() { return --index, *this; }
EEPtr operator++ (int) { return index++; }
EEPtr operator-- (int) { return index--; }
int index; //Index of current EEPROM cell.
};
/***
EEPROMClass class.
This object represents the entire EEPROM space.
It wraps the functionality of EEPtr and EERef into a basic interface.
This class is also 100% backwards compatible with earlier Arduino core releases.
***/
struct EEPROMClass{
//Basic user access methods.
EERef operator[]( const int idx ) { return idx; }
uint8_t read( int idx ) { return EERef( idx ); }
void write( int idx, uint8_t val ) { (EERef( idx )) = val; }
void update( int idx, uint8_t val ) { EERef( idx ).update( val ); }
//STL and C++11 iteration capability.
EEPtr begin() { return 0x00; }
EEPtr end() { return length(); } //Standards requires this to be the item after the last valid entry. The returned pointer is invalid.
uint16_t length() { return E2END + 1; }
//Functionality to 'get' and 'put' objects to and from EEPROM.
template< typename T > T &get( int idx, T &t ){
EEPtr e = idx;
uint8_t *ptr = (uint8_t*) &t;
for( int count = sizeof(T) ; count ; --count, ++e ) *ptr++ = *e;
return t;
}
template< typename T > const T &put( int idx, const T &t ){
EEPtr e = idx;
const uint8_t *ptr = (const uint8_t*) &t;
for( int count = sizeof(T) ; count ; --count, ++e ) (*e).update( *ptr++ );
return t;
}
};
static EEPROMClass EEPROM;
#endif

View File

@ -0,0 +1,139 @@
## **EEPROM Library V2.0** for Arduino
**Written by:** _Christopher Andrews_.
### **What is the EEPROM library.**
Th EEPROM library provides an easy to use interface to interact with the internal non-volatile storage found in AVR based Arduino boards. This library will work on many AVR devices like ATtiny and ATmega chips.
### **How to use it**
The EEPROM library is included in your IDE download. To add its functionality to your sketch you'll need to reference the library header file. You do this by adding an include directive to the top of your sketch.
```Arduino
#include <EEPROM.h>
void setup(){
}
void loop(){
}
```
The library provides a global variable named `EEPROM`, you use this variable to access the library functions. The methods provided in the EEPROM class are listed below.
You can view all the examples [here](examples/).
### **Library functions**
#### **`EEPROM.read( address )`** [[_example_]](examples/eeprom_read/eeprom_read.ino)
This function allows you to read a single byte of data from the eeprom.
Its only parameter is an `int` which should be set to the address you wish to read.
The function returns an `unsigned char` containing the value read.
#### **`EEPROM.write( address, value )`** [[_example_]](examples/eeprom_write/eeprom_write.ino)
The `write()` method allows you to write a single byte of data to the EEPROM.
Two parameters are needed. The first is an `int` containing the address that is to be written, and the second is a the data to be written (`unsigned char`).
This function does not return any value.
#### **`EEPROM.update( address, value )`** [[_example_]](examples/eeprom_update/eeprom_update.ino)
This function is similar to `EEPROM.write()` however this method will only write data if the cell contents pointed to by `address` is different to `value`. This method can help prevent unnecessary wear on the EEPROM cells.
This function does not return any value.
#### **`EEPROM.get( address, object )`** [[_example_]](examples/eeprom_get/eeprom_get.ino)
This function will retrieve any object from the EEPROM.
Two parameters are needed to call this function. The first is an `int` containing the address that is to be written, and the second is the object you would like to read.
This function returns a reference to the `object` passed in. It does not need to be used and is only returned for conveience.
#### **`EEPROM.put( address, object )`** [[_example_]](examples/eeprom_put/eeprom_put.ino)
This function will write any object to the EEPROM.
Two parameters are needed to call this function. The first is an `int` containing the address that is to be written, and the second is the object you would like to write.
This function uses the _update_ method to write its data, and therefore only rewrites changed cells.
This function returns a reference to the `object` passed in. It does not need to be used and is only returned for conveience.
#### **Subscript operator: `EEPROM[address]`** [[_example_]](examples/eeprom_crc/eeprom_crc.ino)
This operator allows using the identifier `EEPROM` like an array.
EEPROM cells can be read _and_ **_written_** directly using this method.
This operator returns a reference to the EEPROM cell.
```c++
unsigned char val;
//Read first EEPROM cell.
val = EEPROM[ 0 ];
//Write first EEPROM cell.
EEPROM[ 0 ] = val;
//Compare contents
if( val == EEPROM[ 0 ] ){
//Do something...
}
```
#### **`EEPROM.length()`**
This function returns an `unsigned int` containing the number of cells in the EEPROM.
---
### **Advanced features**
This library uses a component based approach to provide its functionality. This means you can also use these components to design a customized approach. Two background classes are available for use: `EERef` & `EEPtr`.
#### **`EERef` class**
This object references an EEPROM cell.
Its purpose is to mimic a typical byte of RAM, however its storage is the EEPROM.
This class has an overhead of two bytes, similar to storing a pointer to an EEPROM cell.
```C++
EERef ref = EEPROM[ 10 ]; //Create a reference to 11th cell.
ref = 4; //write to EEPROM cell.
unsigned char val = ref; //Read referenced cell.
```
#### **`EEPtr` class**
This object is a bidirectional pointer to EEPROM cells represented by `EERef` objects.
Just like a normal pointer type, this type can be dereferenced and repositioned using
increment/decrement operators.
```C++
EEPtr ptr = 10; //Create a pointer to 11th cell.
*ptr = 4; //dereference and write to EEPROM cell.
unsigned char val = *ptr; //dereference and read.
ptr++; //Move to next EEPROM cell.
```
#### **`EEPROM.begin()`**
This function returns an `EEPtr` pointing to the first cell in the EEPROM.
This is useful for STL objects, custom iteration and C++11 style ranged for loops.
#### **`EEPROM.end()`**
This function returns an `EEPtr` pointing at the location after the last EEPROM cell.
Used with `begin()` to provide custom iteration.
**Note:** The `EEPtr` returned is invalid as it is out of range. Infact the hardware causes wrapping of the address (overflow) and `EEPROM.end()` actually references the first EEPROM cell.

View File

@ -2,22 +2,34 @@
* EEPROM Clear
*
* Sets all of the bytes of the EEPROM to 0.
* Please see eeprom_iteration for a more in depth
* look at how to traverse the EEPROM.
*
* This example code is in the public domain.
*/
#include <EEPROM.h>
void setup()
{
// write a 0 to all 512 bytes of the EEPROM
for (int i = 0; i < 512; i++)
/***
Iterate through each byte of the EEPROM storage.
Larger AVR processors have larger EEPROM sizes, E.g:
- Arduno Duemilanove: 512b EEPROM storage.
- Arduino Uno: 1kb EEPROM storage.
- Arduino Mega: 4kb EEPROM storage.
Rather than hard-coding the length, you should use the pre-provided length function.
This will make your code portable to all AVR processors.
***/
for ( int i = 0 ; i < EEPROM.length() ; i++ )
EEPROM.write(i, 0);
// turn the LED on when we're done
digitalWrite(13, HIGH);
}
void loop()
{
}
void loop(){ /** Empty loop. **/ }

View File

@ -0,0 +1,50 @@
/***
Written by Christopher Andrews.
CRC algorithm generated by pycrc, MIT licence ( https://github.com/tpircher/pycrc ).
A CRC is a simple way of checking whether data has changed or become corrupted.
This example calculates a CRC value directly on the EEPROM values.
The purpose of this example is to highlight how the EEPROM object can be used just like an array.
***/
#include <Arduino.h>
#include <EEPROM.h>
void setup(){
//Start serial
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
//Print length of data to run CRC on.
Serial.print( "EEPROM length: " );
Serial.println( EEPROM.length() );
//Print the result of calling eeprom_crc()
Serial.print( "CRC32 of EEPROM data: 0x" );
Serial.println( eeprom_crc(), HEX );
Serial.print( "\n\nDone!" );
}
void loop(){ /* Empty loop */ }
unsigned long eeprom_crc( void ){
const unsigned long crc_table[16] = {
0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c,
0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c,
0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c
};
unsigned long crc = ~0L;
for( int index = 0 ; index < EEPROM.length() ; ++index ){
crc = crc_table[( crc ^ EEPROM[index] ) & 0x0f] ^ (crc >> 4);
crc = crc_table[( crc ^ ( EEPROM[index] >> 4 )) & 0x0f] ^ (crc >> 4);
crc = ~crc;
}
return crc;
}

View File

@ -0,0 +1,66 @@
/***
eeprom_get example.
This shows how to use the EEPROM.get() method.
To pre-set the EEPROM data, run the example sketch eeprom_put.
This sketch will run without it, however, the values shown
will be shown from what ever is already on the EEPROM.
This may cause the serial object to print out a large string
of garbage if there is no null character inside one of the strings
loaded.
Written by Christopher Andrews 2015
Released under MIT licence.
***/
#include <EEPROM.h>
void setup(){
float f = 0.00f; //Variable to store data read from EEPROM.
int eeAddress = 0; //EEPROM address to start reading from
Serial.begin( 9600 );
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print( "Read float from EEPROM: " );
//Get the float data from the EEPROM at position 'eeAddress'
EEPROM.get( eeAddress, f );
Serial.println( f, 3 ); //This may print 'ovf, nan' if the data inside the EEPROM is not a valid float.
/***
As get also returns a reference to 'f', you can use it inline.
E.g: Serial.print( EEPROM.get( eeAddress, f ) );
***/
/***
Get can be used with custom structures too.
I have separated this into an extra function.
***/
secondTest(); //Run the next test.
}
struct MyObject{
float field1;
byte field2;
char name[10];
};
void secondTest(){
int eeAddress = sizeof(float); //Move address to the next byte after float 'f'.
MyObject customVar; //Variable to store custom object read from EEPROM.
EEPROM.get( eeAddress, customVar );
Serial.println( "Read custom object from EEPROM: " );
Serial.println( customVar.field1 );
Serial.println( customVar.field2 );
Serial.println( customVar.name );
}
void loop(){ /* Empty loop */ }

View File

@ -0,0 +1,57 @@
/***
eeprom_iteration example.
A set of example snippets highlighting the
simplest methods for traversing the EEPROM.
Running this sketch is not necessary, this is
simply highlighting certain programming methods.
Written by Christopher Andrews 2015
Released under MIT licence.
***/
#include <EEPROM.h>
void setup() {
/***
Iterate the EEPROM using a for loop.
***/
for( int index = 0 ; index < EEPROM.length() ; index++ ){
//Add one to each cell in the EEPROM
EEPROM[ index ] += 1;
}
/***
Iterate the EEPROM using a while loop.
***/
int index = 0;
while( index < EEPROM.length() ){
//Add one to each cell in the EEPROM
EEPROM[ index ] += 1;
index++;
}
/***
Iterate the EEPROM using a do-while loop.
***/
int idx = 0; //Used 'idx' to avoid name conflict with 'index' above.
do{
//Add one to each cell in the EEPROM
EEPROM[ idx ] += 1;
idx++;
}while( idx < EEPROM.length() );
} //End of setup function.
void loop(){}

View File

@ -0,0 +1,56 @@
/***
eeprom_put example.
This shows how to use the EEPROM.put() method.
Also, this sketch will pre-set the EEPROM data for the
example sketch eeprom_get.
Note, unlike the single byte version EEPROM.write(),
the put method will use update semantics. As in a byte
will only be written to the EEPROM if the data is actually
different.
Written by Christopher Andrews 2015
Released under MIT licence.
***/
#include <EEPROM.h>
struct MyObject{
float field1;
byte field2;
char name[10];
};
void setup(){
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
float f = 123.456f; //Variable to store in EEPROM.
int eeAddress = 0; //Location we want the data to be put.
//One simple call, with the address first and the object second.
EEPROM.put( eeAddress, f );
Serial.println("Written float data type!");
/** Put is designed for use with custom structures also. **/
//Data to store.
MyObject customVar = {
3.14f,
65,
"Working!"
};
eeAddress += sizeof(float); //Move address to the next byte after float 'f'.
EEPROM.put( eeAddress, customVar );
Serial.print( "Written custom data type! \n\nView the example sketch eeprom_get to see how you can retrieve the values!" );
}
void loop(){ /* Empty loop */ }

View File

@ -31,13 +31,27 @@ void loop()
Serial.print(value, DEC);
Serial.println();
// advance to the next address of the EEPROM
/***
Advance to the next address, when at the end restart at the beginning.
Larger AVR processors have larger EEPROM sizes, E.g:
- Arduno Duemilanove: 512b EEPROM storage.
- Arduino Uno: 1kb EEPROM storage.
- Arduino Mega: 4kb EEPROM storage.
Rather than hard-coding the length, you should use the pre-provided length function.
This will make your code portable to all AVR processors.
***/
address = address + 1;
// there are only 512 bytes of EEPROM, from 0 to 511, so if we're
// on address 512, wrap around to address 0
if (address == 512)
if(address == EEPROM.length())
address = 0;
/***
As the EEPROM sizes are powers of two, wrapping (preventing overflow) of an
EEPROM address is also doable by a bitwise and of the length - 1.
++address &= EEPROM.length() - 1;
***/
delay(500);
}

View File

@ -0,0 +1,69 @@
/***
EEPROM Update method
Stores values read from analog input 0 into the EEPROM.
These values will stay in the EEPROM when the board is
turned off and may be retrieved later by another sketch.
If a value has not changed in the EEPROM, it is not overwritten
which would reduce the life span of the EEPROM unnecessarily.
Released using MIT licence.
***/
#include <EEPROM.h>
/** the current address in the EEPROM (i.e. which byte we're going to write to next) **/
int address = 0;
void setup(){ /** EMpty setup **/ }
void loop()
{
/***
need to divide by 4 because analog inputs range from
0 to 1023 and each byte of the EEPROM can only hold a
value from 0 to 255.
***/
int val = analogRead(0) / 4;
/***
Update the particular EEPROM cell.
these values will remain there when the board is
turned off.
***/
EEPROM.update(address, val);
/***
The function EEPROM.update(address, val) is equivalent to the following:
if( EEPROM.read(address) != val ){
EEPROM.write(address, val);
}
***/
/***
Advance to the next address, when at the end restart at the beginning.
Larger AVR processors have larger EEPROM sizes, E.g:
- Arduno Duemilanove: 512b EEPROM storage.
- Arduino Uno: 1kb EEPROM storage.
- Arduino Mega: 4kb EEPROM storage.
Rather than hard-coding the length, you should use the pre-provided length function.
This will make your code portable to all AVR processors.
***/
address = address + 1;
if(address == EEPROM.length())
address = 0;
/***
As the EEPROM sizes are powers of two, wrapping (preventing overflow) of an
EEPROM address is also doable by a bitwise and of the length - 1.
++address &= EEPROM.length() - 1;
***/
delay(100);
}

View File

@ -8,31 +8,51 @@
#include <EEPROM.h>
// the current address in the EEPROM (i.e. which byte
// we're going to write to next)
int addr = 0;
/** the current address in the EEPROM (i.e. which byte we're going to write to next) **/
int addr = 0;
void setup()
{
}
void setup(){ /** Empty setup. **/}
void loop()
{
// need to divide by 4 because analog inputs range from
// 0 to 1023 and each byte of the EEPROM can only hold a
// value from 0 to 255.
/***
Need to divide by 4 because analog inputs range from
0 to 1023 and each byte of the EEPROM can only hold a
value from 0 to 255.
***/
int val = analogRead(0) / 4;
// write the value to the appropriate byte of the EEPROM.
// these values will remain there when the board is
// turned off.
/***
Write the value to the appropriate byte of the EEPROM.
these values will remain there when the board is
turned off.
***/
EEPROM.write(addr, val);
// advance to the next address. there are 512 bytes in
// the EEPROM, so go back to 0 when we hit 512.
/***
Advance to the next address, when at the end restart at the beginning.
Larger AVR processors have larger EEPROM sizes, E.g:
- Arduno Duemilanove: 512b EEPROM storage.
- Arduino Uno: 1kb EEPROM storage.
- Arduino Mega: 4kb EEPROM storage.
Rather than hard-coding the length, you should use the pre-provided length function.
This will make your code portable to all AVR processors.
***/
addr = addr + 1;
if (addr == 512)
if(addr == EEPROM.length())
addr = 0;
/***
As the EEPROM sizes are powers of two, wrapping (preventing overflow) of an
EEPROM address is also doable by a bitwise and of the length - 1.
++addr &= EEPROM.length() - 1;
***/
delay(100);
}

View File

@ -1,5 +1,5 @@
#######################################
# Syntax Coloring Map For Ultrasound
# Syntax Coloring Map For EEPROM
#######################################
#######################################
@ -7,11 +7,15 @@
#######################################
EEPROM KEYWORD1
EERef KEYWORD1
EEPtr KEYWORD2
#######################################
# Methods and Functions (KEYWORD2)
#######################################
update KEYWORD2
#######################################
# Constants (LITERAL1)
#######################################

View File

@ -1,8 +1,10 @@
name=EEPROM
version=1.0
author=Arduino
version=2.0
author=Arduino, Christopher Andrews
maintainer=Arduino <info@arduino.cc>
sentence=Enables reading and writing to the permanent board storage. For all Arduino boards BUT Arduino DUE.
paragraph=
url=http://arduino.cc/en/Reference/EEPROM
architectures=avr
types=Arduino

View File

@ -29,7 +29,15 @@ void SPIClass::begin()
noInterrupts(); // Protect from a scheduler and prevent transactionBegin
if (!initialized) {
// Set SS to high so a connected chip will be "deselected" by default
digitalWrite(SS, HIGH);
uint8_t port = digitalPinToPort(SS);
uint8_t bit = digitalPinToBitMask(SS);
volatile uint8_t *reg = portModeRegister(port);
// if the SS pin is not already configured as an output
// then set it high (to enable the internal pull-up resistor)
if(!(*reg & bit)){
digitalWrite(SS, HIGH);
}
// When the SS pin is set as OUTPUT, it can be used as
// a general purpose output port (it doesn't influence

View File

@ -6,3 +6,5 @@ sentence=Enables the communication with devices that use the Serial Peripheral I
paragraph=
url=http://arduino.cc/en/Reference/SPI
architectures=avr
types=Arduino

View File

@ -6,3 +6,5 @@ sentence=Enables serial communication on digital pins. For all Arduino boards, B
paragraph=
url=http://arduino.cc/en/Reference/SoftwareSerial
architectures=avr
types=Arduino

View File

@ -20,7 +20,7 @@ void setup()
void loop()
{
Wire.requestFrom(2, 6); // request 6 bytes from slave device #2
Wire.requestFrom(8, 6); // request 6 bytes from slave device #8
while (Wire.available()) // slave may send less than requested
{

View File

@ -21,7 +21,7 @@ byte x = 0;
void loop()
{
Wire.beginTransmission(4); // transmit to device #4
Wire.beginTransmission(8); // transmit to device #8
Wire.write("x is "); // sends five bytes
Wire.write(x); // sends one byte
Wire.endTransmission(); // stop transmitting

View File

@ -14,7 +14,7 @@
void setup()
{
Wire.begin(4); // join i2c bus with address #4
Wire.begin(8); // join i2c bus with address #8
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
}

View File

@ -14,7 +14,7 @@
void setup()
{
Wire.begin(2); // join i2c bus with address #2
Wire.begin(8); // join i2c bus with address #8
Wire.onRequest(requestEvent); // register event
}

View File

@ -6,3 +6,5 @@ sentence=Allows the communication between devices or sensors connected via Two W
paragraph=
url=http://arduino.cc/en/Reference/Wire
architectures=avr
types=Arduino

View File

@ -1,27 +1,33 @@
# Arduino AVR Core and platform.
# ------------------------------
#
# For more info:
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
name=Arduino AVR Boards
version=1.6.1
version=1.6.7
# AVR compile variables
# ---------------------
compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
# Default "compiler.path" is correct, change only if you want to overidde the initial value
compiler.path={runtime.ide.path}/hardware/tools/avr/bin/
compiler.path={runtime.tools.avr-gcc.path}/bin/
compiler.c.cmd=avr-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD
compiler.c.flags=-c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -MMD
# -w flag added to avoid printing a wrong warning http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396
# This is fixed in gcc 4.8.3 and will be removed as soon as we update the toolchain
compiler.c.elf.flags=-w -Os -Wl,--gc-sections
compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections
compiler.c.elf.cmd=avr-gcc
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=avr-g++
compiler.cpp.flags=-c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
compiler.ar.cmd=avr-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=avr-objcopy
@ -65,6 +71,10 @@ recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.f
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
## Save hex
recipe.output.tmp_file={build.project_name}.hex
recipe.output.save_file={build.project_name}.{build.variant}.hex
## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
@ -75,8 +85,9 @@ recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
# AVR Uploader/Programmers tools
# ------------------------------
tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf
tools.avrdude.path={runtime.tools.avrdude.path}
tools.avrdude.cmd.path={path}/bin/avrdude
tools.avrdude.config.path={path}/etc/avrdude.conf
tools.avrdude.upload.params.verbose=-v
tools.avrdude.upload.params.quiet=-q -q

View File

@ -44,3 +44,10 @@ arduinoasisp.program.protocol=stk500v1
arduinoasisp.program.speed=19200
arduinoasisp.program.tool=avrdude
arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed}
usbGemma.name=Arduino Gemma
usbGemma.protocol=arduinogemma
usbGemma.program.tool=avrdude
usbGemma.program.extra_params=
usbGemma.config.path={runtime.platform.path}/bootloaders/gemma/avrdude.conf

View File

@ -0,0 +1,131 @@
/*
pins_arduino.c - pin definitions for the Arduino board
Part of Arduino / Wiring Lite
Copyright (c) 2005 David A. Mellis
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: pins_arduino.c 565 2009-03-25 10:50:00Z dmellis $
Modified 28-08-2009 for attiny84 R.Wiersma
Modified 09-10-2009 for attiny45 A.Saporetti
*/
#ifndef Pins_Arduino_h
#define Pins_Arduino_h
#include <avr/pgmspace.h>
// Defines to make D4 support PWM
// See for more info: http://forums.adafruit.com/viewtopic.php?f=52&t=43951
//#define TCCR1A GTCCR
//#define WGM10 PWM1B
// ATMEL ATTINY45 / ARDUINO
//
// +-\/-+
// Ain0 (D 5) PB5 1| |8 Vcc
// Ain3 (D 3) PB3 2| |7 PB2 (D 2) Ain1
// Ain2 (D 4) PB4 3| |6 PB1 (D 1) pwm1
// GND 4| |5 PB0 (D 0) pwm0
// +----+
static const uint8_t A0 = 6;
static const uint8_t A1 = 7;
static const uint8_t A2 = 8;
static const uint8_t A3 = 9;
#define digitalPinToPCICR(p) ( ((p) >= 0 && (p) <= 4) ? (&GIMSK) : ((uint8_t *)0) )
#define digitalPinToPCICRbit(p) ( PCIE )
#define digitalPinToPCMSK(p) ( ((p) <= 4) ? (&PCMSK) : ((uint8_t *)0) )
#define digitalPinToPCMSKbit(p) ( (p) )
#define analogPinToChannel(p) ( (p) < 6 ? (p) : (p) - 6 )
#define TCCR1A GTCCR
#ifdef ARDUINO_MAIN
void initVariant()
{
GTCCR |= (1 << PWM1B);
}
// these arrays map port names (e.g. port B) to the
// appropriate addresses for various functions (e.g. reading
// and writing) tiny45 only port B
const uint16_t PROGMEM port_to_mode_PGM[] = {
NOT_A_PORT,
NOT_A_PORT,
(uint16_t) &DDRB,
};
const uint16_t PROGMEM port_to_output_PGM[] = {
NOT_A_PORT,
NOT_A_PORT,
(uint16_t) &PORTB,
};
const uint16_t PROGMEM port_to_input_PGM[] = {
NOT_A_PIN,
NOT_A_PIN,
(uint16_t) &PINB,
};
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
PB, /* 0 */
PB,
PB,
PB,
PB,
PB, // 5
PB, // A0
PB,
PB,
PB, // A4
};
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
_BV(0), /* 0, port B */
_BV(1),
_BV(2),
_BV(3), /* 3 port B */
_BV(4),
_BV(5),
_BV(5),
_BV(2),
_BV(4),
_BV(3),
};
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
TIMER0A, /* OC0A */
TIMER0B,
NOT_ON_TIMER,
NOT_ON_TIMER,
TIMER1B,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
};
#endif
#endif

View File

@ -4,7 +4,6 @@ arduino_due_x_dbg.vid.0=0x2341
arduino_due_x_dbg.pid.0=0x003d
arduino_due_x_dbg.vid.1=0x2A03
arduino_due_x_dbg.pid.1=0x003d
arduino_due_x_dbg.vid.0x2A03.warning=Uncertified
arduino_due_x_dbg.upload.tool=bossac
arduino_due_x_dbg.upload.protocol=sam-ba
arduino_due_x_dbg.upload.maximum_size=524288
@ -28,7 +27,6 @@ arduino_due_x.vid.0=0x2341
arduino_due_x.pid.0=0x003e
arduino_due_x.vid.1=0x2A03
arduino_due_x.pid.1=0x003e
arduino_due_x.vid.0x2A03.warning=Uncertified
arduino_due_x.upload.tool=bossac
arduino_due_x.upload.protocol=sam-ba
arduino_due_x.upload.maximum_size=524288

View File

@ -194,6 +194,8 @@ extern const PinDescription g_APinDescription[] ;
#include "wiring_shift.h"
#include "WInterrupts.h"
#include "watchdog.h"
// USB Device
#define USB_VID 0x2341 // arduino LLC vid
#define USB_PID_LEONARDO 0x0034

View File

@ -18,6 +18,8 @@
Created July 2011
parsing functions based on TextFinder library by Michael Margolis
findMulti/findUntil routines written by Jim Leonard/Xuth
*/
#include "Arduino.h"
@ -75,7 +77,7 @@ void Stream::setTimeout(unsigned long timeout) // sets the maximum number of mi
// find returns true if the target string is found
bool Stream::find(char *target)
{
return findUntil(target, (char*)"");
return findUntil(target, strlen(target), NULL, 0);
}
// reads data from the stream until the target string of given length is found
@ -96,32 +98,13 @@ bool Stream::findUntil(char *target, char *terminator)
// returns true if target string is found, false if terminated or timed out
bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t termLen)
{
size_t index = 0; // maximum target string length is 64k bytes!
size_t termIndex = 0;
int c;
if( *target == 0)
return true; // return true if target is a null string
while( (c = timedRead()) > 0){
if(c != target[index])
index = 0; // reset index if any char does not match
if( c == target[index]){
//////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1);
if(++index >= targetLen){ // return true if all chars in the target match
return true;
}
}
if(termLen > 0 && c == terminator[termIndex]){
if(++termIndex >= termLen)
return false; // return false if terminate string found before target string
}
else
termIndex = 0;
if (terminator == NULL) {
MultiTarget t[1] = {{target, targetLen, 0}};
return findMulti(t, 1) == 0 ? true : false;
} else {
MultiTarget t[2] = {{target, targetLen, 0}, {terminator, termLen, 0}};
return findMulti(t, 2) == 0 ? true : false;
}
return false;
}
@ -137,7 +120,7 @@ long Stream::parseInt()
// this allows format characters (typically commas) in values to be ignored
long Stream::parseInt(char skipChar)
{
boolean isNegative = false;
bool isNegative = false;
long value = 0;
int c;
@ -173,10 +156,10 @@ float Stream::parseFloat()
// as above but the given skipChar is ignored
// this allows format characters (typically commas) in values to be ignored
float Stream::parseFloat(char skipChar){
boolean isNegative = false;
boolean isFraction = false;
bool isNegative = false;
bool isFraction = false;
long value = 0;
int c;
char c;
float fraction = 1.0;
c = peekNextDigit();
@ -268,3 +251,67 @@ String Stream::readStringUntil(char terminator)
return ret;
}
int Stream::findMulti( struct Stream::MultiTarget *targets, int tCount) {
// any zero length target string automatically matches and would make
// a mess of the rest of the algorithm.
for (struct MultiTarget *t = targets; t < targets+tCount; ++t) {
if (t->len <= 0)
return t - targets;
}
while (1) {
int c = timedRead();
if (c < 0)
return -1;
for (struct MultiTarget *t = targets; t < targets+tCount; ++t) {
// the simple case is if we match, deal with that first.
if (c == t->str[t->index]) {
if (++t->index == t->len)
return t - targets;
else
continue;
}
// if not we need to walk back and see if we could have matched further
// down the stream (ie '1112' doesn't match the first position in '11112'
// but it will match the second position so we can't just reset the current
// index to 0 when we find a mismatch.
if (t->index == 0)
continue;
int origIndex = t->index;
do {
--t->index;
// first check if current char works against the new current index
if (c != t->str[t->index])
continue;
// if it's the only char then we're good, nothing more to check
if (t->index == 0) {
t->index++;
break;
}
// otherwise we need to check the rest of the found string
int diff = origIndex - t->index;
size_t i;
for (i = 0; i < t->index; ++i) {
if (t->str[i] != t->str[i + diff])
break;
}
// if we successfully got through the previous loop then our current
// index is good.
if (i == t->index) {
t->index++;
break;
}
// otherwise we just try the next index
} while (t->index);
}
}
// unreachable
return -1;
}

View File

@ -97,6 +97,16 @@ class Stream : public Print
// this allows format characters (typically commas) in values to be ignored
float parseFloat(char skipChar); // as above but the given skipChar is ignored
struct MultiTarget {
const char *str; // string you're searching for
size_t len; // length of string you're searching for
size_t index; // index used by the search routine.
};
// This allows you to search for an arbitrary number of strings.
// Returns index of the target that is found first or -1 if timeout occurs.
int findMulti(struct MultiTarget *targets, int tCount);
};
#endif

View File

@ -41,6 +41,9 @@ void initVariant() { }
*/
int main( void )
{
// Initialize watchdog
watchdogSetup();
init();
initVariant();

View File

@ -0,0 +1,55 @@
/*
Copyright (c) 2014 Arduino. All right reserved.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <chip.h>
#include "watchdog.h"
void watchdogEnable (uint32_t timeout)
{
/* this assumes the slow clock is running at 32.768 kHz
watchdog frequency is therefore 32768 / 128 = 256 Hz */
timeout = timeout * 256 / 1000;
if (timeout == 0)
timeout = 1;
else if (timeout > 0xFFF)
timeout = 0xFFF;
timeout = WDT_MR_WDRSTEN | WDT_MR_WDV(timeout) | WDT_MR_WDD(timeout);
WDT_Enable (WDT, timeout);
}
void watchdogDisable(void)
{
WDT_Disable (WDT);
}
void watchdogReset(void)
{
WDT_Restart (WDT);
}
extern "C"
void _watchdogDefaultSetup (void)
{
WDT_Disable (WDT);
}
void watchdogSetup (void) __attribute__ ((weak, alias("_watchdogDefaultSetup")));

View File

@ -0,0 +1,52 @@
/*
Copyright (c) 2014 Arduino. All right reserved.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _WATCHDOG_
#define _WATCHDOG_
#include <stdint.h>
// Watchdog functions
/*
* \brief Enable the watchdog with the specified timeout. Should only be called once.
*
* \param timeount in milliseconds.
*/
void watchdogEnable (uint32_t timeout);
/*
* \brief Disable the watchdog timer. Should only be called once.
*
*/
void watchdogDisable (void);
/*
* \brief Reset the watchdog counter.
*
*/
void watchdogReset (void);
/*
* \brief Watchdog initialize hook. This function is called from init(). If the user does not provide
* this function, then the default action is to disable watchdog.
*/
void watchdogSetup (void);
#endif /* _WATCHDOG_ */

View File

@ -6,3 +6,5 @@ sentence=Enables the communication with devices that use the Serial Peripheral I
paragraph=
url=http://arduino.cc/en/Reference/SPI
architectures=sam
types=Arduino

View File

@ -6,3 +6,5 @@ sentence=Allows the communication between devices or sensors connected via Two W
paragraph=
url=http://arduino.cc/en/Reference/Wire
architectures=sam
types=Arduino

View File

@ -1,23 +1,30 @@
# Arduino SAM Core and platform.
# ------------------------------
#
# For more info:
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
name=Arduino ARM (32-bits) Boards
version=1.6.1
version=1.6.4
# SAM3 compile variables
# ----------------------
compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
compiler.warning_flags=-w
compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
compiler.c.cmd=arm-none-eabi-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -MMD
compiler.c.flags=-c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -MMD
compiler.c.elf.cmd=arm-none-eabi-gcc
compiler.c.elf.flags=-Os -Wl,--gc-sections
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=arm-none-eabi-g++
compiler.cpp.flags=-c -g -Os -w -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -MMD
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -Dprintf=iprintf -MMD
compiler.ar.cmd=arm-none-eabi-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=arm-none-eabi-objcopy
@ -68,6 +75,10 @@ recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.f
## Create output (.bin file)
recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
## Save hex
recipe.output.tmp_file={build.project_name}.bin
recipe.output.save_file={build.project_name}.{build.variant}.bin
## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=\.text\s+([0-9]+).*
@ -76,9 +87,9 @@ recipe.size.regex=\.text\s+([0-9]+).*
# SAM3 Uploader tools
# -------------------
tools.bossac.path={runtime.tools.bossac.path}
tools.bossac.cmd=bossac
tools.bossac.cmd.windows=bossac.exe
tools.bossac.path={runtime.ide.path}/hardware/tools
tools.bossac.upload.params.verbose=-i -d
tools.bossac.upload.params.quiet=

View File

@ -377,9 +377,6 @@ void init( void )
while (true);
}
// Disable watchdog
WDT_Disable(WDT);
// Initialize C library
__libc_init_array();

View File

@ -38,7 +38,6 @@ extern "C" {
#include "pgmspace.h"
#include "esp8266_peri.h"
#include "twi.h"
//#include "spiffs/spiffs.h"
void yield(void);

View File

@ -20,60 +20,126 @@
*/
#include "FileSystem.h"
#include "Arduino.h"
#include "spiffs/spiffs_esp8266.h"
bool FSClass::mount() {
if(SPIFFS_mounted(&_filesystemStorageHandle)) return true;
int res = spiffs_mount();
if(res != 0){
int formated = SPIFFS_format(&_filesystemStorageHandle);
if(formated != 0) return false;
res = spiffs_mount();
}
return (res == 0);
#define LOGICAL_PAGE_SIZE 256
#define LOGICAL_BLOCK_SIZE 512
// These addresses are defined in the linker script.
// For each flash memory size there is a linker script variant
// which sets spiffs location and size.
extern "C" uint32_t _SPIFFS_start;
extern "C" uint32_t _SPIFFS_end;
static s32_t api_spiffs_read(u32_t addr, u32_t size, u8_t *dst);
static s32_t api_spiffs_write(u32_t addr, u32_t size, u8_t *src);
static s32_t api_spiffs_erase(u32_t addr, u32_t size);
FSClass FS((uint32_t) &_SPIFFS_start, (uint32_t) &_SPIFFS_end, 4);
FSClass::FSClass(uint32_t beginAddress, uint32_t endAddress, uint32_t maxOpenFiles)
: _beginAddress(beginAddress)
, _endAddress(endAddress)
, _maxOpenFiles(maxOpenFiles)
, _fs({0})
{
}
int FSClass::_mountInternal(){
if (_beginAddress == 0 || _beginAddress >= _endAddress){
SPIFFS_API_DBG_E("Can't start file system, wrong address\r\n");
return SPIFFS_ERR_NOT_CONFIGURED;
}
spiffs_config cfg = {0};
cfg.phys_addr = _beginAddress;
cfg.phys_size = _endAddress - _beginAddress;
cfg.phys_erase_block = INTERNAL_FLASH_SECTOR_SIZE;
cfg.log_block_size = LOGICAL_BLOCK_SIZE;
cfg.log_page_size = LOGICAL_PAGE_SIZE;
cfg.hal_read_f = api_spiffs_read;
cfg.hal_write_f = api_spiffs_write;
cfg.hal_erase_f = api_spiffs_erase;
SPIFFS_API_DBG_V("FSClass::_mountInternal: start:%x, size:%d Kb\n", cfg.phys_addr, cfg.phys_size / 1024);
_work.reset(new uint8_t[LOGICAL_BLOCK_SIZE]);
_fdsSize = 32 * _maxOpenFiles;
_fds.reset(new uint8_t[_fdsSize]);
_cacheSize = (32 + LOGICAL_PAGE_SIZE) * _maxOpenFiles;
_cache.reset(new uint8_t[_cacheSize]);
s32_t res = SPIFFS_mount(&_fs,
&cfg,
_work.get(),
_fds.get(),
_fdsSize,
_cache.get(),
_cacheSize,
NULL);
SPIFFS_API_DBG_V("FSClass::_mountInternal: %d\n", res);
return res;
}
bool FSClass::mount() {
if(SPIFFS_mounted(&_fs))
return true;
int res = _mountInternal();
if(res != SPIFFS_OK){
int formated = SPIFFS_format(&_fs);
if(formated != SPIFFS_OK)
return false;
res = _mountInternal();
}
return (res == SPIFFS_OK);
}
// TODO: need to invalidate open file objects
void FSClass::unmount() {
if(SPIFFS_mounted(&_filesystemStorageHandle))
SPIFFS_unmount(&_filesystemStorageHandle);
if(SPIFFS_mounted(&_fs))
SPIFFS_unmount(&_fs);
}
bool FSClass::format() {
if(!SPIFFS_mounted(&_filesystemStorageHandle)){
spiffs_mount();
if(!SPIFFS_mounted(&_fs)){
_mountInternal();
}
SPIFFS_unmount(&_filesystemStorageHandle);
int formated = SPIFFS_format(&_filesystemStorageHandle);
if(formated != 0) return false;
return (spiffs_mount() == 0);
SPIFFS_unmount(&_fs);
int formated = SPIFFS_format(&_fs);
if(formated != SPIFFS_OK)
return false;
return (_mountInternal() == SPIFFS_OK);
}
bool FSClass::check() {
return SPIFFS_check(&_filesystemStorageHandle) == 0;
return SPIFFS_check(&_fs) == SPIFFS_OK;
}
bool FSClass::exists(char *filename) {
spiffs_stat stat = {0};
if (SPIFFS_stat(&_filesystemStorageHandle, filename, &stat) < 0)
if (SPIFFS_stat(&_fs, filename, &stat) < 0)
return false;
return stat.name[0] != '\0';
}
bool FSClass::create(char *filepath){
return SPIFFS_creat(&_filesystemStorageHandle, filepath, 0) == 0;
return SPIFFS_creat(&_fs, filepath, 0) == SPIFFS_OK;
}
bool FSClass::remove(char *filepath){
return SPIFFS_remove(&_filesystemStorageHandle, filepath) == 0;
return SPIFFS_remove(&_fs, filepath) == SPIFFS_OK;
}
bool FSClass::rename(char *filename, char *newname) {
return SPIFFS_rename(&_filesystemStorageHandle, filename, newname) == 0;
return SPIFFS_rename(&_fs, filename, newname) == SPIFFS_OK;
}
size_t FSClass::totalBytes(){
u32_t totalBytes;
u32_t usedBytes;
if(SPIFFS_info(&_filesystemStorageHandle, &totalBytes, &usedBytes) == 0)
if(SPIFFS_info(&_fs, &totalBytes, &usedBytes) == SPIFFS_OK)
return totalBytes;
return 0;
}
@ -81,13 +147,16 @@ size_t FSClass::totalBytes(){
size_t FSClass::usedBytes(){
u32_t totalBytes;
u32_t usedBytes;
if(SPIFFS_info(&_filesystemStorageHandle, &totalBytes, &usedBytes) == 0)
if(SPIFFS_info(&_fs, &totalBytes, &usedBytes) == SPIFFS_OK)
return usedBytes;
return 0;
}
FSFile FSClass::open(char *filename, uint8_t mode) {
if(String(filename) == "" || String(filename) == "/") return FSFile("/");
if(strcmp(filename, "") == 0 ||
strcmp(filename, "/") == 0)
return FSFile(&_fs, "/");
int repeats = 0;
bool notExist;
bool canRecreate = (mode & SPIFFS_CREAT) == SPIFFS_CREAT;
@ -95,8 +164,8 @@ FSFile FSClass::open(char *filename, uint8_t mode) {
do{
notExist = false;
res = SPIFFS_open(&_filesystemStorageHandle, filename, (spiffs_flags)mode, 0);
int code = SPIFFS_errno(&_filesystemStorageHandle);
res = SPIFFS_open(&_fs, filename, (spiffs_flags)mode, 0);
int code = SPIFFS_errno(&_fs);
if (res < 0){
SPIFFS_API_DBG_E("open errno %d\n", code);
notExist = (code == SPIFFS_ERR_NOT_FOUND || code == SPIFFS_ERR_DELETED || code == SPIFFS_ERR_FILE_DELETED || code == SPIFFS_ERR_IS_FREE);
@ -106,63 +175,68 @@ FSFile FSClass::open(char *filename, uint8_t mode) {
} while (notExist && canRecreate && repeats++ < 3);
if(res){
return FSFile(res);
return FSFile(&_fs, res);
}
return FSFile();
}
FSFile FSClass::open(spiffs_dirent* entry, uint8_t mode){
int res = SPIFFS_open_by_dirent(&_filesystemStorageHandle, entry, (spiffs_flags)mode, 0);
if(res){
return FSFile(res);
int res = SPIFFS_open_by_dirent(&_fs, entry, (spiffs_flags)mode, 0);
if (res){
return FSFile(&_fs, res);
}
return FSFile();
}
FSClass FS;
FSFile::FSFile() {
_file = 0;
_stats = {0};
FSFile::FSFile()
: _file(0)
, _stats({0})
, _fs(0)
{
}
FSFile::FSFile(String path) {
FSFile::FSFile(spiffs* fs, String path)
: _fs(fs)
{
if(path == "/"){
_file = 0x1;
os_sprintf((char*)_stats.name, "%s", (char*)path.c_str());
_stats.size = 0;
_stats.type = SPIFFS_TYPE_DIR;
SPIFFS_opendir(&_filesystemStorageHandle, (char*)_stats.name, &_dir);
SPIFFS_opendir(_fs, (char*)_stats.name, &_dir);
} else {
_file = SPIFFS_open(&_filesystemStorageHandle, (char *)path.c_str(), (spiffs_flags)FSFILE_READ, 0);
if(SPIFFS_fstat(&_filesystemStorageHandle, _file, &_stats) != 0){
SPIFFS_API_DBG_E("fstat errno %d\n", SPIFFS_errno(&_filesystemStorageHandle));
_file = SPIFFS_open(_fs, (char *)path.c_str(), (spiffs_flags)FSFILE_READ, 0);
if(SPIFFS_fstat(_fs, _file, &_stats) != 0){
SPIFFS_API_DBG_E("fstat errno %d\n", SPIFFS_errno(_fs));
}
//debugf("FSFile name: %s, size: %d, type: %d\n", _stats.name, _stats.size, _stats.type);
if(_stats.type == SPIFFS_TYPE_DIR){
SPIFFS_opendir(&_filesystemStorageHandle, (char*)_stats.name, &_dir);
SPIFFS_opendir(_fs, (char*)_stats.name, &_dir);
}
}
}
FSFile::FSFile(file_t f) {
_file = f;
if(SPIFFS_fstat(&_filesystemStorageHandle, _file, &_stats) != 0){
SPIFFS_API_DBG_E("fstat errno %d\n", SPIFFS_errno(&_filesystemStorageHandle));
FSFile::FSFile(spiffs* fs, file_t f)
: _file(f)
, _fs(fs)
{
if(SPIFFS_fstat(_fs, _file, &_stats) != 0){
SPIFFS_API_DBG_E("fstat errno %d\n", SPIFFS_errno(_fs));
}
//debugf("FSFile name: %s, size: %d, type: %d\n", _stats.name, _stats.size, _stats.type);
if(_stats.type == SPIFFS_TYPE_DIR){
SPIFFS_opendir(&_filesystemStorageHandle, (char*)_stats.name, &_dir);
SPIFFS_opendir(_fs, (char*)_stats.name, &_dir);
}
}
void FSFile::close() {
if (! _file) return;
if (!_file)
return;
if(_stats.type == SPIFFS_TYPE_DIR){
SPIFFS_closedir(&_dir);
}
if(os_strlen((char*)_stats.name) > 1)
SPIFFS_close(&_filesystemStorageHandle, _file);
SPIFFS_close(_fs, _file);
_file = 0;
}
@ -175,97 +249,138 @@ bool FSFile::isDirectory(void) {
}
void FSFile::rewindDirectory() {
if (!_file || !isDirectory()) return;
if (!_file || !isDirectory())
return;
SPIFFS_closedir(&_dir);
SPIFFS_opendir(&_filesystemStorageHandle, (char*)_stats.name, &_dir);
SPIFFS_opendir(_fs, (char*)_stats.name, &_dir);
}
FSFile FSFile::openNextFile(){
if (!_file || !isDirectory()) return FSFile();
if (!_file || !isDirectory())
return FSFile();
struct spiffs_dirent e;
struct spiffs_dirent *pe = &e;
if ((pe = SPIFFS_readdir(&_dir, pe))){
// TODO: store actual FS pointer
return FS.open((char *)pe->name);
}
return FSFile();
}
uint32_t FSFile::size() {
if(!_file) return 0;
if(_stats.size) return _stats.size;
uint32_t pos = SPIFFS_tell(&_filesystemStorageHandle, _file);
SPIFFS_lseek(&_filesystemStorageHandle, _file, 0, SPIFFS_SEEK_END);
_stats.size = SPIFFS_tell(&_filesystemStorageHandle, _file);
SPIFFS_lseek(&_filesystemStorageHandle, _file, pos, SPIFFS_SEEK_SET);
if(!_file)
return 0;
if(_stats.size)
return _stats.size;
uint32_t pos = SPIFFS_tell(_fs, _file);
SPIFFS_lseek(_fs, _file, 0, SPIFFS_SEEK_END);
_stats.size = SPIFFS_tell(_fs, _file);
SPIFFS_lseek(_fs, _file, pos, SPIFFS_SEEK_SET);
return _stats.size;
}
int FSFile::available() {
if (!_file) return 0;
uint32_t pos = SPIFFS_tell(&_filesystemStorageHandle, _file);
if (!_file)
return 0;
uint32_t pos = SPIFFS_tell(_fs, _file);
return size() - pos;
}
uint32_t FSFile::seek(uint32_t pos) {
if (!_file) return 0;
return SPIFFS_lseek(&_filesystemStorageHandle, _file, pos, SPIFFS_SEEK_SET);
if (!_file)
return 0;
return SPIFFS_lseek(_fs, _file, pos, SPIFFS_SEEK_SET);
}
uint32_t FSFile::position() {
if (!_file) return 0;
return SPIFFS_tell(&_filesystemStorageHandle, _file);
if (!_file)
return 0;
return SPIFFS_tell(_fs, _file);
}
bool FSFile::eof() {
if (!_file) return 0;
return SPIFFS_eof(&_filesystemStorageHandle, _file);
if (!_file)
return 0;
return SPIFFS_eof(_fs, _file);
}
int FSFile::read(void *buf, uint16_t nbyte) {
if (! _file || isDirectory()) return -1;
return SPIFFS_read(&_filesystemStorageHandle, _file, buf, nbyte);
if (!_file || isDirectory())
return -1;
return SPIFFS_read(_fs, _file, buf, nbyte);
}
int FSFile::read() {
if (! _file || isDirectory()) return -1;
if (! _file || isDirectory())
return -1;
int val;
if(SPIFFS_read(&_filesystemStorageHandle, _file, &val, 1) != 1) return -1;
if(SPIFFS_read(_fs, _file, &val, 1) != 1) return -1;
return val;
}
int FSFile::peek() {
if (! _file || isDirectory()) return 0;
if (!_file || isDirectory())
return 0;
int c = read();
SPIFFS_lseek(&_filesystemStorageHandle, _file, -1, SPIFFS_SEEK_CUR);
SPIFFS_lseek(_fs, _file, -1, SPIFFS_SEEK_CUR);
return c;
}
size_t FSFile::write(const uint8_t *buf, size_t size){
if (! _file || isDirectory()) return 0;
int res = SPIFFS_write(&_filesystemStorageHandle, _file, (uint8_t *)buf, size);
if (!_file || isDirectory())
return 0;
int res = SPIFFS_write(_fs, _file, (uint8_t *)buf, size);
return (res > 0)?(size_t)res:0;
}
size_t FSFile::write(uint8_t val) {
if (! _file || isDirectory()) return 0;
if (!_file || isDirectory())
return 0;
return write(&val, 1);
}
void FSFile::flush(){
if (! _file || isDirectory()) return;
SPIFFS_fflush(&_filesystemStorageHandle, _file);
if (!_file || isDirectory())
return;
SPIFFS_fflush(_fs, _file);
}
bool FSFile::remove(){
if (! _file) return 0;
if (!_file)
return 0;
close();
return SPIFFS_remove(&_filesystemStorageHandle, (char *)_stats.name) == 0;
return SPIFFS_remove(_fs, (char *)_stats.name) == 0;
}
int FSFile::lastError(){
return SPIFFS_errno(&_filesystemStorageHandle);
return SPIFFS_errno(_fs);
}
void FSFile::clearError(){
_filesystemStorageHandle.err_code = SPIFFS_OK;
_fs->err_code = SPIFFS_OK;
}
static s32_t api_spiffs_read(u32_t addr, u32_t size, u8_t *dst){
SPIFFS_API_DBG_V("api_spiffs_read: 0x%08x len: %u\n", addr, size);
flashmem_read(dst, addr, size);
return SPIFFS_OK;
}
static s32_t api_spiffs_write(u32_t addr, u32_t size, u8_t *src){
SPIFFS_API_DBG_V("api_spiffs_write: 0x%08x len: %u\n", addr, size);
flashmem_write(src, addr, size);
return SPIFFS_OK;
}
static s32_t api_spiffs_erase(u32_t addr, u32_t size){
SPIFFS_API_DBG_V("api_spiffs_erase: 0x%08x len: %u\n", addr, size);
u32_t sect_first = flashmem_get_sector_of_address(addr);
u32_t sect_last = flashmem_get_sector_of_address(addr+size);
while( sect_first <= sect_last )
if( !flashmem_erase_sector( sect_first ++ ) )
return SPIFFS_ERR_INTERNAL;
return SPIFFS_OK;
}

View File

@ -21,9 +21,9 @@
#ifndef _SPIFFS_CORE_FILESYSTEM_H_
#define _SPIFFS_CORE_FILESYSTEM_H_
#include <memory>
#include "spiffs/spiffs.h"
#include "Arduino.h"
class String;
#define FSFILE_READ SPIFFS_RDONLY
#define FSFILE_WRITE (SPIFFS_RDONLY | SPIFFS_WRONLY | SPIFFS_CREAT | SPIFFS_APPEND )
@ -34,10 +34,11 @@ private:
spiffs_stat _stats;
file_t _file;
spiffs_DIR _dir;
spiffs * _fs;
public:
FSFile(String path);
FSFile(file_t f);
FSFile(spiffs* fs, String path);
FSFile(spiffs* fs, file_t f);
FSFile(void);
virtual size_t write(uint8_t);
virtual size_t write(const uint8_t *buf, size_t size);
@ -83,10 +84,9 @@ public:
};
class FSClass {
private:
public:
FSClass(uint32_t beginAddress, uint32_t endAddress, uint32_t maxOpenFiles);
bool mount();
void unmount();
bool format();
@ -97,17 +97,30 @@ public:
bool rename(char *filename, char *newname);
size_t totalBytes();
size_t usedBytes();
size_t size(){ return _filesystemStorageHandle.cfg.phys_size; }
size_t blockSize(){ return _filesystemStorageHandle.cfg.log_block_size; }
size_t totalBlocks(){ return _filesystemStorageHandle.block_count; }
size_t freeBlocks(){ return _filesystemStorageHandle.free_blocks; }
size_t pageSize(){ return _filesystemStorageHandle.cfg.log_page_size; }
size_t allocatedPages(){ return _filesystemStorageHandle.stats_p_allocated; }
size_t deletedPages(){ return _filesystemStorageHandle.stats_p_deleted; }
size_t size(){ return _fs.cfg.phys_size; }
size_t blockSize(){ return _fs.cfg.log_block_size; }
size_t totalBlocks(){ return _fs.block_count; }
size_t freeBlocks(){ return _fs.free_blocks; }
size_t pageSize(){ return _fs.cfg.log_page_size; }
size_t allocatedPages(){ return _fs.stats_p_allocated; }
size_t deletedPages(){ return _fs.stats_p_deleted; }
FSFile open(char *filename, uint8_t mode = FSFILE_READ);
FSFile open(spiffs_dirent* entry, uint8_t mode = FSFILE_READ);
protected:
int _mountInternal();
std::unique_ptr<uint8_t[]> _work;
std::unique_ptr<uint8_t[]> _fds;
size_t _fdsSize;
std::unique_ptr<uint8_t[]> _cache;
size_t _cacheSize;
uint32_t _beginAddress;
uint32_t _endAddress;
uint32_t _maxOpenFiles;
spiffs _fs;
private:
friend class FSFile;
};

View File

@ -78,5 +78,4 @@ void init() {
timer1_isr_init();
os_timer_setfn(&micros_overflow_timer, (os_timer_func_t*) &micros_overflow_tick, 0);
os_timer_arm(&micros_overflow_timer, 60000, REPEAT);
spiffs_mount();
}

View File

@ -155,79 +155,3 @@ uint32_t flashmem_get_sector_of_address( uint32_t addr ){
return (addr - INTERNAL_FLASH_START_ADDRESS) / INTERNAL_FLASH_SECTOR_SIZE;;
}
/*
SPIFFS BOOTSTRAP
*/
//SPIFFS Address Range (defined in eagle ld)
extern uint32_t _SPIFFS_start;
extern uint32_t _SPIFFS_end;
//SPIFFS Storage Handle
spiffs _filesystemStorageHandle;
//SPIFFS Buffers (INTERNAL_FLASH_PAGE_SIZE = 256) Total 1792 bytes
static u8_t spiffs_work_buf[INTERNAL_FLASH_PAGE_SIZE*2]; //512 bytes
static u8_t spiffs_fds[32*4]; //128 bytes
static u8_t spiffs_cache[(INTERNAL_FLASH_PAGE_SIZE+32)*4]; //1152 bytes
//SPIFFS API Read CallBack
static s32_t api_spiffs_read(u32_t addr, u32_t size, u8_t *dst){
SPIFFS_API_DBG_V("api_spiffs_read: 0x%08x len: %u\n", addr, size);
flashmem_read(dst, addr, size);
return SPIFFS_OK;
}
//SPIFFS API Write CallBack
static s32_t api_spiffs_write(u32_t addr, u32_t size, u8_t *src){
SPIFFS_API_DBG_V("api_spiffs_write: 0x%08x len: %u\n", addr, size);
flashmem_write(src, addr, size);
return SPIFFS_OK;
}
//SPIFFS API Erase CallBack
static s32_t api_spiffs_erase(u32_t addr, u32_t size){
SPIFFS_API_DBG_V("api_spiffs_erase: 0x%08x len: %u\n", addr, size);
u32_t sect_first = flashmem_get_sector_of_address(addr);
u32_t sect_last = flashmem_get_sector_of_address(addr+size);
while( sect_first <= sect_last )
if( !flashmem_erase_sector( sect_first ++ ) )
return SPIFFS_ERR_INTERNAL;
return SPIFFS_OK;
}
// Our own SPIFFS Setup Method
// All of the above gets put in the configuration
// and a mount attempt is made, initializing the storage handle
// that is used in all further api calls
s32_t spiffs_mount(){
u32_t start_address = (u32_t)&_SPIFFS_start;
u32_t end_address = (u32_t)&_SPIFFS_end;
if (start_address == 0 || start_address >= end_address){
SPIFFS_API_DBG_E("Can't start file system, wrong address");
return SPIFFS_ERR_NOT_CONFIGURED;
}
spiffs_config cfg = {0};
cfg.phys_addr = start_address;
cfg.phys_size = end_address - start_address;
cfg.phys_erase_block = INTERNAL_FLASH_SECTOR_SIZE; // according to datasheet
cfg.log_block_size = INTERNAL_FLASH_SECTOR_SIZE * 2; // Important to make large
cfg.log_page_size = INTERNAL_FLASH_PAGE_SIZE; // according to datasheet
cfg.hal_read_f = api_spiffs_read;
cfg.hal_write_f = api_spiffs_write;
cfg.hal_erase_f = api_spiffs_erase;
SPIFFS_API_DBG_V("spiffs_mount: start:%x, size:%d Kb\n", cfg.phys_addr, cfg.phys_size / 1024);
s32_t res = SPIFFS_mount(&_filesystemStorageHandle,
&cfg,
spiffs_work_buf,
spiffs_fds,
sizeof(spiffs_fds),
spiffs_cache,
sizeof(spiffs_cache),
NULL);
SPIFFS_API_DBG_V("spiffs_mount: %d\n", res);
return res;
}

View File

@ -24,14 +24,11 @@ The small 4KB sectors allow for greater flexibility in applications that require
#define INTERNAL_FLASH_WRITE_UNIT_SIZE 4
#define INTERNAL_FLASH_READ_UNIT_SIZE 4
extern spiffs _filesystemStorageHandle;
extern uint32_t flashmem_write( const void *from, uint32_t toaddr, uint32_t size );
extern uint32_t flashmem_read( void *to, uint32_t fromaddr, uint32_t size );
extern bool flashmem_erase_sector( uint32_t sector_id );
uint32_t flashmem_find_sector( uint32_t address, uint32_t *pstart, uint32_t *pend );
uint32_t flashmem_get_sector_of_address( uint32_t addr );
s32_t spiffs_mount();
#ifdef __cplusplus
}

View File

@ -0,0 +1,147 @@
/*
* Copyright (c) 2015, Majenko Technologies
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* * Neither the name of Majenko Technologies nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
const char *ssid = "YourSSIDHere";
const char *password = "YourPSKHere";
MDNSResponder mdns;
ESP8266WebServer server ( 80 );
const int led = 13;
void handleRoot() {
digitalWrite ( led, 1 );
char temp[400];
int sec = millis() / 1000;
int min = sec / 60;
int hr = min / 60;
snprintf ( temp, 400,
"<html>\
<head>\
<meta http-equiv='refresh' content='5'/>\
<title>ESP8266 Demo</title>\
<style>\
body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }\
</style>\
</head>\
<body>\
<h1>Hello from ESP8266!</h1>\
<p>Uptime: %02d:%02d:%02d</p>\
<img src=\"/test.svg\" />\
</body>\
</html>",
hr, min % 60, sec % 60
);
server.send ( 200, "text/html", temp );
digitalWrite ( led, 0 );
}
void handleNotFound() {
digitalWrite ( led, 1 );
String message = "File Not Found\n\n";
message += "URI: ";
message += server.uri();
message += "\nMethod: ";
message += ( server.method() == HTTP_GET ) ? "GET" : "POST";
message += "\nArguments: ";
message += server.args();
message += "\n";
for ( uint8_t i = 0; i < server.args(); i++ ) {
message += " " + server.argName ( i ) + ": " + server.arg ( i ) + "\n";
}
server.send ( 404, "text/plain", message );
digitalWrite ( led, 0 );
}
void setup ( void ) {
pinMode ( led, OUTPUT );
digitalWrite ( led, 0 );
Serial.begin ( 115200 );
WiFi.begin ( ssid, password );
Serial.println ( "" );
// Wait for connection
while ( WiFi.status() != WL_CONNECTED ) {
delay ( 500 );
Serial.print ( "." );
}
Serial.println ( "" );
Serial.print ( "Connected to " );
Serial.println ( ssid );
Serial.print ( "IP address: " );
Serial.println ( WiFi.localIP() );
if ( mdns.begin ( "esp8266", WiFi.localIP() ) ) {
Serial.println ( "MDNS responder started" );
}
server.on ( "/", handleRoot );
server.on ( "/test.svg", drawGraph );
server.on ( "/inline", []() {
server.send ( 200, "text/plain", "this works as well" );
} );
server.onNotFound ( handleNotFound );
server.begin();
Serial.println ( "HTTP server started" );
}
void loop ( void ) {
mdns.update();
server.handleClient();
}
void drawGraph() {
String out = "";
char temp[100];
out += "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"400\" height=\"150\">\n";
out += "<rect width=\"400\" height=\"150\" fill=\"rgb(250, 230, 210)\" stroke-width=\"1\" stroke=\"rgb(0, 0, 0)\" />\n";
out += "<g stroke=\"black\">\n";
int y = rand() % 130;
for (int x = 10; x < 390; x+= 10) {
int y2 = rand() % 130;
sprintf(temp, "<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" stroke-width=\"1\" />\n", x, 140 - y, x + 10, 140 - y2);
out += temp;
y = y2;
}
out += "</g>\n</svg>\n";
server.send ( 200, "image/svg+xml", out);
}

View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 2015, Majenko Technologies
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* * Neither the name of Majenko Technologies nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* Create a WiFi access point and provide a web server on it. */
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
/* Set these to your desired credentials. */
const char *ssid = "ESPap";
const char *password = "thereisnospoon";
ESP8266WebServer server(80);
/* Just a little test message. Go to http://192.168.4.1 in a web browser
* connected to this access point to see it.
*/
void handleRoot() {
server.send(200, "text/html", "<h1>You are connected</h1>");
}
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Serial.print("Configuring access point...");
/* You can remove the password parameter if you want the AP to be open. */
WiFi.softAP(ssid, password);
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println("done");
IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.on("/", handleRoot);
server.begin();
Serial.println("HTTP server started");
}
void loop() {
server.handleClient();
}

View File

@ -1,6 +1,6 @@
/*
WiFiServer.h - Library for Arduino Wifi shield.
Copyright (c) 2011-2014 Arduino. All right reserved.
Copyright (c) 2011-2014 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
/*
WiFiUdp.h - Library for Arduino Wifi shield.
Copyright (c) 2011-2014 Arduino. All right reserved.
Copyright (c) 2011-2014 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public

View File

@ -8,7 +8,7 @@
name=ESP8266 Modules
version=1.6.1
compiler.tools.path={runtime.ide.path}/hardware/tools/esp8266/
compiler.tools.path={runtime.platform.path}/tools/
compiler.path={compiler.tools.path}xtensa-lx106-elf/bin/
compiler.sdk.path={compiler.tools.path}sdk/
@ -85,7 +85,7 @@ recipe.size.regex=^(?:\.text|\.data|\.rodata|\.irom0\.text|)\s+([0-9]+).*
tools.esptool.cmd=esptool
tools.esptool.cmd.windows=esptool.exe
tools.esptool.path={runtime.ide.path}/hardware/tools/esp8266
tools.esptool.path={compiler.tools.path}
tools.esptool.upload.protocol=esp
tools.esptool.upload.params.verbose=-vv

View File

@ -1,68 +1,68 @@
ESPRESSIF GENERAL PUBLIC LICENSE
PREAMBLE
The Espressif General Public License is a free, copyleft license for software and other kinds of works.
The Espressif General Public License is intended to guarantee your freedom to share and change all versions of a program released by ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD, to make sure it remains free software for all its users. We use the Espressif General Public License for all of our open-source software.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the Espressif GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to the Espressif Public License.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
1. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below.
2. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
3. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License applies to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
4. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 3, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License. This requirement modifies the requirement in section 3 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
5. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 7.
6. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
7. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
8. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
9. Revised Versions of this License.
ESPRESSIF SYSTEMS (SHANGHAI) PTE LED may publish revised and/or new versions of the ESPRESSIF General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the Espressif General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD. If the Program does not specify a version number of the Espressif General Public License, you may choose any version ever published.
10. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
11. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
12. Interpretation of Sections 10 and 11.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
ESPRESSIF GENERAL PUBLIC LICENSE
PREAMBLE
The Espressif General Public License is a free, copyleft license for software and other kinds of works.
The Espressif General Public License is intended to guarantee your freedom to share and change all versions of a program released by ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD, to make sure it remains free software for all its users. We use the Espressif General Public License for all of our open-source software.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the Espressif GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to the Espressif Public License.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
1. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below.
2. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
3. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License applies to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
4. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 3, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License. This requirement modifies the requirement in section 3 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
5. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your license is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 7.
6. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
7. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
8. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
9. Revised Versions of this License.
ESPRESSIF SYSTEMS (SHANGHAI) PTE LED may publish revised and/or new versions of the ESPRESSIF General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the Espressif General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD. If the Program does not specify a version number of the Espressif General Public License, you may choose any version ever published.
10. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
11. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
12. Interpretation of Sections 10 and 11.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS

View File

@ -1,274 +1,274 @@
esp_iot_sdk_v1.0.1_15_05_04_p1
-------------------------------------------
Here is a patch for station+softAP issue that users may have, based on SDK_v1.0.1,
solved problem that connect to ESP8266 softAP may fail in station+softAP mode.
Sorry for the inconvenience.
esp_iot_sdk_v1.0.1_15_04_24 Release Note
-------------------------------------------
Resolved Issues(Bugs below are eligible for Bug Bounty Program):
1. SSL connection may fail if SSL packet size larger than 2kBytes [PeteW ]
2. UDP remote IP to be 0.0.0.0 may cause reset [Jerry S]
3. Optimize wifi_get_ip_info to fix loss of wireless connectivity problem
4. Air-Kiss restart [Orgmar]
Optimization:
1. Optimized IOT_Espressif_EspTouch.APK (apply for access from Espressif) for improved compatibility. [???]
2. TCP server can not open again immediately with the same port [624908539]
3. Update UART driver for parity bit value may be incorrect [1062583993]
4. Add define of “ICACHE_RODATA_ATTR” for Symbol 'ICACHE_RODATA_ATTR' could not be resolved. [???]
5. Add API wifi_softap_dhcps_set_offer_option to enable/disable ESP8266 softAP DHCP server default gateway. [xyz769]
6. AT register_uart_rx_intr may enter callback twice. [???]
7.optimize document that WPA password length range : 8 ~ 64 bytes [785057041]
8. ESP8266 softAP DHCP server record 8 DHCP client's IP at most [ygjeon]
9. To set static IP (wifi_set_ip_info) has to disable DHCP first(wifi_softap_dhcps_stop or wifi_station_dhcpc_stop)
10.Add example of wifi_softap_set_dhcps_lease
11. smartconfig_start can only be called in ESP8266 station mode
Added APIs:
1. Wi-Fi related APIs:
wifi_station_set_reconnect_policy: enable/disable reconnect when ESP8266 disconnect from router,default to be enable reconnect.
wifi_set_event_handler_cb: set event handler of ESP8266 softAP or station status change.
wifi_softap_dhcps_set_offer_option: enable/disable get router information from ESP8266 softAP, default to be enable.
2. SNTP APIs:
sntp_get_current_timestamp: get current timestamp from Jan 01, 1970, 00:00 (GMT)
sntp_get_real_time: char,get real time (GTM + 8 time zone)
sntp_init: initialize SNTP
sntp_stop: stop SNTP
sntp_setserver: set SNTP server by IP
sntp_getserver: get SNTP server IP
sntp_setservername: set SNTP server by domain name
sntp_getservername: get domain name of SNTP server set by sntp_setservername
3. MDNS APIs:
espconn_mdns_init: initialize mDNS
espconn_mdns_close: close mDNS
espconn_mdns_server_register: register mDNS server
espconn_mdns_server_unregister: unregister mDNS server
espconn_mdns_get_servername: get mDNS server name
espconn_mdns_set_servername: set mDNS server name
espconn_mdns_set_hostname: get mDNS host name
espconn_mdns_get_hostname: set mDNS host name
espconn_mdns_disable: disable mDNS
espconn_mdns_enable: endisable mDNS
AT_v0.23 Release Note:
Optimized:
1.AT+CWJAP add parameter "bssid", for several APs may have the same SSID
New AT commands:
1. AT+CIPSENDBUF: write data into TCP-send-buffer; non-blocking. Background task automatically handles transmission. Has much higher throughput.
2. AT+CIPBUFRESET: resets segment count in TCP-send-buffer
3. AT+CIPBUFSTATUS: checks status of TCP-send-buffer
4. AT+CIPCHECKSEGID: checks if a specific segment in TCP-send-buffer has sent successfully
esp_iot_sdk_v1.0.1_b2_15_04_10 release note
-------------------------------------------
Fix bugs:
1.Call espconn_sent to send UDP packet in user_init cause reset.[BBP#2 reporter (????)]
2.UART & FlowControl issue: send data to FIFO without CTS flag will cause WDT [BBP#11 reporter (pvxx)]
3.SSL issue,add an API (espconn_secure_set_size) to set SSL buffer size [BBP#29 reporter (PeteW)]
4.UDP broadcast issue in WEP
Optimize:
1.Add more details about measure ADC & VDD3P3 in appendix of document“2C-SDK-Espressif IoT SDK Programming Guide”[BBP#15 reporter (DarkByte)]
2.Can not do any WiFi related operation if WiFi mode is in NULL_MODE [BBP#23 reporter (hao.wang)]
3.start_ip and end_ip won't change through API wifi_softap_set_dhcps_lease [BBP#37 reporter (glb)]
4.AT get into busy state [BBP#35 reporter (tommy_hk)]
5.ssid + password length limitation when using AirKiss [BBP#45 reporter (zhchbin)]
Add APIs:
1.espconn_secure_set_size:set buffer size for SSL packet
2.espconn_secure_get_size:get SSL buffer size
3.at_register_uart_rx_intr:set UART0 to be used by user or AT commands
Add AT command:
1.AT+SLEEP: set ESP8266 sleep mode
esp_iot_sdk_v1.0.1_b1_15_04_02 Release note
-------------------------------------------
Fix bugs:
1. Connect to ESP8266 softAP fail after SmartConfig;
2. SmartConfig loses one bit of SSID
Optimize:
1. espconn_set_opt: set configuration of TCP connection,add parameter for TCP keep-alive
Add APIs:
1. espconn_clear_opt: clear configuration of TCP connection
2. espconn_set_keepalive: set configuration of TCP keep-alive to detect if TCP connection broke
3. espconn_get_keepalive: get configuration of TCP keep-alive
AT_v0.23_b1 release note
Note: AT added some functions so flash size need to be 1024KB or more than that.
Fix bug:
1. Always "busy" if TCP connection abnormally broke during AT+CIPSEND
Optimize:
1. Add UDP transparent transmission
2. Optimize the initial value of AT+CWDHCP?
3. Add TCP keep-alive function in AT+CIPSTART
Add AT command:
1. Add AT+CIPSENDEX which support quit from sending mode by "\0" (so an useful "\0" need to be "\\0")
esp_iot_sdk_v1.0.0_15_03_20 Release Note
----------------------------------------
Optimize:
1. Optimize smartconfig to version v1.0; Please don't call any other APIs during SmartConfig.
2. Optimize AT to version 0.22.0.0;
3. Optimize the protection of system parameters, and add error-check about it;
4. Optimize beacon delay of ESP8266 softAP;
5. Optimize boot to version 1.3(b3);
- Add API system_restart_enhance: for factory test, support to load and run program in any specific address;
- Add APIs to get boot version and start address of current user bin;
- Fix compatibility problem of dual flash;
6. Optimize sniffer, structure sniffer_buf changed, please refer to document;
7. Optimize espconn;
8. Optimize pwm;
9. Other optimize to make the software more reliable;
Add APIs:
1. system_update_cpu_freq: change CPU frequency;
2. wifi_promiscuous_set_mac: set a mac address filter during sniffer;
3. wifi_set_broadcast_if : set which interface will UDP broadcast send from;
Fix bugs:
1. Interrupt during flash erasing will cause wdt reset;
2. Read/write rtc memory;
3. If router disconnect to ESP8266, ESP8266 won't reconnect;
4. Connect to router which hid its SSID
AT_v0.22 release note
Fix bug:
1. Wrong return value of AT+CIPSTATUS;
2. wdt rest after "0,CONNECT FAIL";
Add AT commands:
1. Change AT commands of which configuration will store into flash to two kinds:
XXX_CUR: current, only set configuration won't save it into Flash;
XXX_DEF: default, set configuration and save it to Flash
2. Add SmartConfig in AT:
AT+CWSTARTSMART/AT+CWSTOPSMART: start / stop SmartConfig
Notice: please refer to the document, call "AT+CWSTOPSMART" to stop SmartConfig first since "AT+CWSTARTSMART", then call other AT commands. Don't call any other AT commands during SmartConfig.
2. AT+SAVETRANSLINK: save transparent transmission link to Flash;
Note:AT+CIPMODE=1 set to enter transparent transmission mode, won't save to Flash.
Add AT APIs
1. at_customLinkMax: set the max link that allowed, most can be 10; if you want to set it, please set it before at_init; if you didn't set it, the max link allowed is 5 by default.
2. at_enter_special_state/ at_leave_special_state:Enter/leave AT processing state. In processing state, AT core will return "busy" for any further AT commands.
3. at_set_custom_info:set custom version information of AT which can be got by AT+GMR;
4. at_get_version:get version information of AT lib .
Optimize
1. Add UDP remote ip and remote port is allowed to be parameters of "AT+CIPSEND"
2. Move "AT+CIUPDATE" from lib to AT "demo\esp_iot_sdk\examples\at", AT demo shows how to upgrade AT firmware from a local server. Notice that AT upgrade the bin files name have to be "user1.bin" and "user2.bin".
3. Optimize "AT+CIPSTA", add gateway and netmask as parameters
4. Optimize transparent transmission.
esp_iot_sdk_v0.9.5_15_01_22 Release Note
----------------------------------------
AT becomes a lib attached to esp_iot_sdk, programming guide in "document" shows APIs for user to define their own AT commands, AT bin files are in \esp_iot_sdk\bin\at
Fix bugs:
1. Incorrect status got by API : wifi_station_get_connect_status;
2. Sniffer can not quit without restart;
3. wifi_station_ap_change always return true;
4. TCP connection issues
Add APIs:
1. system_deep_sleep_set_option: set what the chip will do when deep-sleep wake up;
2. wifi_status_led_uninstall;
3. wifi_station_ap_get_info: get information of AP that ESP8266 station connected.
4. wifi_station_dhcpc_status & wifi_softap_dhcps_status : get DHCP status
5. smart config APIs, more details in documents.
6. add beacon_interval parameter in struct softap_config
7. espconn_recv_hold and espconn_recv_unhold to block TCP receiving data and unblock it.
8. AT APIs to let user define their own AT, more details in documents.
Optimize:
1. light sleep, modem sleep, deep sleep
2. compile method: ./gen_misc.sh, then follow the tips and steps.
3. when no buffer for os_malloc, return NULL instead of malloc assert.
4. users can enable #define USE_OPTIMIZE_PRINTF in user_config.h to remove strings of os_printf from ram to irom
5. faster the re-connection of ESP8266 station to router after deep-sleep.
6. update to boot v1.2 to support new format user.bin;
7. update ARP
8. update SSL
9. revised system_deep_sleep,system_deep_sleep(0),set no wake up timer,connect a GPIO to pin RST, the chip will wake up by a falling-edge on pin RST
esp_iot_sdk_v0.9.4_14_12_19 Release Note
----------------------------------------
1. Update sniffer to support capture HT20/HT40 packet;
2. Add APIs to set and get sleep type;
3. Add APIs to get version info of sdk, delete version.h;
4. RAW in LWIP is open source now, add API of function ping;
5. Update spi driver;
6. Optimize APIs related to espconn;
7. Fix some bugs to make the software more reliable;
Known Issue:
1. exception of small probability occured while recving multi-client data in softap
2. restart of small probability occured while tcp client reconnecting
So sorry that we have some known issues here, we will solve it ASAP.
esp_iot_sdk_v0.9.3_14_11_21 Release Note
----------------------------------------
1. Add license documentation of ESPRESSIF SDK
2. Add APIs to read and write RTC memory, and APIs to get RTC time.
3. Add APIs to swap UART0
4. Add API to read ADC, delete adc.c.
5. Add API to read spi flash id
6. Revise struct station_config, add bssid parameters to distinguish different AP with same ssid ;
Note: if station_config.bssid_set == 1 , station_config.bssid has to be set, or connection will fail. So in general, station_config.bssid_set need to be 0.
7. Revise struct scan_config, add scan_config.show_hidden to set whether scan APs which ssid is hidden or not; not scan, set scan_config.show_hidden to be 0.
Add bss_info.is_hidden in struct bss_info to show if this APTs ssid is hidden.
8. Revise struct softap_config, add softap_config.ssid_len. If softap_config.ssid_len == 0, check ssid till find a termination characters; otherwise it depends on softap_config.ssid_len.
9. Revise API "wifi_softap_set_config" to take effect immediately, needs not restart to make the configuration enable any more.
10. Add APIs to set and get physical layer mode(802.11b/g/n)
11. Add APIs to enable and disable DHCP server of ESP8266 softAP
12. Add APIs to enable and disable DHCP client of ESP8266 station
13. Add API to set range of ip address that get from DHCP server
14. Add APIs to set and get how many TCP connections allowed at max.
15. Add APIs to set and get how many TCP clients allowed at max to a TCP server.
16. Revise "wifi_set_ip_info" and "wifi_set_macaddr" to take effect immediately.
17. Fix some bugs to make the software more reliable.
ESP8266EX: Fix A Potential Error For UART RX in esp_iot_sdk_v0.9.2_14_10_24
---------------------------------------------------------------------------
The previously released SDK for ESP8266EX inadvertently introduced a bug that may cause a little packet loss when transferring packet by Uart RX.
So for now,I will release the patch for this bug.Please download the patch from the attachment,and refer to the following steps:
Following Commands:
1. REPLACE LIBPHY.A IN SDK/LIB
2. ADD LIBPP.A TO SDK/LIB
3. MODIFY SDK/APP/MAKEFILE
4. ADD "-lpp \" AS BELOW
-lgcc
-lhal
-lpp
-lphy
-lnet80211
-llwip
-lwpa
-lmain
-lssc
-lssl
esp_iot_sdk_v0.9.2_14_10_24 Release Note
----------------------------------------
Initial version for public, can be compiled on both windows and lubuntu.
esp_iot_sdk_v1.0.1_15_05_04_p1
-------------------------------------------
Here is a patch for station+softAP issue that users may have, based on SDK_v1.0.1,
solved problem that connect to ESP8266 softAP may fail in station+softAP mode.
Sorry for the inconvenience.
esp_iot_sdk_v1.0.1_15_04_24 Release Note
-------------------------------------------
Resolved Issues(Bugs below are eligible for Bug Bounty Program):
1. SSL connection may fail if SSL packet size larger than 2kBytes [PeteW ]
2. UDP remote IP to be 0.0.0.0 may cause reset [Jerry S]
3. Optimize wifi_get_ip_info to fix loss of wireless connectivity problem
4. Air-Kiss restart [Orgmar]
Optimization:
1. Optimized IOT_Espressif_EspTouch.APK (apply for access from Espressif) for improved compatibility. [???]
2. TCP server can not open again immediately with the same port [624908539]
3. Update UART driver for parity bit value may be incorrect [1062583993]
4. Add define of “ICACHE_RODATA_ATTR” for Symbol 'ICACHE_RODATA_ATTR' could not be resolved. [???]
5. Add API wifi_softap_dhcps_set_offer_option to enable/disable ESP8266 softAP DHCP server default gateway. [xyz769]
6. AT register_uart_rx_intr may enter callback twice. [???]
7.optimize document that WPA password length range : 8 ~ 64 bytes [785057041]
8. ESP8266 softAP DHCP server record 8 DHCP client's IP at most [ygjeon]
9. To set static IP (wifi_set_ip_info) has to disable DHCP first(wifi_softap_dhcps_stop or wifi_station_dhcpc_stop)
10.Add example of wifi_softap_set_dhcps_lease
11. smartconfig_start can only be called in ESP8266 station mode
Added APIs:
1. Wi-Fi related APIs:
wifi_station_set_reconnect_policy: enable/disable reconnect when ESP8266 disconnect from router,default to be enable reconnect.
wifi_set_event_handler_cb: set event handler of ESP8266 softAP or station status change.
wifi_softap_dhcps_set_offer_option: enable/disable get router information from ESP8266 softAP, default to be enable.
2. SNTP APIs:
sntp_get_current_timestamp: get current timestamp from Jan 01, 1970, 00:00 (GMT)
sntp_get_real_time: char,get real time (GTM + 8 time zone)
sntp_init: initialize SNTP
sntp_stop: stop SNTP
sntp_setserver: set SNTP server by IP
sntp_getserver: get SNTP server IP
sntp_setservername: set SNTP server by domain name
sntp_getservername: get domain name of SNTP server set by sntp_setservername
3. MDNS APIs:
espconn_mdns_init: initialize mDNS
espconn_mdns_close: close mDNS
espconn_mdns_server_register: register mDNS server
espconn_mdns_server_unregister: unregister mDNS server
espconn_mdns_get_servername: get mDNS server name
espconn_mdns_set_servername: set mDNS server name
espconn_mdns_set_hostname: get mDNS host name
espconn_mdns_get_hostname: set mDNS host name
espconn_mdns_disable: disable mDNS
espconn_mdns_enable: endisable mDNS
AT_v0.23 Release Note:
Optimized:
1.AT+CWJAP add parameter "bssid", for several APs may have the same SSID
New AT commands:
1. AT+CIPSENDBUF: write data into TCP-send-buffer; non-blocking. Background task automatically handles transmission. Has much higher throughput.
2. AT+CIPBUFRESET: resets segment count in TCP-send-buffer
3. AT+CIPBUFSTATUS: checks status of TCP-send-buffer
4. AT+CIPCHECKSEGID: checks if a specific segment in TCP-send-buffer has sent successfully
esp_iot_sdk_v1.0.1_b2_15_04_10 release note
-------------------------------------------
Fix bugs:
1.Call espconn_sent to send UDP packet in user_init cause reset.[BBP#2 reporter (????)]
2.UART & FlowControl issue: send data to FIFO without CTS flag will cause WDT [BBP#11 reporter (pvxx)]
3.SSL issue,add an API (espconn_secure_set_size) to set SSL buffer size [BBP#29 reporter (PeteW)]
4.UDP broadcast issue in WEP
Optimize:
1.Add more details about measure ADC & VDD3P3 in appendix of document“2C-SDK-Espressif IoT SDK Programming Guide”[BBP#15 reporter (DarkByte)]
2.Can not do any WiFi related operation if WiFi mode is in NULL_MODE [BBP#23 reporter (hao.wang)]
3.start_ip and end_ip won't change through API wifi_softap_set_dhcps_lease [BBP#37 reporter (glb)]
4.AT get into busy state [BBP#35 reporter (tommy_hk)]
5.ssid + password length limitation when using AirKiss [BBP#45 reporter (zhchbin)]
Add APIs:
1.espconn_secure_set_size:set buffer size for SSL packet
2.espconn_secure_get_size:get SSL buffer size
3.at_register_uart_rx_intr:set UART0 to be used by user or AT commands
Add AT command:
1.AT+SLEEP: set ESP8266 sleep mode
esp_iot_sdk_v1.0.1_b1_15_04_02 Release note
-------------------------------------------
Fix bugs:
1. Connect to ESP8266 softAP fail after SmartConfig;
2. SmartConfig loses one bit of SSID
Optimize:
1. espconn_set_opt: set configuration of TCP connection,add parameter for TCP keep-alive
Add APIs:
1. espconn_clear_opt: clear configuration of TCP connection
2. espconn_set_keepalive: set configuration of TCP keep-alive to detect if TCP connection broke
3. espconn_get_keepalive: get configuration of TCP keep-alive
AT_v0.23_b1 release note
Note: AT added some functions so flash size need to be 1024KB or more than that.
Fix bug:
1. Always "busy" if TCP connection abnormally broke during AT+CIPSEND
Optimize:
1. Add UDP transparent transmission
2. Optimize the initial value of AT+CWDHCP?
3. Add TCP keep-alive function in AT+CIPSTART
Add AT command:
1. Add AT+CIPSENDEX which support quit from sending mode by "\0" (so an useful "\0" need to be "\\0")
esp_iot_sdk_v1.0.0_15_03_20 Release Note
----------------------------------------
Optimize:
1. Optimize smartconfig to version v1.0; Please don't call any other APIs during SmartConfig.
2. Optimize AT to version 0.22.0.0;
3. Optimize the protection of system parameters, and add error-check about it;
4. Optimize beacon delay of ESP8266 softAP;
5. Optimize boot to version 1.3(b3);
- Add API system_restart_enhance: for factory test, support to load and run program in any specific address;
- Add APIs to get boot version and start address of current user bin;
- Fix compatibility problem of dual flash;
6. Optimize sniffer, structure sniffer_buf changed, please refer to document;
7. Optimize espconn;
8. Optimize pwm;
9. Other optimize to make the software more reliable;
Add APIs:
1. system_update_cpu_freq: change CPU frequency;
2. wifi_promiscuous_set_mac: set a mac address filter during sniffer;
3. wifi_set_broadcast_if : set which interface will UDP broadcast send from;
Fix bugs:
1. Interrupt during flash erasing will cause wdt reset;
2. Read/write rtc memory;
3. If router disconnect to ESP8266, ESP8266 won't reconnect;
4. Connect to router which hid its SSID
AT_v0.22 release note
Fix bug:
1. Wrong return value of AT+CIPSTATUS;
2. wdt rest after "0,CONNECT FAIL";
Add AT commands:
1. Change AT commands of which configuration will store into flash to two kinds:
XXX_CUR: current, only set configuration won't save it into Flash;
XXX_DEF: default, set configuration and save it to Flash
2. Add SmartConfig in AT:
AT+CWSTARTSMART/AT+CWSTOPSMART: start / stop SmartConfig
Notice: please refer to the document, call "AT+CWSTOPSMART" to stop SmartConfig first since "AT+CWSTARTSMART", then call other AT commands. Don't call any other AT commands during SmartConfig.
2. AT+SAVETRANSLINK: save transparent transmission link to Flash;
Note:AT+CIPMODE=1 set to enter transparent transmission mode, won't save to Flash.
Add AT APIs
1. at_customLinkMax: set the max link that allowed, most can be 10; if you want to set it, please set it before at_init; if you didn't set it, the max link allowed is 5 by default.
2. at_enter_special_state/ at_leave_special_state:Enter/leave AT processing state. In processing state, AT core will return "busy" for any further AT commands.
3. at_set_custom_info:set custom version information of AT which can be got by AT+GMR;
4. at_get_version:get version information of AT lib .
Optimize
1. Add UDP remote ip and remote port is allowed to be parameters of "AT+CIPSEND"
2. Move "AT+CIUPDATE" from lib to AT "demo\esp_iot_sdk\examples\at", AT demo shows how to upgrade AT firmware from a local server. Notice that AT upgrade the bin files name have to be "user1.bin" and "user2.bin".
3. Optimize "AT+CIPSTA", add gateway and netmask as parameters
4. Optimize transparent transmission.
esp_iot_sdk_v0.9.5_15_01_22 Release Note
----------------------------------------
AT becomes a lib attached to esp_iot_sdk, programming guide in "document" shows APIs for user to define their own AT commands, AT bin files are in \esp_iot_sdk\bin\at
Fix bugs:
1. Incorrect status got by API : wifi_station_get_connect_status;
2. Sniffer can not quit without restart;
3. wifi_station_ap_change always return true;
4. TCP connection issues
Add APIs:
1. system_deep_sleep_set_option: set what the chip will do when deep-sleep wake up;
2. wifi_status_led_uninstall;
3. wifi_station_ap_get_info: get information of AP that ESP8266 station connected.
4. wifi_station_dhcpc_status & wifi_softap_dhcps_status : get DHCP status
5. smart config APIs, more details in documents.
6. add beacon_interval parameter in struct softap_config
7. espconn_recv_hold and espconn_recv_unhold to block TCP receiving data and unblock it.
8. AT APIs to let user define their own AT, more details in documents.
Optimize:
1. light sleep, modem sleep, deep sleep
2. compile method: ./gen_misc.sh, then follow the tips and steps.
3. when no buffer for os_malloc, return NULL instead of malloc assert.
4. users can enable #define USE_OPTIMIZE_PRINTF in user_config.h to remove strings of os_printf from ram to irom
5. faster the re-connection of ESP8266 station to router after deep-sleep.
6. update to boot v1.2 to support new format user.bin;
7. update ARP
8. update SSL
9. revised system_deep_sleep,system_deep_sleep(0),set no wake up timer,connect a GPIO to pin RST, the chip will wake up by a falling-edge on pin RST
esp_iot_sdk_v0.9.4_14_12_19 Release Note
----------------------------------------
1. Update sniffer to support capture HT20/HT40 packet;
2. Add APIs to set and get sleep type;
3. Add APIs to get version info of sdk, delete version.h;
4. RAW in LWIP is open source now, add API of function ping;
5. Update spi driver;
6. Optimize APIs related to espconn;
7. Fix some bugs to make the software more reliable;
Known Issue:
1. exception of small probability occured while recving multi-client data in softap
2. restart of small probability occured while tcp client reconnecting
So sorry that we have some known issues here, we will solve it ASAP.
esp_iot_sdk_v0.9.3_14_11_21 Release Note
----------------------------------------
1. Add license documentation of ESPRESSIF SDK
2. Add APIs to read and write RTC memory, and APIs to get RTC time.
3. Add APIs to swap UART0
4. Add API to read ADC, delete adc.c.
5. Add API to read spi flash id
6. Revise struct station_config, add bssid parameters to distinguish different AP with same ssid ;
Note: if station_config.bssid_set == 1 , station_config.bssid has to be set, or connection will fail. So in general, station_config.bssid_set need to be 0.
7. Revise struct scan_config, add scan_config.show_hidden to set whether scan APs which ssid is hidden or not; not scan, set scan_config.show_hidden to be 0.
Add bss_info.is_hidden in struct bss_info to show if this APTs ssid is hidden.
8. Revise struct softap_config, add softap_config.ssid_len. If softap_config.ssid_len == 0, check ssid till find a termination characters; otherwise it depends on softap_config.ssid_len.
9. Revise API "wifi_softap_set_config" to take effect immediately, needs not restart to make the configuration enable any more.
10. Add APIs to set and get physical layer mode(802.11b/g/n)
11. Add APIs to enable and disable DHCP server of ESP8266 softAP
12. Add APIs to enable and disable DHCP client of ESP8266 station
13. Add API to set range of ip address that get from DHCP server
14. Add APIs to set and get how many TCP connections allowed at max.
15. Add APIs to set and get how many TCP clients allowed at max to a TCP server.
16. Revise "wifi_set_ip_info" and "wifi_set_macaddr" to take effect immediately.
17. Fix some bugs to make the software more reliable.
ESP8266EX: Fix A Potential Error For UART RX in esp_iot_sdk_v0.9.2_14_10_24
---------------------------------------------------------------------------
The previously released SDK for ESP8266EX inadvertently introduced a bug that may cause a little packet loss when transferring packet by Uart RX.
So for now,I will release the patch for this bug.Please download the patch from the attachment,and refer to the following steps:
Following Commands:
1. REPLACE LIBPHY.A IN SDK/LIB
2. ADD LIBPP.A TO SDK/LIB
3. MODIFY SDK/APP/MAKEFILE
4. ADD "-lpp \" AS BELOW
-lgcc
-lhal
-lpp
-lphy
-lnet80211
-llwip
-lwpa
-lmain
-lssc
-lssl
esp_iot_sdk_v0.9.2_14_10_24 Release Note
----------------------------------------
Initial version for public, can be compiled on both windows and lubuntu.

View File

@ -1,70 +1,70 @@
/*
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*/
/**
* \file
* A few JSON defines used for parsing and generating JSON.
* \author
* Niclas Finne <nfi@sics.se>
* Joakim Eriksson <joakime@sics.se>
*/
#ifndef __JSON_H__
#define __JSON_H__
#define JSON_TYPE_ARRAY '['
#define JSON_TYPE_OBJECT '{'
#define JSON_TYPE_PAIR ':'
#define JSON_TYPE_PAIR_NAME 'N' /* for N:V pairs */
#define JSON_TYPE_STRING '"'
#define JSON_TYPE_INT 'I'
#define JSON_TYPE_NUMBER '0'
#define JSON_TYPE_ERROR 0
/* how should we handle null vs false - both can be 0? */
#define JSON_TYPE_NULL 'n'
#define JSON_TYPE_TRUE 't'
#define JSON_TYPE_FALSE 'f'
#define JSON_TYPE_CALLBACK 'C'
enum {
JSON_ERROR_OK,
JSON_ERROR_SYNTAX,
JSON_ERROR_UNEXPECTED_ARRAY,
JSON_ERROR_UNEXPECTED_END_OF_ARRAY,
JSON_ERROR_UNEXPECTED_OBJECT,
JSON_ERROR_UNEXPECTED_STRING
};
#define JSON_CONTENT_TYPE "application/json"
#endif /* __JSON_H__ */
/*
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*/
/**
* \file
* A few JSON defines used for parsing and generating JSON.
* \author
* Niclas Finne <nfi@sics.se>
* Joakim Eriksson <joakime@sics.se>
*/
#ifndef __JSON_H__
#define __JSON_H__
#define JSON_TYPE_ARRAY '['
#define JSON_TYPE_OBJECT '{'
#define JSON_TYPE_PAIR ':'
#define JSON_TYPE_PAIR_NAME 'N' /* for N:V pairs */
#define JSON_TYPE_STRING '"'
#define JSON_TYPE_INT 'I'
#define JSON_TYPE_NUMBER '0'
#define JSON_TYPE_ERROR 0
/* how should we handle null vs false - both can be 0? */
#define JSON_TYPE_NULL 'n'
#define JSON_TYPE_TRUE 't'
#define JSON_TYPE_FALSE 'f'
#define JSON_TYPE_CALLBACK 'C'
enum {
JSON_ERROR_OK,
JSON_ERROR_SYNTAX,
JSON_ERROR_UNEXPECTED_ARRAY,
JSON_ERROR_UNEXPECTED_END_OF_ARRAY,
JSON_ERROR_UNEXPECTED_OBJECT,
JSON_ERROR_UNEXPECTED_STRING
};
#define JSON_CONTENT_TYPE "application/json"
#endif /* __JSON_H__ */

View File

@ -1,94 +1,94 @@
/*
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*/
#ifndef __JSONPARSE_H__
#define __JSONPARSE_H__
#include "c_types.h"
#include "json/json.h"
#ifdef JSONPARSE_CONF_MAX_DEPTH
#define JSONPARSE_MAX_DEPTH JSONPARSE_CONF_MAX_DEPTH
#else
#define JSONPARSE_MAX_DEPTH 10
#endif
struct jsonparse_state {
const char *json;
int pos;
int len;
int depth;
/* for handling atomic values */
int vstart;
int vlen;
char vtype;
char error;
char stack[JSONPARSE_MAX_DEPTH];
};
/**
* \brief Initialize a JSON parser state.
* \param state A pointer to a JSON parser state
* \param json The string to parse as JSON
* \param len The length of the string to parse
*
* This function initializes a JSON parser state for
* parsing a string as JSON.
*/
void jsonparse_setup(struct jsonparse_state *state, const char *json,
int len);
/* move to next JSON element */
int jsonparse_next(struct jsonparse_state *state);
/* copy the current JSON value into the specified buffer */
int jsonparse_copy_value(struct jsonparse_state *state, char *buf,
int buf_size);
/* get the current JSON value parsed as an int */
int jsonparse_get_value_as_int(struct jsonparse_state *state);
/* get the current JSON value parsed as a long */
long jsonparse_get_value_as_long(struct jsonparse_state *state);
/* get the current JSON value parsed as a unsigned long */
unsigned long jsonparse_get_value_as_ulong(struct jsonparse_state *state);
/* get the length of the current JSON value */
int jsonparse_get_len(struct jsonparse_state *state);
/* get the type of the current JSON value */
int jsonparse_get_type(struct jsonparse_state *state);
/* compare the JSON value with the specified string */
int jsonparse_strcmp_value(struct jsonparse_state *state, const char *str);
#endif /* __JSONPARSE_H__ */
/*
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*/
#ifndef __JSONPARSE_H__
#define __JSONPARSE_H__
#include "c_types.h"
#include "json/json.h"
#ifdef JSONPARSE_CONF_MAX_DEPTH
#define JSONPARSE_MAX_DEPTH JSONPARSE_CONF_MAX_DEPTH
#else
#define JSONPARSE_MAX_DEPTH 10
#endif
struct jsonparse_state {
const char *json;
int pos;
int len;
int depth;
/* for handling atomic values */
int vstart;
int vlen;
char vtype;
char error;
char stack[JSONPARSE_MAX_DEPTH];
};
/**
* \brief Initialize a JSON parser state.
* \param state A pointer to a JSON parser state
* \param json The string to parse as JSON
* \param len The length of the string to parse
*
* This function initializes a JSON parser state for
* parsing a string as JSON.
*/
void jsonparse_setup(struct jsonparse_state *state, const char *json,
int len);
/* move to next JSON element */
int jsonparse_next(struct jsonparse_state *state);
/* copy the current JSON value into the specified buffer */
int jsonparse_copy_value(struct jsonparse_state *state, char *buf,
int buf_size);
/* get the current JSON value parsed as an int */
int jsonparse_get_value_as_int(struct jsonparse_state *state);
/* get the current JSON value parsed as a long */
long jsonparse_get_value_as_long(struct jsonparse_state *state);
/* get the current JSON value parsed as a unsigned long */
unsigned long jsonparse_get_value_as_ulong(struct jsonparse_state *state);
/* get the length of the current JSON value */
int jsonparse_get_len(struct jsonparse_state *state);
/* get the type of the current JSON value */
int jsonparse_get_type(struct jsonparse_state *state);
/* compare the JSON value with the specified string */
int jsonparse_strcmp_value(struct jsonparse_state *state, const char *str);
#endif /* __JSONPARSE_H__ */

View File

@ -1,145 +1,145 @@
/*
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*/
/**
* \file
* JSON output generation
* \author
* Niclas Finne <nfi@sics.se>
* Joakim Eriksson <joakime@sics.se>
*/
#ifndef __JSONTREE_H__
#define __JSONTREE_H__
#include "c_types.h"
#include "json/json.h"
#ifdef JSONTREE_CONF_MAX_DEPTH
#define JSONTREE_MAX_DEPTH JSONTREE_CONF_MAX_DEPTH
#else
#define JSONTREE_MAX_DEPTH 10
#endif /* JSONTREE_CONF_MAX_DEPTH */
struct jsontree_context {
struct jsontree_value *values[JSONTREE_MAX_DEPTH];
uint16_t index[JSONTREE_MAX_DEPTH];
int (* putchar)(int);
uint8_t depth;
uint8_t path;
int callback_state;
};
struct jsontree_value {
uint8_t type;
/* followed by a value */
};
struct jsontree_string {
uint8_t type;
const char *value;
};
struct jsontree_int {
uint8_t type;
int value;
};
/* NOTE: the jsontree_callback set will receive a jsonparse state */
struct jsonparse_state;
struct jsontree_callback {
uint8_t type;
int (* output)(struct jsontree_context *js_ctx);
int (* set)(struct jsontree_context *js_ctx, struct jsonparse_state *parser);
};
struct jsontree_pair {
const char *name;
struct jsontree_value *value;
};
struct jsontree_object {
uint8_t type;
uint8_t count;
struct jsontree_pair *pairs;
};
struct jsontree_array {
uint8_t type;
uint8_t count;
struct jsontree_value **values;
};
#define JSONTREE_STRING(text) {JSON_TYPE_STRING, (text)}
#define JSONTREE_PAIR(name, value) {(name), (struct jsontree_value *)(value)}
#define JSONTREE_CALLBACK(output, set) {JSON_TYPE_CALLBACK, (output), (set)}
#define JSONTREE_OBJECT(name, ...) \
static struct jsontree_pair jsontree_pair_##name[] = {__VA_ARGS__}; \
static struct jsontree_object name = { \
JSON_TYPE_OBJECT, \
sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \
jsontree_pair_##name }
#define JSONTREE_PAIR_ARRAY(value) (struct jsontree_value *)(value)
#define JSONTREE_ARRAY(name, ...) \
static struct jsontree_value* jsontree_value_##name[] = {__VA_ARGS__}; \
static struct jsontree_array name = { \
JSON_TYPE_ARRAY, \
sizeof(jsontree_value_##name)/sizeof(struct jsontree_value*), \
jsontree_value_##name }
#define JSONTREE_OBJECT_EXT(name, ...) \
static struct jsontree_pair jsontree_pair_##name[] = {__VA_ARGS__}; \
struct jsontree_object name = { \
JSON_TYPE_OBJECT, \
sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \
jsontree_pair_##name }
void jsontree_setup(struct jsontree_context *js_ctx,
struct jsontree_value *root, int (* putchar)(int));
void jsontree_reset(struct jsontree_context *js_ctx);
const char *jsontree_path_name(const struct jsontree_context *js_ctx,
int depth);
void jsontree_write_int(const struct jsontree_context *js_ctx, int value);
void jsontree_write_int_array(const struct jsontree_context *js_ctx, const int *text, uint32 length);
void jsontree_write_atom(const struct jsontree_context *js_ctx,
const char *text);
void jsontree_write_string(const struct jsontree_context *js_ctx,
const char *text);
int jsontree_print_next(struct jsontree_context *js_ctx);
struct jsontree_value *jsontree_find_next(struct jsontree_context *js_ctx,
int type);
#endif /* __JSONTREE_H__ */
/*
* Copyright (c) 2011-2012, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*/
/**
* \file
* JSON output generation
* \author
* Niclas Finne <nfi@sics.se>
* Joakim Eriksson <joakime@sics.se>
*/
#ifndef __JSONTREE_H__
#define __JSONTREE_H__
#include "c_types.h"
#include "json/json.h"
#ifdef JSONTREE_CONF_MAX_DEPTH
#define JSONTREE_MAX_DEPTH JSONTREE_CONF_MAX_DEPTH
#else
#define JSONTREE_MAX_DEPTH 10
#endif /* JSONTREE_CONF_MAX_DEPTH */
struct jsontree_context {
struct jsontree_value *values[JSONTREE_MAX_DEPTH];
uint16_t index[JSONTREE_MAX_DEPTH];
int (* putchar)(int);
uint8_t depth;
uint8_t path;
int callback_state;
};
struct jsontree_value {
uint8_t type;
/* followed by a value */
};
struct jsontree_string {
uint8_t type;
const char *value;
};
struct jsontree_int {
uint8_t type;
int value;
};
/* NOTE: the jsontree_callback set will receive a jsonparse state */
struct jsonparse_state;
struct jsontree_callback {
uint8_t type;
int (* output)(struct jsontree_context *js_ctx);
int (* set)(struct jsontree_context *js_ctx, struct jsonparse_state *parser);
};
struct jsontree_pair {
const char *name;
struct jsontree_value *value;
};
struct jsontree_object {
uint8_t type;
uint8_t count;
struct jsontree_pair *pairs;
};
struct jsontree_array {
uint8_t type;
uint8_t count;
struct jsontree_value **values;
};
#define JSONTREE_STRING(text) {JSON_TYPE_STRING, (text)}
#define JSONTREE_PAIR(name, value) {(name), (struct jsontree_value *)(value)}
#define JSONTREE_CALLBACK(output, set) {JSON_TYPE_CALLBACK, (output), (set)}
#define JSONTREE_OBJECT(name, ...) \
static struct jsontree_pair jsontree_pair_##name[] = {__VA_ARGS__}; \
static struct jsontree_object name = { \
JSON_TYPE_OBJECT, \
sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \
jsontree_pair_##name }
#define JSONTREE_PAIR_ARRAY(value) (struct jsontree_value *)(value)
#define JSONTREE_ARRAY(name, ...) \
static struct jsontree_value* jsontree_value_##name[] = {__VA_ARGS__}; \
static struct jsontree_array name = { \
JSON_TYPE_ARRAY, \
sizeof(jsontree_value_##name)/sizeof(struct jsontree_value*), \
jsontree_value_##name }
#define JSONTREE_OBJECT_EXT(name, ...) \
static struct jsontree_pair jsontree_pair_##name[] = {__VA_ARGS__}; \
struct jsontree_object name = { \
JSON_TYPE_OBJECT, \
sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \
jsontree_pair_##name }
void jsontree_setup(struct jsontree_context *js_ctx,
struct jsontree_value *root, int (* putchar)(int));
void jsontree_reset(struct jsontree_context *js_ctx);
const char *jsontree_path_name(const struct jsontree_context *js_ctx,
int depth);
void jsontree_write_int(const struct jsontree_context *js_ctx, int value);
void jsontree_write_int_array(const struct jsontree_context *js_ctx, const int *text, uint32 length);
void jsontree_write_atom(const struct jsontree_context *js_ctx,
const char *text);
void jsontree_write_string(const struct jsontree_context *js_ctx,
const char *text);
int jsontree_print_next(struct jsontree_context *js_ctx);
struct jsontree_value *jsontree_find_next(struct jsontree_context *js_ctx,
int type);
#endif /* __JSONTREE_H__ */

View File

@ -0,0 +1,17 @@
old.0.compiler.path={runtime.ide.path}/hardware/tools/avr/bin/
new.0.compiler.path={runtime.tools.avr-gcc.path}/bin/
added.tools.avrdude.path={runtime.tools.avrdude.path}
old.1.tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
new.1.tools.avrdude.cmd.path={path}/bin/avrdude
old.2.tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf
new.2.tools.avrdude.config.path={path}/etc/avrdude.conf
old.3.compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
new.3.compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
old.4.tools.bossac.path={runtime.ide.path}/hardware/tools
new.4.tools.bossac.path={runtime.tools.bossac.path}