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
2709258c
Commit
2709258c
authored
Jan 11, 2015
by
funshine
Browse files
using esptool.py in all platform, fix makefile on windows
parent
bc33967c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
2709258c
...
...
@@ -29,6 +29,7 @@ ifeq ($(OS),Windows_NT)
CPP
=
xtensa-lx106-elf-cpp
OBJCOPY
=
xtensa-lx106-elf-objcopy
endif
FIRMWAREDIR
=
..
\\
bin
\\
ifeq
($(PROCESSOR_ARCHITECTURE),AMD64)
# ->AMD64
endif
...
...
@@ -44,7 +45,7 @@ else
NM
=
xtensa-lx106-elf-nm
CPP
=
xtensa-lx106-elf-cpp
OBJCOPY
=
xtensa-lx106-elf-objcopy
FIRMWAREDIR
=
../bin/
UNAME_S
:=
$(
shell
uname
-s
)
ifeq
($(UNAME_S),Linux)
# LINUX
...
...
@@ -136,7 +137,7 @@ endef
$(BINODIR)/%.bin
:
$(IMAGEODIR)/%.out
@
mkdir
-p
$(BINODIR)
../tools/esptool.py elf2image
$<
-o
$(
BINO
DIR)
/
../tools/esptool.py elf2image
$<
-o
$(
FIRMWARE
DIR)
#############################################################
# Rules base
...
...
app/.cproject
View file @
2709258c
...
...
@@ -72,27 +72,26 @@
<storageModule
moduleId=
"org.eclipse.cdt.make.core.buildtargets"
>
<buildTargets>
<target
name=
"all"
path=
""
targetID=
"org.eclipse.cdt.build.MakeTargetBuilder"
>
<buildCommand>
${PWD}/gen_misc.bat
</buildCommand>
<buildCommand>
make
</buildCommand>
<buildArguments/>
<buildTarget>
all
</buildTarget>
<stopOnError>
true
</stopOnError>
<useDefaultCommand>
fals
e
</useDefaultCommand>
<useDefaultCommand>
tru
e
</useDefaultCommand>
<runAllBuilders>
true
</runAllBuilders>
</target>
<target
name=
"clean"
path=
""
targetID=
"org.eclipse.cdt.build.MakeTargetBuilder"
>
<buildCommand>
make
</buildCommand>
<buildArguments/>
<buildTarget>
clean
</buildTarget>
<stopOnError>
true
</stopOnError>
<useDefaultCommand>
true
</useDefaultCommand>
<runAllBuilders>
true
</runAllBuilders>
</target>
<target
name=
"flash"
path=
""
targetID=
"org.eclipse.cdt.build.MakeTargetBuilder"
>
<buildCommand>
${PWD}/flash.bat
</buildCommand>
<buildCommand>
make
</buildCommand>
<buildArguments/>
<buildTarget
/
>
<buildTarget
>
flash
</buildTarget
>
<stopOnError>
true
</stopOnError>
<useDefaultCommand>
fals
e
</useDefaultCommand>
<useDefaultCommand>
tru
e
</useDefaultCommand>
<runAllBuilders>
true
</runAllBuilders>
</target>
</buildTargets>
...
...
app/Makefile
View file @
2709258c
...
...
@@ -157,12 +157,18 @@ sinclude $(PDIR)Makefile
# generate bin file
#
ifeq
($(OS),Windows_NT)
PORT
=
com1
else
PORT
=
/dev/ttyUSB0
endif
$(BINODIR)/%.bin
:
$(IMAGEODIR)/%.out
@
mkdir
-p
$(BINODIR)
../tools/esptool.py elf2image
$<
-o
$(
BINO
DIR)
/
../tools/esptool.py elf2image
$<
-o
$(
FIRMWARE
DIR)
flash
:
../tools/esptool.py write_flash 0x00000
$(BINODIR)
/0x00000.bin 0x10000
$(BINODIR)
/0x10000.bin
../tools/esptool.py
-p
$(PORT)
write_flash 0x00000
../bin
/0x00000.bin 0x10000
../bin
/0x10000.bin
.PHONY
:
FORCE
FORCE
:
tools/esptool.py
View file @
2709258c
#!/usr/bin/env python
2.7
#!/usr/bin/env python
#
# ESP8266 ROM Bootloader Utility
# https://github.com/themadinventor/esptool
...
...
@@ -270,9 +270,12 @@ class ELFFile:
return
self
.
symbols
=
{}
try
:
proc
=
subprocess
.
Popen
([
"xtensa-lx106-elf-nm"
,
self
.
name
],
stdout
=
subprocess
.
PIPE
)
tool_nm
=
"xtensa-lx106-elf-nm"
if
os
.
getenv
(
'XTENSA_CORE'
)
==
'lx106'
:
tool_nm
=
"xt-nm"
proc
=
subprocess
.
Popen
([
tool_nm
,
self
.
name
],
stdout
=
subprocess
.
PIPE
)
except
OSError
:
print
"Error calling
xtensa-lx106-elf-nm
, do you have Xtensa toolchain in PATH?"
print
"Error calling
"
+
tool_nm
+
"
, do you have Xtensa toolchain in PATH?"
sys
.
exit
(
1
)
for
l
in
proc
.
stdout
:
fields
=
l
.
strip
().
split
()
...
...
@@ -283,7 +286,10 @@ class ELFFile:
return
self
.
symbols
[
sym
]
def
load_section
(
self
,
section
):
subprocess
.
check_call
([
"xtensa-lx106-elf-objcopy"
,
"--only-section"
,
section
,
"-Obinary"
,
self
.
name
,
".tmp.section"
])
tool_objcopy
=
"xtensa-lx106-elf-objcopy"
if
os
.
getenv
(
'XTENSA_CORE'
)
==
'lx106'
:
tool_objcopy
=
"xt-objcopy"
subprocess
.
check_call
([
tool_objcopy
,
"--only-section"
,
section
,
"-Obinary"
,
self
.
name
,
".tmp.section"
])
f
=
open
(
".tmp.section"
,
"rb"
)
data
=
f
.
read
()
f
.
close
()
...
...
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