본문 바로가기
프로그래밍/ESP8266 Tutorial

ESP8266 이용하여 NodeMCU 빌드하기

by choies1 2016. 2. 16.

1. 툴설치

1) Unofficial build 툴설치

http://www.esp8266.com/viewtopic.php?t=820

아래 중 1, 4, 5번만 다운로드 받아서 설치하면 됨

Instructions for installing and configuring the Unofficial Development Kit for Espressif ESP8266:
1. To download the Windows (147Mb) and install my Unofficial Development Kit for Espressif ESP8266.
2. Download and install the Java Runtime x86 (jre-7uXX-windows-i586.exe)
3. Download and install Eclipse Mars x86 to develop in C ++ (eclipse-cpp-mars-R-win32.zip). Unpack the archive to the root of drive C.
4. Download and install MinGW. Run mingw-get-setup.exe, the installation process to select without GUI, ie uncheck "... also install support for the graphical user interface".
5. Download the (84Mb) my scripts to automate the installation of additional modules for MinGW.
6. Run from my file install-mingw-package.bat. He will establish the basic modules for MinGW, installation should proceed without error.
7. Start the Eclipse Luna from the directory c:\eclipse\eclipse.exe
8. In Eclipse, select File -> Import -> General -> Existing Project into Workspace, in the line Select root directory, select the directory C:\Espressif\examples and import work projects.
Further, the right to select the Make Target project, such as hello-world and run the target All the assembly, while in the console window should display the progress of the build. To select the target firmware flash.


2) MinGW 설치 (위 사이트의 4,5번 방법 활용)

3) 빌드 확인하기 (blinky 이용)

'C:\Espressif\Command line Unofficial Development Kit for Espressif ESP8266.bat' 실행

2. nodeMCU-firmware 다운로드 받기고 옮기기

(examples 폴더로 복사. 기존에 nodeMCU-firmware 폴더가 있으므로 새로 다운로드 받은 것은 다른 이름(ex. nodeMCU-firmware_new)로 만들어서 복사

3. nodeMCU-firmware_new 폴더 내에 Firmware 폴더 생성

-다른 example에서는 Firmware폴더가 만들어 지는데, 여기서는 안 만들어 진다. 만약 Makefile에서 자동으로 폴더가 만들어 지는 기능이 추가 되면 이 단계는 생략 가능


4. nodeMCU-firmware 폴더의 Makefile을 nodeMCU-firmware_new로 복사(덮어쓰기)


5. Makefile 수정

------------------------

# 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


# SDK version NodeMCU is locked to

SDK_VER:=1.4.0

# Ensure we search "our" SDK before the tool-chain's SDK (if any)

TOP_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))

SDK_DIR:=$(TOP_DIR)sdk/esp_iot_sdk_v$(SDK_VER)

SDK_BASE:= $(SDK_DIR)

CCFLAGS:= -I$(TOP_DIR)sdk-overrides/include -I$(SDK_DIR)/include

LDFLAGS:= -L$(SDK_DIR)/lib -L$(SDK_DIR)/ld $(LDFLAGS)



SDK_TOOLS ?= c:/Espressif/utils

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

ESPTOOL_ORIG ?= $(SDK_TOOLS)/esptool.exe

ESPPORT ?= COM3

ESPBAUD ?= 256000

-----------------------------------

6. make 수행

C:\Espressif\examples\nodemcu-firmware_new>make


오류가 날 것이다.

'C:\Espressif\examples\nodemcu-firmware_new\app\libc\c_stdlib.h'의 

#define __INT_MAX__ 2147483647 를 찾아서 아래 처럼 수정

--------------------------------------

#ifndef __INT_MAX__

#define __INT_MAX__ 2147483647

#endif

--------------------------------------

이제 다시 수행하면 잘 수행 된다. 아래와 같은 결과가 나오면 성공!!


Section info:


.output/eagle/debug/image/eagle.app.v6.out:     file format elf32-xtensa-le


Sections:

Idx Name          Size      VMA       LMA       File off  Algn

  0 .irom0.text   00076bc8  40210000  40210000  00008750  2**4

                  CONTENTS, ALLOC, LOAD, CODE

  1 .data         00000970  3ffe8000  3ffe8000  000000e0  2**4

                  CONTENTS, ALLOC, LOAD, DATA

  2 .rodata       00000008  3ffe8970  3ffe8970  00000a50  2**2

                  CONTENTS, ALLOC, LOAD, DATA

  3 .bss          000077c0  3ffe8978  3ffe8978  00000a58  2**4

                  ALLOC

  4 .text         00007cf0  40100000  40100000  00000a58  2**2

                  CONTENTS, ALLOC, LOAD, READONLY, CODE

------------------------------------------------------------------------------

   Section|                   Description| Start (hex)|   End (hex)|Used space

------------------------------------------------------------------------------

      data|        Initialized Data (RAM)|    3FFE8000|    3FFE8970|    2416

    rodata|           ReadOnly Data (RAM)|    3FFE8970|    3FFE8978|       8

       bss|      Uninitialized Data (RAM)|    3FFE8978|    3FFF0138|   30656

      text|          Uncached Code (IRAM)|    40100000|    40107CF0|   31984

irom0_text|             Cached Code (SPI)|    40210000|    40286BC8|  486344

------------------------------------------------------------------------------

Entry Point : 40100004 call_user_start()

Total Used RAM : 33080

Free RAM : 48840

Free IRam : 784 or 17168 if 48k IRam

------------------------------------------------------------------------------

Generate 0x00000.bin and 0x10000.bin successully in folder firmware.

0x00000.bin-------->0x00000

0x10000.bin-------->0x10000

Done

make[1]: Leaving directory `/c/Espressif/examples/nodemcu-firmware_new/app'


C:\Espressif\examples\nodemcu-firmware_new>