Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
aaca524c
Commit
aaca524c
authored
Jul 04, 2015
by
Vowstar
Browse files
Merge pull request #529 from nodemcu/dev096
Dev096 into master.
parents
3430e5f8
2224f24d
Changes
26
Show whitespace changes
Inline
Side-by-side
include/c_types.h
View file @
aaca524c
...
@@ -84,6 +84,9 @@ typedef enum {
...
@@ -84,6 +84,9 @@ typedef enum {
#define ICACHE_FLASH_ATTR
#define ICACHE_FLASH_ATTR
#endif
/* ICACHE_FLASH */
#endif
/* ICACHE_FLASH */
#define TEXT_SECTION_ATTR __attribute__((section(".text")))
#define RAM_CONST_ATTR __attribute__((section(".text")))
#ifndef __cplusplus
#ifndef __cplusplus
typedef
unsigned
char
bool
;
typedef
unsigned
char
bool
;
#define BOOL bool
#define BOOL bool
...
...
ld/eagle.app.v6.ld
View file @
aaca524c
...
@@ -5,7 +5,7 @@ MEMORY
...
@@ -5,7 +5,7 @@ MEMORY
dport0_0_seg : org = 0x3FF00000, len = 0x10
dport0_0_seg : org = 0x3FF00000, len = 0x10
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
dram0_0_seg : org = 0x3FFE8000, len = 0x14000
iram1_0_seg : org = 0x40100000, len = 0x8000
iram1_0_seg : org = 0x40100000, len = 0x8000
irom0_0_seg : org = 0x40210000, len = 0x
6
0000
irom0_0_seg : org = 0x40210000, len = 0x
8
0000
}
}
PHDRS
PHDRS
...
@@ -19,7 +19,7 @@ PHDRS
...
@@ -19,7 +19,7 @@ PHDRS
/* Default entry point: */
/* Default entry point: */
ENTRY(
call_
user_start)
ENTRY(user_start
_trampoline
)
PROVIDE(_memmap_vecbase_reset = 0x40000000);
PROVIDE(_memmap_vecbase_reset = 0x40000000);
/* Various memory-map dependent cache attribute settings: */
/* Various memory-map dependent cache attribute settings: */
_memmap_cacheattr_wb_base = 0x00000110;
_memmap_cacheattr_wb_base = 0x00000110;
...
@@ -72,8 +72,9 @@ SECTIONS
...
@@ -72,8 +72,9 @@ SECTIONS
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
*(.literal.* .text.*)
*(.literal.* .text.*)
/* put font and progmem data into irom0 */
/* Trade some performance for lots of ram. At the time of writing the
*(.u8g_progmem.*)
* available Lua heap went from 18248 to 34704. */
*(.rodata*)
_irom0_text_end = ABSOLUTE(.);
_irom0_text_end = ABSOLUTE(.);
_flash_used_end = ABSOLUTE(.);
_flash_used_end = ABSOLUTE(.);
...
@@ -124,10 +125,7 @@ SECTIONS
...
@@ -124,10 +125,7 @@ SECTIONS
.rodata : ALIGN(4)
.rodata : ALIGN(4)
{
{
_rodata_start = ABSOLUTE(.);
_rodata_start = ABSOLUTE(.);
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r.*)
*(.gnu.linkonce.r.*)
*(.rodata1)
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
__XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
*(.xt_except_table)
*(.xt_except_table)
*(.gcc_except_table)
*(.gcc_except_table)
...
...
lib/libsmartconfig.a
View file @
aaca524c
No preview for this file type
lua_modules/base64/base64_v2.lua
0 → 100644
View file @
aaca524c
--this version actually works
local
tab
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
base64
=
{
enc
=
function
(
data
)
local
l
,
out
=
0
,
''
local
m
=
(
3
-
data
:
len
()
%
3
)
%
3
local
d
=
data
..
string.rep
(
'
\0
'
,
m
)
for
i
=
1
,
d
:
len
()
do
l
=
bit
.
lshift
(
l
,
8
)
l
=
l
+
d
:
byte
(
i
,
i
)
if
i
%
3
==
0
then
for
j
=
1
,
4
do
local
a
=
bit
.
rshift
(
l
,
18
)
+
1
out
=
out
..
tab
:
sub
(
a
,
a
)
l
=
bit
.
band
(
bit
.
lshift
(
l
,
6
),
0xFFFFFF
)
end
end
end
return
out
:
sub
(
1
,
-
1
-
m
)
..
string.rep
(
'='
,
m
)
end
,
dec
=
function
(
data
)
local
a
,
b
=
data
:
gsub
(
'='
,
'A'
)
local
out
=
''
local
l
=
0
for
i
=
1
,
a
:
len
()
do
l
=
l
+
tab
:
find
(
a
:
sub
(
i
,
i
))
-
1
if
i
%
4
==
0
then
out
=
out
..
string.char
(
bit
.
rshift
(
l
,
16
),
bit
.
band
(
bit
.
rshift
(
l
,
8
),
255
),
bit
.
band
(
l
,
255
))
l
=
0
end
l
=
bit
.
lshift
(
l
,
6
)
end
return
out
:
sub
(
1
,
-
b
-
1
)
end
}
tools/esp-open-sdk.tar.gz
0 → 100644
View file @
aaca524c
File added
tools/esptool.py
View file @
aaca524c
...
@@ -128,30 +128,20 @@ class ESPROM:
...
@@ -128,30 +128,20 @@ class ESPROM:
def
connect
(
self
):
def
connect
(
self
):
print
'Connecting...'
print
'Connecting...'
# RTS = CH_PD (i.e reset)
for
_
in
xrange
(
4
):
# DTR = GPIO0
# issue reset-to-bootloader:
# self._port.setRTS(True)
# RTS = either CH_PD or nRESET (both active low = chip in reset)
# self._port.setDTR(True)
# DTR = GPIO0 (active low = boot to flasher)
# self._port.setRTS(False)
# time.sleep(0.1)
# self._port.setDTR(False)
# NodeMCU devkit
self
.
_port
.
setRTS
(
True
)
self
.
_port
.
setDTR
(
True
)
time
.
sleep
(
0.1
)
self
.
_port
.
setRTS
(
False
)
self
.
_port
.
setDTR
(
False
)
self
.
_port
.
setDTR
(
False
)
time
.
sleep
(
0.1
)
self
.
_port
.
setRTS
(
True
)
self
.
_port
.
setRTS
(
True
)
time
.
sleep
(
0.
1
)
time
.
sleep
(
0.
05
)
self
.
_port
.
setDTR
(
True
)
self
.
_port
.
setDTR
(
True
)
self
.
_port
.
setRTS
(
False
)
self
.
_port
.
setRTS
(
False
)
time
.
sleep
(
0.
3
)
time
.
sleep
(
0.
05
)
self
.
_port
.
setDTR
(
Tru
e
)
self
.
_port
.
setDTR
(
Fals
e
)
self
.
_port
.
timeout
=
0.
5
self
.
_port
.
timeout
=
0.
3
# worst-case latency timer should be 255ms (probably <20ms)
for
i
in
xrange
(
10
):
for
_
in
xrange
(
4
):
try
:
try
:
self
.
_port
.
flushInput
()
self
.
_port
.
flushInput
()
self
.
_port
.
flushOutput
()
self
.
_port
.
flushOutput
()
...
@@ -159,7 +149,11 @@ class ESPROM:
...
@@ -159,7 +149,11 @@ class ESPROM:
self
.
_port
.
timeout
=
5
self
.
_port
.
timeout
=
5
return
return
except
:
except
:
time
.
sleep
(
0.1
)
time
.
sleep
(
0.05
)
# this is a workaround for the CH340 serial driver on current versions of Linux,
# which seems to sometimes set the serial port up with wrong parameters
self
.
_port
.
close
()
self
.
_port
.
open
()
raise
Exception
(
'Failed to connect'
)
raise
Exception
(
'Failed to connect'
)
""" Read memory address in target """
""" Read memory address in target """
...
@@ -268,6 +262,15 @@ class ESPROM:
...
@@ -268,6 +262,15 @@ class ESPROM:
return
data
return
data
""" Abuse the loader protocol to force flash to be left in write mode """
def
flash_unlock_dio
(
self
):
# Enable flash write mode
self
.
flash_begin
(
0
,
0
)
# Reset the chip rather than call flash_finish(), which would have
# write protected the chip again (why oh why does it do that?!)
self
.
mem_begin
(
0
,
0
,
0
,
0x40100000
)
self
.
mem_finish
(
0x40000080
)
""" Perform a chip erase of SPI flash """
""" Perform a chip erase of SPI flash """
def
flash_erase
(
self
):
def
flash_erase
(
self
):
# Trick ROM to initialize SFlash
# Trick ROM to initialize SFlash
...
@@ -360,6 +363,20 @@ class ELFFile:
...
@@ -360,6 +363,20 @@ class ELFFile:
self
.
_fetch_symbols
()
self
.
_fetch_symbols
()
return
self
.
symbols
[
sym
]
return
self
.
symbols
[
sym
]
def
get_entry_point
(
self
):
tool_readelf
=
"xtensa-lx106-elf-readelf"
if
os
.
getenv
(
'XTENSA_CORE'
)
==
'lx106'
:
tool_objcopy
=
"xt-readelf"
try
:
proc
=
subprocess
.
Popen
([
tool_readelf
,
"-h"
,
self
.
name
],
stdout
=
subprocess
.
PIPE
)
except
OSError
:
print
"Error calling "
+
tool_nm
+
", do you have Xtensa toolchain in PATH?"
sys
.
exit
(
1
)
for
l
in
proc
.
stdout
:
fields
=
l
.
strip
().
split
()
if
fields
[
0
]
==
"Entry"
:
return
int
(
fields
[
3
],
0
);
def
load_section
(
self
,
section
):
def
load_section
(
self
,
section
):
tool_objcopy
=
"xtensa-lx106-elf-objcopy"
tool_objcopy
=
"xtensa-lx106-elf-objcopy"
if
os
.
getenv
(
'XTENSA_CORE'
)
==
'lx106'
:
if
os
.
getenv
(
'XTENSA_CORE'
)
==
'lx106'
:
...
@@ -552,6 +569,9 @@ if __name__ == '__main__':
...
@@ -552,6 +569,9 @@ if __name__ == '__main__':
seq
+=
1
seq
+=
1
print
print
print
'
\n
Leaving...'
print
'
\n
Leaving...'
if
args
.
flash_mode
==
'dio'
:
esp
.
flash_unlock_dio
()
else
:
esp
.
flash_finish
(
False
)
esp
.
flash_finish
(
False
)
elif
args
.
operation
==
'run'
:
elif
args
.
operation
==
'run'
:
...
@@ -586,7 +606,7 @@ if __name__ == '__main__':
...
@@ -586,7 +606,7 @@ if __name__ == '__main__':
args
.
output
=
args
.
input
+
'-'
args
.
output
=
args
.
input
+
'-'
e
=
ELFFile
(
args
.
input
)
e
=
ELFFile
(
args
.
input
)
image
=
ESPFirmwareImage
()
image
=
ESPFirmwareImage
()
image
.
entrypoint
=
e
.
get_
symbol_addr
(
"call_user_start"
)
image
.
entrypoint
=
e
.
get_
entry_point
(
)
for
section
,
start
in
((
".text"
,
"_text_start"
),
(
".data"
,
"_data_start"
),
(
".rodata"
,
"_rodata_start"
)):
for
section
,
start
in
((
".text"
,
"_text_start"
),
(
".data"
,
"_data_start"
),
(
".rodata"
,
"_rodata_start"
)):
data
=
e
.
load_section
(
section
)
data
=
e
.
load_section
(
section
)
image
.
add_segment
(
e
.
get_symbol_addr
(
start
),
data
)
image
.
add_segment
(
e
.
get_symbol_addr
(
start
),
data
)
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment