Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Files #56

Closed
scargill opened this issue Dec 27, 2014 · 28 comments
Closed

Make Files #56

scargill opened this issue Dec 27, 2014 · 28 comments

Comments

@scargill
Copy link

I'd like to have a play with this - having tried just about every binary up to now - it's great that you've made it open source. For the sake of us poor mortals on Windows who are just picking this up - I note on many of these projects they include 3 make files ... "makefile", "makefile.linux" and "makefile.windows" so that those in the Windows environment don't have to re-invent the wheel.. the MQTT project is one..

Any chance you could include those other makefiles?? I'm not sure I'd know where to start.

@pipi61
Copy link

pipi61 commented Dec 28, 2014

Hi!
if You request nodemcu makefile for windows, replace begin lines in origin makefile to:

#copyright (c) 2010 Espressif System

ifndef PDIR

endif
#Base directory for the compiler
XTENSA_TOOLS_ROOT ?= c:/Espressif/xtensa-lx106-elf/bin

AR = $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-ar
##xt-ar
CC = $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc
##xt-xcc
NM = $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-nm
##xt-nm
CPP = $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-cpp
##xt-cpp
OBJCOPY = $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objcopy
##xt-objcopy
#MAKE = xt-make

@scargill
Copy link
Author

Is that it? Just add that to the top of the file, call it makefile.windows and it’ll work in Windows??

