Skip to content

Commit 2b8d55d

Browse files
author
ficeto
committed
Merge pull request #32 from esp8266/esp8266
pull master
2 parents 0af01d6 + 877f8ff commit 2b8d55d

File tree

6 files changed

+151
-112
lines changed

6 files changed

+151
-112
lines changed

build/.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.zip
2+
linux/*tar.gz
3+
linux/dist/*tgz
4+
macosx/*tar.gz
5+
macosx/dist/*tgz
6+
windows/*zip
7+
windows/dist/*tgz

build/build_board_manager_package.sh

+23-7
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,29 @@ outdir=esp8266-$ver
55
srcdir=../hardware/esp8266com/esp8266/
66
mkdir -p $outdir
77
cp -R $srcdir/* $outdir/
8+
9+
cp -R ../libraries/SD $outdir/libraries/
10+
cp -R ../libraries/Adafruit_ILI9341 $outdir/libraries/
11+
cp -R ../libraries/OneWire $outdir/libraries/
12+
813
cat $srcdir/platform.txt | \
914
gsed 's/runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-lx106-elf//g' | \
1015
gsed 's/runtime.tools.esptool.path={runtime.platform.path}\/tools//g' | \
1116
gsed 's/tools.esptool.path={runtime.platform.path}\/tools/tools.esptool.path=\{runtime.tools.esptool.path\}/g' \
1217
> $outdir/platform.txt
1318

1419
zip -r $outdir.zip $outdir
20+
rm -rf $outdir
1521
sha=`shasum -a 256 $outdir.zip | cut -f 1 -d ' '`
1622
size=`/bin/ls -l $outdir.zip | awk '{print $5}'`
1723
echo Size: $size
1824
echo SHA-256: $sha
1925

20-
scp $outdir.zip dl:apps/download_files/download/
21-
26+
if [ ! -z "$do_upload" ]; then
27+
remote="http://arduino.esp8266.com"
28+
else
29+
remote="http://localhost:8000"
30+
fi
2231

2332
cat << EOF > package_esp8266com_index.json
2433
{
@@ -36,7 +45,7 @@ cat << EOF > package_esp8266com_index.json
3645
"architecture":"esp8266",
3746
"version":"$ver",
3847
"category":"ESP8266",
39-
"url":"http://arduino.esp8266.com/$outdir.zip",
48+
"url":"$remote/$outdir.zip",
4049
"archiveFileName":"$outdir.zip",
4150
"checksum":"SHA-256:$sha",
4251
"size":"$size",
@@ -85,11 +94,11 @@ cat << EOF > package_esp8266com_index.json
8594
"size":"12513"
8695
},
8796
{
88-
"host":"i686-pc-linux-gnu",
89-
"url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-linux32.tar.gz",
97+
"host":"i686-pc-linux-gnu",
98+
"url":"https://github.com/igrr/esptool-ck/releases/download/0.4.4/esptool-0.4.4-linux32.tar.gz",
9099
"archiveFileName":"esptool-0.4.4-linux32.tar.gz",
91100
"checksum":"SHA-256:4aa81b97a470641771cf371e5d470ac92d3b177adbe8263c4aae66e607b67755",
92-
"size":"12044"
101+
"size":"12044"
93102
}
94103
]
95104
},
@@ -131,5 +140,12 @@ cat << EOF > package_esp8266com_index.json
131140
}
132141
EOF
133142

134-
scp package_esp8266com_index.json dl:apps/download_files/download
143+
if [ ! -z "$do_upload" ]; then
144+
scp $outdir.zip dl:apps/download_files/download/
145+
scp package_esp8266com_index.json dl:apps/download_files/download
146+
else
147+
python -m SimpleHTTPServer
148+
fi
149+
150+
135151

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
3+
# Current version
4+
5+
- Add 32-bit Linux toolchain
6+
- Better connection handling in ESP8266WebServer.
7+
The server now sends Content-Length and Connection: close headers,
8+
then waits for the client to disconnect. By not closing the connection
9+
actively, server avoids TIME_WAIT TCP state, and the TCP stack is able to
10+
release the memory immediately, without waiting for 2xMSL period.
11+
If the client doesn't disconnect in 2000ms, the server closes the connection
12+
actively.
13+
- Add Hash library, which has a function to calculate SHA1 hash.
14+
15+
---
16+
17+
# 1.6.4-g545ffde
18+
19 May, 2015
19+
20+
- Initial release of board manager package
21+

hardware/esp8266com/esp8266/libraries/EEPROM/EEPROM.cpp

+63-67
Original file line numberDiff line numberDiff line change
@@ -28,95 +28,91 @@
2828
#include "os_type.h"
2929
#include "osapi.h"
3030
#include "spi_flash.h"
31-
extern uint32_t _SPIFFS_end;
3231
}
3332

34-
#define CONFIG_START_SECTOR (((uint32_t)_SPIFFS_end - 0x40200000) / 4096)
35-
#define CONFIG_SECTOR (CONFIG_START_SECTOR + 0)
36-
#define CONFIG_ADDR (SPI_FLASH_SEC_SIZE * CONFIG_SECTOR)
37-
38-
EEPROMClass::EEPROMClass()
39-
: _data(0), _size(0), _dirty(false)
33+
EEPROMClass::EEPROMClass(uint32_t sector)
34+
: _sector(sector)
35+
, _data(0)
36+
, _size(0)
37+
, _dirty(false)
4038
{
4139
}
4240

43-
void EEPROMClass::begin(size_t size)
44-
{
45-
if (size <= 0)
46-
return;
47-
if (size > SPI_FLASH_SEC_SIZE)
48-
size = SPI_FLASH_SEC_SIZE;
41+
void EEPROMClass::begin(size_t size) {
42+
if (size <= 0)
43+
return;
44+
if (size > SPI_FLASH_SEC_SIZE)
45+
size = SPI_FLASH_SEC_SIZE;
46+
47+
if (_data) {
48+
delete[] _data;
49+
}
4950

50-
_data = new uint8_t[size];
51-
_size = size;
51+
_data = new uint8_t[size];
52+
_size = size;
5253

53-
noInterrupts();
54-
spi_flash_read(CONFIG_ADDR, reinterpret_cast<uint32_t*>(_data), _size);
55-
interrupts();
54+
noInterrupts();
55+
spi_flash_read(_sector * SPI_FLASH_SEC_SIZE, reinterpret_cast<uint32_t*>(_data), _size);
56+
interrupts();
5657
}
5758

58-
void EEPROMClass::end()
59-
{
60-
if (!_size)
61-
return;
59+
void EEPROMClass::end() {
60+
if (!_size)
61+
return;
6262

63-
commit();
64-
if(_data) {
65-
delete[] _data;
66-
}
67-
_data = 0;
68-
_size = 0;
63+
commit();
64+
if(_data) {
65+
delete[] _data;
66+
}
67+
_data = 0;
68+
_size = 0;
6969
}
7070

7171

72-
uint8_t EEPROMClass::read(int address)
73-
{
74-
if (address < 0 || (size_t)address >= _size)
75-
return 0;
76-
if(!_data)
77-
return 0;
72+
uint8_t EEPROMClass::read(int address) {
73+
if (address < 0 || (size_t)address >= _size)
74+
return 0;
75+
if(!_data)
76+
return 0;
7877

79-
return _data[address];
78+
return _data[address];
8079
}
8180

82-
void EEPROMClass::write(int address, uint8_t value)
83-
{
84-
if (address < 0 || (size_t)address >= _size)
85-
return;
86-
if(!_data)
87-
return;
81+
void EEPROMClass::write(int address, uint8_t value) {
82+
if (address < 0 || (size_t)address >= _size)
83+
return;
84+
if(!_data)
85+
return;
8886

89-
_data[address] = value;
90-
_dirty = true;
87+
_data[address] = value;
88+
_dirty = true;
9189
}
9290

93-
bool EEPROMClass::commit()
94-
{
95-
bool ret = false;
96-
if (!_size)
97-
return false;
98-
if(!_dirty)
99-
return true;
100-
if(!_data)
101-
return false;
102-
103-
noInterrupts();
104-
if(spi_flash_erase_sector(CONFIG_SECTOR) == SPI_FLASH_RESULT_OK) {
105-
if(spi_flash_write(CONFIG_ADDR, reinterpret_cast<uint32_t*>(_data), _size) == SPI_FLASH_RESULT_OK) {
106-
_dirty = false;
107-
ret = true;
108-
}
91+
bool EEPROMClass::commit() {
92+
bool ret = false;
93+
if (!_size)
94+
return false;
95+
if(!_dirty)
96+
return true;
97+
if(!_data)
98+
return false;
99+
100+
noInterrupts();
101+
if(spi_flash_erase_sector(_sector) == SPI_FLASH_RESULT_OK) {
102+
if(spi_flash_write(_sector * SPI_FLASH_SEC_SIZE, reinterpret_cast<uint32_t*>(_data), _size) == SPI_FLASH_RESULT_OK) {
103+
_dirty = false;
104+
ret = true;
109105
}
110-
interrupts();
106+
}
107+
interrupts();
111108

112-
return ret;
109+
return ret;
113110
}
114111

115-
uint8_t * EEPROMClass::getDataPtr()
116-
{
117-
_dirty = true;
118-
return &_data[0];
112+
uint8_t * EEPROMClass::getDataPtr() {
113+
_dirty = true;
114+
return &_data[0];
119115
}
120116

121-
122-
EEPROMClass EEPROM;
117+
extern "C" uint32_t _SPIFFS_end;
118+
EEPROMClass EEPROM((((uint32_t)&_SPIFFS_end - 0x40200000) / SPI_FLASH_SEC_SIZE));

hardware/esp8266com/esp8266/libraries/EEPROM/EEPROM.h

+36-37
Original file line numberDiff line numberDiff line change
@@ -26,43 +26,42 @@
2626
#include <stdint.h>
2727
#include <string.h>
2828

29-
class EEPROMClass
30-
{
31-
public:
32-
EEPROMClass();
33-
void begin(size_t size);
34-
uint8_t read(int address);
35-
void write(int address, uint8_t val);
36-
bool commit();
37-
void end();
38-
39-
uint8_t * getDataPtr();
40-
41-
template<typename T> T &get(int address, T &t)
42-
{
43-
if (address < 0 || address + sizeof(T) > _size)
44-
return t;
45-
46-
uint8_t *ptr = (uint8_t*) &t;
47-
memcpy(ptr, _data + address, sizeof(T));
48-
return t;
49-
}
50-
51-
template<typename T> const T &put(int address, const T &t)
52-
{
53-
if (address < 0 || address + sizeof(T) > _size)
54-
return t;
55-
56-
const uint8_t *ptr = (const uint8_t*) &t;
57-
memcpy(_data + address, ptr, sizeof(T));
58-
_dirty = true;
59-
return t;
60-
}
61-
62-
protected:
63-
uint8_t* _data;
64-
size_t _size;
65-
bool _dirty;
29+
class EEPROMClass {
30+
public:
31+
EEPROMClass(uint32_t sector);
32+
33+
void begin(size_t size);
34+
uint8_t read(int address);
35+
void write(int address, uint8_t val);
36+
bool commit();
37+
void end();
38+
39+
uint8_t * getDataPtr();
40+
41+
template<typename T>
42+
T &get(int address, T &t) {
43+
if (address < 0 || address + sizeof(T) > _size)
44+
return t;
45+
46+
memcpy((uint8_t*) &t, _data + address, sizeof(T));
47+
return t;
48+
}
49+
50+
template<typename T>
51+
const T &put(int address, const T &t) {
52+
if (address < 0 || address + sizeof(T) > _size)
53+
return t;
54+
55+
memcpy(_data + address, (const uint8_t*) &t, sizeof(T));
56+
_dirty = true;
57+
return t;
58+
}
59+
60+
protected:
61+
uint32_t _sector;
62+
uint8_t* _data;
63+
size_t _size;
64+
bool _dirty;
6665
};
6766

6867
extern EEPROMClass EEPROM;

hardware/esp8266com/esp8266/libraries/EEPROM/examples/eeprom_write/eeprom_write.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void loop()
2222
// need to divide by 4 because analog inputs range from
2323
// 0 to 1023 and each byte of the EEPROM can only hold a
2424
// value from 0 to 255.
25-
int val = analogRead(0) / 4;
25+
int val = analogRead(A0) / 4;
2626

2727
// write the value to the appropriate byte of the EEPROM.
2828
// these values will remain there when the board is

0 commit comments

Comments
 (0)