From: Istvan Puzsar [mailto:notifications@github.com]
Sent: 28 December 2014 00:03
To: nodemcu/nodemcu-firmware
Cc: scargill
Subject: Re: [nodemcu-firmware] Make Files (#56)

Hi!
if You request nodemcu makefile, replace begin lines in makefile to:
#copyright (c) 2010 Espressif System
ifndef PDIR
endif
#Base directory for the compiler
XTENSA_TOOLS_ROOT ?= c:/Espressif/xtensa-lx106-elf/bin
AR = $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-ar
##xt-ar
CC = $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc
##xt-xcc
NM = $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-nm
##xt-nm
CPP = $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-cpp
##xt-cpp
OBJCOPY = $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objcopy
##xt-objcopy
#MAKE = xt-make

Reply to this email directly or view it on GitHub #56 (comment) .Image removed by sender.

@pipi61
Copy link

pipi61 commented Dec 28, 2014

HI!
patch/create nodemcu-firmware makefile, batch files for windows
the linux files not patched
download and install My Espressif DevKit for Windows + Eclipse IDE
http://www.esp8266.com/viewtopic.php?f=9&t=820
download https://github.com/nodemcu/nodemcu-firmware
unzip to c:\Espressif
download http://puzsar.hu/esp8266/nodemcu-firmware-master_patch_win.zip
unzip to c:\Espressif\ (overwrite files if exists)
open c:\Espressif\nodemcu-firmware-master\ directrory
and run makeall_flash.bat this batch file compile files, and write to flash
please check com port number in flash*.bat
tested in windows xp 32bit
__
Dear Nodemcu!
If like this patch, please include to firmware
Thank You
Istvan

@nodemcu
Copy link
Collaborator

nodemcu commented Dec 29, 2014

Great, I am downloading.
and is it possible to make this compliant with Linux gcc-toolchain and windows xtensa toolchain.

@pipi61
Copy link

pipi61 commented Dec 29, 2014

Hi!
If download before 2014.12.28 23:45 (gmt+2), please download again, the gen_misc*.bat contain bad path.
Sorry, thanks

@scargill
Copy link
Author

Just a little clarity please... Assume that the Eclipse installation is already done - has all he projects in Espressif/examples - and that the installation is already compiling and blowing other packages (the setup for this comes with a load of installations already).

So what is then left to do.... change the Makefile?? What else.. when I tried to copy nodemcu-firmware into espressif/examples and then IMPORT in Eclipse - nothing happened - the ok button was greyed out...

@pipi61
Copy link

pipi61 commented Dec 31, 2014

Hi
Please view video: http://www.esp8266.com/viewtopic.php?f=9&t=820 to import existed eclipse projects.
Working, tested in xp32bit.
Help to create new existed project, import not eclipse project:
eclipse_import
Puzsar

@pipi61
Copy link

pipi61 commented Dec 31, 2014

Warning, the directory name doesn't contain spaces!!!

@johnmx
Copy link

johnmx commented Jan 8, 2015

Hi,
I followed your instructions and the compiler returned the following error:

c:/espressif/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../
xtensa-lx106-elf/bin/ld.exe: .output/eagle/debug/image/eagle.app.v6.out section
.text' will not fit in regioniram1_0_seg'
collect2.exe: error: ld returned 1 exit status

Any idea where is the problem? (compiler optimization...?)
Thanks

@scargill
Copy link
Author

scargill commented Jan 8, 2015

Hi, I followed your instructions and the compiler returned the following error:

I hope that others can help – I am not yet an expert on using that compiler.

@scargill
Copy link
Author

scargill commented Jan 8, 2015

Hi there

I have followed the instructions a number of times - in each case there is ONE item missing from your otherwise excellent instructions - you assume everyone has PYTHON27 installed - which of course they don't.

I've just installed the lot on a new machine and followed your further instructions to install the LUA interpreter.

At the end..... I'm getting problems - I have followed the instructions EXACTLY and then installed Python..

c:\Espressif\nodemcu-firmware-master\app\.output\eagle\debug\image>xtensa-lx106-elf-objcopy.exe --only-section .data -O binary eagle.app.v6.out eagle.app.v6.dat a.bin
xtensa-lx106-elf-objcopy.exe: 'eagle.app.v6.out': No such file

c:\Espressif\nodemcu-firmware-master\app\.output\eagle\debug\image>rem xt-objcopy

c:\Espressif\nodemcu-firmware-master\app\.output\eagle\debug\image>xtensa-lx106-
elf-objcopy.exe --only-section .rodata -O binary eagle.app.v6.out eagle.app.v6.rodata.bin
xtensa-lx106-elf-objcopy.exe: 'eagle.app.v6.out': No such file

c:\Espressif\nodemcu-firmware-master\app\.output\eagle\debug\image>rem xt-objcopy

c:\Espressif\nodemcu-firmware-master\app\.output\eagle\debug\image>xtensa-lx106-
elf-objcopy.exe --only-section .irom0.text -O binary eagle.app.v6.out eagle.app.v6.irom0text.bin
xtensa-lx106-elf-objcopy.exe: 'eagle.app.v6.out': No such file

c:\Espressif\nodemcu-firmware-master\app\.output\eagle\debug\image>c:\Espressif\
nodemcu-firmware-master\tools\gen_appbin_win.py eagle.app.v6.out v6
c:/Espressif/xtensa-lx106-elf/bin/xtensa-lx106-elf-nm.exe: 'eagle.app.v6.out': No such file
no entry point!!
Press any key to continue . . .

@johnmx
Copy link

johnmx commented Jan 8, 2015

Scargill, those messages are a consequence and not the problem. E.g. you cannot link if any object file isn’t created (compiled).
Like in my case, probably you have and error before that cancels the compiling. Check the output messages before those.

@nodemcu
Copy link
Collaborator

nodemcu commented Jan 9, 2015

I have fixed the eclipse project. now you can import it and build it.
compile ok, gen bin ok, clean ok.
flash not ok with esptool.py. (it seems esptool.py can only flash combined bin?)
flash with nodemcu-flasher ok.

have to install python27 and pyserial27

@scargill
Copy link
Author

scargill commented Jan 9, 2015

Hi there

Loaded the master ZIP off your site just now.. unzipped and dumped the whole thing into ECLIPSE. Told Eclipse to import – APP.

Looks good – and ALL seems to compile but no… It’s not finding MAKE…

The AT demo works a treat – the MQTT import works a treat… but I’m having no luck with nodeMCU –I downloaded your code this morning..

Tried this on 2 machines – same result.

08:14:08 **** Build of configuration Default for project nodemcu-firmware ****

"C:\\Espressif\\examples\\nodemcu-firmware-master\\app\\gen_misc.bat" all 
C:\Espressif\examples\nodemcu-firmware-master\app>make all 

'make' is not recognized as an internal or external command,

C:\Espressif\examples\nodemcu-firmware-master\app>del /F ..\bin\eagle.app.v6.flash.bin ..\bin\eagle.app.v6.irom0text.bin ..\bin\eagle.app.v6.dump ..\bin\eagle.app.v6.S 

operable program or batch file.

Could Not Find C:\Espressif\examples\nodemcu-firmware-master\bin\eagle.app.v6.flash.bin

C:\Espressif\examples\nodemcu-firmware-master\app>cd .output\eagle\debug\image 

The system cannot find the path specified.
The system cannot find the path specified.

C:\Espressif\examples\nodemcu-firmware-master\app>xtensa-lx106-elf-objdump  -x -s eagle.app.v6.out  1>..\..\..\..\..\bin\eagle.app.v6.dump 

The system cannot find the path specified.

C:\Espressif\examples\nodemcu-firmware-master\app>xtensa-lx106-elf-objdump  -S eagle.app.v6.out  1>..\..\..\..\..\bin\eagle.app.v6.S 

C:\Espressif\examples\nodemcu-firmware-master\app>xtensa-lx106-elf-objcopy --only-section .text -O binary eagle.app.v6.out eagle.app.v6.text.bin 

xtensa-lx106-elf-objcopy: 'eagle.app.v6.out': No such file

C:\Espressif\examples\nodemcu-firmware-master\app>xtensa-lx106-elf-objcopy --only-section .data -O binary eagle.app.v6.out eagle.app.v6.data.bin 

xtensa-lx106-elf-objcopy: 'eagle.app.v6.out': No such file

C:\Espressif\examples\nodemcu-firmware-master\app>xtensa-lx106-elf-objcopy --only-section .rodata -O binary eagle.app.v6.out eagle.app.v6.rodata.bin 

xtensa-lx106-elf-objcopy: 'eagle.app.v6.out': No such file

C:\Espressif\examples\nodemcu-firmware-master\app>xtensa-lx106-elf-objcopy --only-section .irom0.text -O binary eagle.app.v6.out eagle.app.v6.irom0text.bin 

xtensa-lx106-elf-objcopy: 'eagle.app.v6.out': No such file

C:\Espressif\examples\nodemcu-firmware-master\app>gen_appbin.py eagle.app.v6.out v6 

xtensa-lx106-elf-nm: 'eagle.app.v6.out': No such file

no entry point!!

Traceback (most recent call last):

  File "C:\Espressif\examples\nodemcu-firmware-master\tools\gen_appbin.py", line 69, in <module>

    cmd = 'genflashbin%s eagle.app.%s.text.bin '%(ver, ver)+entry_addr+' eagle.app.%s.data.bin '%(ver)+ data_start_addr+' eagle.app.%s.rodata.bin '%(ver)+rodata_start_addr

TypeError: cannot concatenate 'str' and 'NoneType' objects

C:\Espressif\examples\nodemcu-firmware-master\app>xcopy /y eagle.app.v6.irom0text.bin ..\..\..\..\..\bin\ 

0 File(s) copied

File not found - eagle.app.v6.irom0text.bin

C:\Espressif\examples\nodemcu-firmware-master\app>xcopy /y eagle.app.v6.flash.bin ..\..\..\..\..\bin\ 

0 File(s) copied

File not found - eagle.app.v6.flash.bin

C:\Espressif\examples\nodemcu-firmware-master\app>cd ..\..\..\..\ 

08:14:09 Build Finished (took 190ms)

@nodemcu
Copy link
Collaborator

nodemcu commented Jan 9, 2015

right click the imported project.
select Properties, under C/C++ Build find Environment,
click Add..., name PATH, value: C:\Espressif\xtensa-lx106-elf\bin
press ok , ok.

Or, just add C:\Espressif\xtensa-lx106-elf\bin to the system environment PATH.

@nodemcu
Copy link
Collaborator

nodemcu commented Jan 9, 2015

have you delete the previous nodemcu-firmware project completely.
I follow your step, download zip, extract and import. works

@nodemcu
Copy link
Collaborator

nodemcu commented Jan 9, 2015

Oh, also add
C:\MinGW\bin;C:\MinGW\msys\1.0\bin; to system environment PATH
and ;C:\Python27;

@scargill
Copy link
Author

scargill commented Jan 9, 2015

Hi yes I did – and I’m trying this on 2 computers.. I also made sure that I added the PATH item you suggested AND checked that the path exists. I still get this.

 09:52:10 **** Build of configuration Default for project nodemcu-firmware ****
 make clean 
 Cannot run program "make": Launching failed
 Error: Program "make" not found in PATH

 PATH=[C:\Windows\system32;C:/Program Files (x86)/Java/jre1.8.0_25/bin/client;C:/Program Files (x86)/Java/jre1.8.0_25/bin;C:/Program Files (x86)/Java/jre1.8.0_25/lib/i386;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\adb;C:\Program Files\nodejs\;C:\Users\Peter\AppData\Roaming\npm;C:\Espressif\xtensa-lx106-elf\bin]

 09:52:10 Build Finished (took 39ms)

@scargill
Copy link
Author

scargill commented Jan 9, 2015

RIGHT! NOW I can compile. TThe FLASH item at the end of not working – and in you MAKEFILE I can’t see the COM port reference? It says it can’t find SERIAL – but other projects are blowing FLASH?? Ok, installed PYSERIAL – wants to use COM1 – where do you set the COM port?

10:00:47 **** Build of configuration Default for project nodemcu-firmware ****

"C:\\Espressif\\examples\\nodemcu-firmware-master\\app\\flash.bat" 
C:\Espressif\examples\nodemcu-firmware-master\app>rem gen_misc.bat 
C:\Espressif\examples\nodemcu-firmware-master\app>rem eagle.app.v6.flash.bin: 0x00000 
C:\Espressif\examples\nodemcu-firmware-master\app>rem eagle.app.v6.irom0text.bin: 0x10000 
C:\Espressif\examples\nodemcu-firmware-master\app>rem esp_init_data_default.bin: 0x7c000 
C:\Espressif\examples\nodemcu-firmware-master\app>rem blank.bin: 0x7e000 
C:\Espressif\examples\nodemcu-firmware-master\app>cd ..\bin 
C:\Espressif\examples\nodemcu-firmware-master\bin>esptool.py -p com1 write_flash 0x00000 eagle.app.v6.flash.bin 0x10000 eagle.app.v6.irom0text.bin 0x7c000 esp_init_data_default.bin 0x7e000 blank.bin 

Traceback (most recent call last):
  File "C:\Espressif\examples\nodemcu-firmware-master\tools\esptool.py", line 22, in <module>
    import serial
ImportError: No module named serial

C:\Espressif\examples\nodemcu-firmware-master\bin>echo ************************* flash end ************************************* 
************************* flash end *************************************

C:\Espressif\examples\nodemcu-firmware-master\bin>cd ..\app 
10:00:48 Build Finished (took 126ms)

@nodemcu
Copy link
Collaborator

nodemcu commented Jan 9, 2015

in flash.bat or flash.sh file。

@nodemcu
Copy link
Collaborator

nodemcu commented Jan 9, 2015

esptool.py have some problem when flash two piece as one firmware.
ref this #81

@scargill
Copy link
Author

scargill commented Jan 9, 2015

You might be interested in this – the MAKEFILE for the AT software – there is an EXE file for flashing the chips and hence PY stuff not used – also COM port is set in the same file..

Changelog

Changed the variables to include the header file directory

Added global var for the XTENSA tool root

This make file still needs some work.

Output directors to store intermediate compiled files

relative to the project directory

BUILD_BASE = build

FW_BASE = firmware

Base directory for the compiler

XTENSA_TOOLS_ROOT ?= c:/Espressif/xtensa-lx106-elf/bin

base directory of the ESP8266 SDK package, absolute

SDK_BASE ?= c:/Espressif/ESP8266_SDK

#Esptool.py path and port

ESPTOOL ?= c:\Espressif\utils\esptool.exe

ESPPORT ?= COM4

name for the target project

TARGET = app

which modules (subdirectories) of the project to include in compiling

MODULES = driver user

EXTRA_INCDIR = include $(SDK_BASE)/../include

libraries used in this project, mainly provided by the SDK

LIBS = c gcc hal phy pp net80211 lwip wpa upgrade main

compiler flags using during compilation of source files

CFLAGS = -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH

linker flags used to generate the main object file

LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static

linker script used for the above linkier step

LD_SCRIPT = eagle.app.v6.ld

various paths from the SDK used in this project

SDK_LIBDIR = lib

SDK_LDDIR = ld

SDK_INCDIR = include include/json

we create two different files for uploading into the flash

these are the names and options to generate them

FW_FILE_1 = 0x00000

FW_FILE_1_ARGS = -bo $@ -bs .text -bs .data -bs .rodata -bc -ec

FW_FILE_2 = 0x40000

FW_FILE_2_ARGS = -es .irom0.text $@ -ec

select which tools to use as compiler, librarian and linker

CC := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc

AR := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-ar

LD := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc

no user configurable options below here

FW_TOOL ?= $(XTENSA_TOOLS_ROOT)/esptool

SRC_DIR := $(MODULES)

BUILD_DIR := $(addprefix $(BUILD_BASE)/,$(MODULES))

SDK_LIBDIR := $(addprefix $(SDK_BASE)/,$(SDK_LIBDIR))

SDK_INCDIR := $(addprefix -I$(SDK_BASE)/,$(SDK_INCDIR))

SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.c))

OBJ := $(patsubst %.c,$(BUILD_BASE)/%.o,$(SRC))

LIBS := $(addprefix -l,$(LIBS))

APP_AR := $(addprefix $(BUILD_BASE)/,$(TARGET)_app.a)

TARGET_OUT := $(addprefix $(BUILD_BASE)/,$(TARGET).out)

LD_SCRIPT := $(addprefix -T$(SDK_BASE)/$(SDK_LDDIR)/,$(LD_SCRIPT))

INCDIR := $(addprefix -I,$(SRC_DIR))

EXTRA_INCDIR := $(addprefix -I,$(EXTRA_INCDIR))

MODULE_INCDIR := $(addsuffix /include,$(INCDIR))

FW_FILE_1 := $(addprefix $(FW_BASE)/,$(FW_FILE_1).bin)

FW_FILE_2 := $(addprefix $(FW_BASE)/,$(FW_FILE_2).bin)

V ?= $(VERBOSE)

ifeq ("$(V)","1")

Q :=

vecho := @true

else

Q := @

vecho := @echo

endif

vpath %.c $(SRC_DIR)

define compile-objects

$1/%.o: %.c

   $(vecho) "CC $$<"

   $(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS)  -c $$< -o $$@

endef

.PHONY: all checkdirs clean

all: checkdirs $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2)

$(FW_FILE_1): $(TARGET_OUT)

   $(vecho) "FW $@"

   $(Q) $(FW_TOOL) -eo $(TARGET_OUT) $(FW_FILE_1_ARGS)

$(FW_FILE_2): $(TARGET_OUT)

   $(vecho) "FW $@"

   $(Q) $(FW_TOOL) -eo $(TARGET_OUT) $(FW_FILE_2_ARGS)

$(TARGET_OUT): $(APP_AR)

   $(vecho) "LD $@"

   $(Q) $(LD) -L$(SDK_LIBDIR) $(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(LIBS) $(APP_AR) -Wl,--end-group -o $@

$(APP_AR): $(OBJ)

   $(vecho) "AR $@"

   $(Q) $(AR) cru $@ $^

checkdirs: $(BUILD_DIR) $(FW_BASE)

$(BUILD_DIR):

   $(Q) mkdir -p $@

firmware:

   $(Q) mkdir -p $@

flash: firmware/0x00000.bin firmware/0x40000.bin

   $(ESPTOOL) -p $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin 0x40000 firmware/0x40000.bin

test: flash

   screen $(ESPPORT) 115200

rebuild: clean all

clean:

   $(Q) rm -f $(APP_AR)

   $(Q) rm -f $(TARGET_OUT)

   $(Q) rm -rf $(BUILD_DIR)

   $(Q) rm -rf $(BUILD_BASE)

   $(Q) rm -f $(FW_FILE_1)

   $(Q) rm -f $(FW_FILE_2)

   $(Q) rm -rf $(FW_BASE)

$(foreach bdir,$(BUILD_DIR),$(eval $(call compile-objects,$(bdir))))

From: zeroday [mailto:notifications@github.com]
Sent: 09 January 2015 10:38
To: nodemcu/nodemcu-firmware
Cc: scargill
Subject: Re: [nodemcu-firmware] Make Files (#56)

esptool.py have some problem when flash two piece as one firmware.
ref this #81 #81


Reply to this email directly or view it on GitHub #56 (comment) . https://github.com/notifications/beacon/ABzUg1CLWxPDiDHvf_tLkGK1Bat_JoJEks5nf6b3gaJpZM4DMkYL.gif

@scargill
Copy link
Author

scargill commented Jan 9, 2015

Everything is now working. Needed to add PYSERIAL and those two items in the path… also needed to find the COM setting – might want to make that more obvious – can it go in the MAKEFILE?

For some reason the compiled code does not start up every time – never had that before.. Will check another board…

Pete.

@nodemcu
Copy link
Collaborator

nodemcu commented Jan 9, 2015

great.
even with esptool.exe I still have flash problem...

@nodemcu
Copy link
Collaborator

nodemcu commented Jan 10, 2015

use esptool.py to generate firmware, and burn with esptool.py.
now the firmware runs.

@nodemcu nodemcu closed this as completed Jan 10, 2015
@scargill
Copy link
Author

Well done.

@nodemcu
Copy link
Collaborator

nodemcu commented Jan 12, 2015

in the latest commit, eclipse project file is moved to root.
so, when import, select nodemcu-firmware instead of nodemcu-firmware/app

@saitejal
Copy link

saitejal commented Oct 6, 2015

@scargill Hello.
I getting started on this platform and I see you got it working on Windows!! Wondering if there is a guide or notes that I can follow for easier setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants