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

Cross platform changes + #45 #26 #24 #55

Merged
merged 36 commits into from
May 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8adf4d0
Convert eclipse projects to cross-platform, add abolute paths (SMING_…
AutomationD Apr 29, 2015
83e159f
Add Makefile-project, change linker script
AutomationD Apr 30, 2015
171d78a
Reference Makefile-profille in project makefile, cleanup sming core m…
AutomationD Apr 30, 2015
1970fd9
no message
AutomationD Apr 30, 2015
780386b
add irq_check
AutomationD May 1, 2015
1b5eaa2
add ASM target
AutomationD May 1, 2015
05b250c
remove app modules from sming core, remove TARGET_OUT. Thank you, @jc…
AutomationD May 1, 2015
a4c4a17
Remove verbose logging
AutomationD May 1, 2015
254eb51
Change all references to Makefile-project.mk (since sming core requir…
AutomationD May 1, 2015
618a75d
Add higher default baud rate
AutomationD May 1, 2015
3567ffb
Remove recursive .o search via find
AutomationD May 1, 2015
7cdc13d
Reduce flash and IRAM consumption
alonewolfx2 May 1, 2015
00f8168
Merge pull request #4 from alonewolfx2/patch-1
alonewolfx2 May 1, 2015
98d64c9
Merge pull request #2 from alonewolfx2/crossplatform2
AutomationD May 1, 2015
43d2081
Change openlwip to lwip (for 1.0.1b SDK compatibility)
AutomationD May 1, 2015
4685fb5
fix -DARDUINO, change microbic
AutomationD May 1, 2015
c0f991f
Change core lib, CFLAGS in core/project
AutomationD May 5, 2015
630a3c6
added libmicrogcc from https://github.com/anakod/Sming
May 5, 2015
40cd2f1
readding libsming.a
May 5, 2015
a85e5ee
Merge pull request #3 from caquino/crossplatform2
AutomationD May 5, 2015
8718631
Merge branch 'crossplatform2' of https://github.com/kireevco/Sming in…
AutomationD May 5, 2015
5f49b0b
Change include paths to ESP_HOME/sdk/include, SMING_HOME/system/inclu…
AutomationD May 6, 2015
3b1a20f
add new libraries, add new libsming.a with recent libraries
AutomationD May 6, 2015
b2c2cff
Remove apptest
tavalin May 6, 2015
c536dbb
Merge pull request #4 from Tavalin/crossplatform2
AutomationD May 6, 2015
630f76a
Use lwip instead of openlwip
tavalin May 6, 2015
24cfff8
Use lwip instead of openlwip
tavalin May 6, 2015
ea13407
Merge pull request #5 from Tavalin/Tavalin-patch-1
AutomationD May 6, 2015
fe70560
Use wildcard for SmingCore, Services and Libraries include
tavalin May 6, 2015
ae8faa2
Fix SmingCore.h include
tavalin May 6, 2015
c523985
Merge pull request #6 from Tavalin/Tavalin-patch-2
AutomationD May 6, 2015
da48880
Draft spiffs functionality
AutomationD May 8, 2015
d54717b
add PHONY for spiff, fix taskkill
AutomationD May 8, 2015
b554e2e
make sure spiff_bin is not rebuilt every time, add spiff_update
AutomationD May 8, 2015
b567850
removed draft commented code from a makefile
AutomationD May 8, 2015
95ae10d
Merge branch 'master' into crossplatform2
AutomationD May 8, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 60 additions & 60 deletions Basic_AirUpdate/.cproject

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Basic_AirUpdate/.project
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
</projectDescription>
352 changes: 20 additions & 332 deletions Basic_AirUpdate/Makefile
Original file line number Diff line number Diff line change
@@ -1,332 +1,20 @@
#############################################################
#
# Root Level Makefile
#
# (c) by CHERTS <[email protected]>
#
#############################################################

# Sming Framework Path
SMF = ../Sming/

BUILD_BASE = out/build
FW_BASE = out/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 path and port
SDK_TOOLS ?= c:/Espressif/utils
ESPTOOL ?= $(SDK_TOOLS)/esptool.exe
COM_PORT ?= COM3
COM_SPEED ?= 230400

# name for the target project
TARGET = app

# which modules (subdirectories) of the project to include in compiling
MODULES = $(SMF)system $(SMF)system/helpers $(SMF)Wiring $(SMF)SmingCore $(SMF)SmingCore/Network $(SMF)SmingCore/Platform $(SMF)Services/SpifFS $(SMF)Services/ArduinoJson $(SMF)Services/WebHelpers $(SMF)Services/DateTime $(SMF)appinit app $(SMF)Libraries/DHT $(SMF)Libraries/LiquidCrystal $(SMF)Libraries/Bounce $(SMF)Libraries/Adafruit_GFX $(SMF)Libraries/TFT_ILI9163C $(SMF)Libraries/BMP180 $(SMF)Libraries/BH1750FVI $(SMF)Libraries/Adafruit_SSD1306 $(SMF)Libraries/OneWire $(SMF)Libraries/I2Cdev $(SMF)Libraries/HMC5883L
EXTRA_INCDIR = include $(SMF) $(SMF)system/include $(SMF)Wiring $(SMF)Libraries $(SMF)SmingCore $(SDK_BASE)/../include

# libraries used in this project, mainly provided by the SDK
USER_LIBDIR = $(SMF)compiler/lib
LIBS = microc microgcc hal phy pp net80211 openlwip wpa main

# compiler flags using during compilation of source files
CFLAGS = -Os -g -Wpointer-arith -Wundef -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections -D__ets__ -DICACHE_FLASH -DARDUINO=106
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions -std=c++11

# linker flags used to generate the main object file
LDFLAGS = -nostdlib -u call_user_start -Wl,-static -Wl,--gc-sections

# linker script used for the above linkier step
LD_PATH = $(SMF)compiler/ld/
LD_SCRIPT = $(LD_PATH)eagle.app.v6.cpp.ld

# BOOT = none
# BOOT = old - boot_v1.1
# BOOT = new - boot_v1.2+
BOOT?=none
# APP = 0 - eagle.flash.bin + eagle.irom0text.bin
# APP = 1 - user1.bin
# APP = 2 - user2.bin
APP?=0
# SPI_SPEED = 20MHz, 26.7MHz, 40MHz, 80MHz
SPI_SPEED?=40
# SPI_MODE: QIO, QOUT, DIO, DOUT
SPI_MODE?=QIO
# SPI_SIZE: 256KB, 512KB, 1024KB, 2048KB, 4096KB
SPI_SIZE?=512

ifeq ($(BOOT), new)
boot = new
else
ifeq ($(BOOT), old)
boot = old
else
boot = none
endif
endif

ifeq ($(APP), 1)
app = 1
else
ifeq ($(APP), 2)
app = 2
else
app = 0
endif
endif

ifeq ($(SPI_SPEED), 26.7)
freqdiv = 1
else
ifeq ($(SPI_SPEED), 20)
freqdiv = 2
else
ifeq ($(SPI_SPEED), 80)
freqdiv = 15
else
freqdiv = 0
endif
endif
endif


ifeq ($(SPI_MODE), QOUT)
mode = 1
else
ifeq ($(SPI_MODE), DIO)
mode = 2
else
ifeq ($(SPI_MODE), DOUT)
mode = 3
else
mode = 0
endif
endif
endif

# flash larger than 1024KB only use 1024KB to storage user1.bin and user2.bin
ifeq ($(SPI_SIZE), 256)
size = 1
flash = 256
else
ifeq ($(SPI_SIZE), 1024)
size = 2
flash = 1024
else
ifeq ($(SPI_SIZE), 2048)
size = 3
flash = 1024
else
ifeq ($(SPI_SIZE), 4096)
size = 4
flash = 1024
else
size = 0
flash = 512
endif
endif
endif
endif

ifeq ($(flash), 512)
ifeq ($(app), 1)
addr = 0x01000
else
ifeq ($(app), 2)
addr = 0x41000
endif
endif
else
ifeq ($(flash), 1024)
ifeq ($(app), 1)
addr = 0x01000
else
ifeq ($(app), 2)
addr = 0x81000
endif
endif
endif
endif

ifneq ($(boot), none)
ifneq ($(app),0)
LD_SCRIPT = $(LD_PATH)eagle.app.v6.$(boot).$(flash).app$(app).cpp.ld
BIN_NAME = user$(app).$(flash).$(boot)
endif
else
app = 0
endif

# various paths from the SDK used in this project
SDK_LIBDIR = lib
SDK_LDDIR = ld
SDK_INCDIR = include include/json

# select which tools to use as compiler, librarian and linker
CC := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc
CXX := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-g++
AR := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-ar
LD := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc
OBJCOPY := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objcopy
OBJDUMP := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objdump

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*))
C_OBJ := $(patsubst %.c,%.o,$(SRC))
CXX_OBJ := $(patsubst %.cpp,%.o,$(C_OBJ))
OBJ := $(patsubst %.o,$(BUILD_BASE)/%.o,$(CXX_OBJ))
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))
LD_SCRIPT := $(addprefix -T,$(LD_SCRIPT))

INCDIR := $(addprefix -I,$(SRC_DIR))
EXTRA_INCDIR := $(addprefix -I,$(EXTRA_INCDIR))
MODULE_INCDIR := $(addsuffix /include,$(INCDIR))

V ?= $(VERBOSE)
ifeq ("$(V)","1")
Q :=
vecho := @true
else
Q := @
vecho := @echo
endif

vpath %.c $(SRC_DIR)
vpath %.cpp $(SRC_DIR)

define compile-objects
$1/%.o: %.c
$(vecho) "CC $$<"
$(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@
$1/%.o: %.cpp
$(vecho) "C+ $$<"
$(Q) $(CXX) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CXXFLAGS) -c $$< -o $$@
endef

.PHONY: all checkdirs clean

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

$(TARGET_OUT): $(APP_AR)
$(vecho) "LD $@"
$(Q) $(LD) -L$(USER_LIBDIR) -L$(SDK_LIBDIR) $(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(LIBS) $(APP_AR) -Wl,--end-group -o $@
$(vecho) "Run objcopy, please wait..."
$(Q) $(OBJCOPY) --only-section .text -O binary $@ eagle.app.v6.text.bin
$(Q) $(OBJCOPY) --only-section .data -O binary $@ eagle.app.v6.data.bin
$(Q) $(OBJCOPY) --only-section .rodata -O binary $@ eagle.app.v6.rodata.bin
$(Q) $(OBJCOPY) --only-section .irom0.text -O binary $@ eagle.app.v6.irom0text.bin
$(vecho) "objcopy done"
$(vecho) "Run gen_appbin.exe"
ifeq ($(app), 0)
$(Q) $(SDK_TOOLS)/gen_appbin.exe $@ 0 $(mode) $(freqdiv) $(size)
$(Q) mv eagle.app.flash.bin $(FW_BASE)/eagle.flash.bin
$(Q) mv eagle.app.v6.irom0text.bin $(FW_BASE)/eagle.irom0text.bin
$(vecho) "Make fs init stub"
$(Q) cat $(FW_BASE)/eagle.irom0text.bin $(SMF)/compiler/data/blankfs.bin > $(FW_BASE)/eagle.irom0text.fs.bin
$(Q) rm eagle.app.v6.*
$(vecho) "No boot needed."
$(vecho) "Generate eagle.flash.bin and eagle.irom0text.bin successully in folder $(FW_BASE)."
$(vecho) "eagle.flash.bin-------->0x00000"
$(vecho) "eagle.irom0text.bin---->0x9000"
else
ifeq ($(boot), new)
$(Q) $(SDK_TOOLS)/gen_appbin.exe $@ 2 $(mode) $(freqdiv) $(size)
$(vecho) "Support boot_v1.2 and +"
else
$(Q) $(SDK_TOOLS)/gen_appbin.exe $@ 1 $(mode) $(freqdiv) $(size)
$(vecho) "Support boot_v1.1 and +"
endif
$(Q) mv eagle.app.flash.bin $(FW_BASE)/upgrade/$(BIN_NAME).bin
$(Q) rm eagle.app.v6.*
$(vecho) "Generate $(BIN_NAME).bin successully in folder $(FW_BASE)/upgrade."
$(vecho) "boot_v1.x.bin------->0x00000"
$(vecho) "$(BIN_NAME).bin--->$(addr)"
endif
$(vecho) "Done"

$(APP_AR): $(OBJ)
$(vecho) "AR $@"
$(Q) $(AR) cru $@ $^

checkdirs: $(BUILD_DIR) $(FW_BASE)

$(BUILD_DIR):
$(Q) mkdir -p $@

$(FW_BASE):
$(Q) mkdir -p $@
$(Q) mkdir -p $@/upgrade

flashonefile: all
$(OBJCOPY) --only-section .text -O binary $(TARGET_OUT) eagle.app.v6.text.bin
$(OBJCOPY) --only-section .data -O binary $(TARGET_OUT) eagle.app.v6.data.bin
$(OBJCOPY) --only-section .rodata -O binary $(TARGET_OUT) eagle.app.v6.rodata.bin
$(OBJCOPY) --only-section .irom0.text -O binary $(TARGET_OUT) eagle.app.v6.irom0text.bin
$(SDK_TOOLS)/gen_appbin_old.exe $(TARGET_OUT) v6
$(SDK_TOOLS)/gen_flashbin.exe eagle.app.v6.flash.bin eagle.app.v6.irom0text.bin 0x9000
rm -f eagle.app.v6.data.bin
rm -f eagle.app.v6.flash.bin
rm -f eagle.app.v6.irom0text.bin
rm -f eagle.app.v6.rodata.bin
rm -f eagle.app.v6.text.bin
rm -f eagle.app.sym
mv eagle.app.flash.bin $(FW_BASE)/
$(vecho) "No boot needed."
$(vecho) "Generate eagle.app.flash.bin successully in folder $(FW_BASE)."
$(vecho) "eagle.app.flash.bin-------->0x00000"
$(ESPTOOL) -p $(COM_PORT) -b $(COM_SPEED) write_flash 0x00000 $(FW_BASE)/eagle.app.flash.bin

flashboot: all flashinit
ifeq ($(boot), new)
$(vecho) "Flash boot_v1.2 and +"
$(ESPTOOL) -p $(COM_PORT) -b $(COM_SPEED) write_flash 0x00000 $(SDK_BASE)/bin/boot_v1.2.bin
endif
ifeq ($(boot), old)
$(vecho) "Flash boot_v1.1 and +"
$(ESPTOOL) -p $(COM_PORT) -b $(COM_SPEED) write_flash 0x00000 $(SDK_BASE)/bin/boot_v1.1.bin
endif
ifeq ($(boot), none)
$(vecho) "No boot needed."
endif

flash: all
ifeq ($(app), 0)
$(shell taskkill /f /im termite.exe)
$(ESPTOOL) -p $(COM_PORT) -b $(COM_SPEED) write_flash 0x00000 $(FW_BASE)/eagle.flash.bin 0x9000 $(FW_BASE)/eagle.irom0text.fs.bin
else
ifeq ($(boot), none)
$(ESPTOOL) -p $(COM_PORT) -b $(COM_SPEED) write_flash 0x00000 $(FW_BASE)/eagle.flash.bin 0x9000 $(FW_BASE)/eagle.irom0text.fs.bin
else
$(ESPTOOL) -p $(COM_PORT) -b $(COM_SPEED) write_flash $(addr) $(FW_BASE)/upgrade/$(BIN_NAME).bin
endif
endif

flashinit:
$(vecho) "Flash init data default and blank data."
$(ESPTOOL) -p $(COM_PORT) write_flash 0x4B000 $(SMF)/compiler/data/blankfs.bin 0x7c000 $(SDK_BASE)/bin/esp_init_data_default.bin 0x7e000 $(SDK_BASE)/bin/blank.bin

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 -rf $(FW_BASE)

$(foreach bdir,$(BUILD_DIR),$(eval $(call compile-objects,$(bdir))))
#####################################################################
#### Please don't change this file. Use Makefile-user.mk instead ####
#####################################################################
# Including user Makefile.
# Should be used to set project-specific parameters
include ./Makefile-user.mk

# Important parameters check.
# We need to make sure SMING_HOME and ESP_HOME variables are set.
# You can use Makefile-user.mk in each project or use enviromental variables to set it globally.

ifndef SMING_HOME
$(error SMING_HOME is not set. Please configure it in Makefile-user.mk)
endif
ifndef ESP_HOME
$(error ESP_HOME is not set. Please configure it in Makefile-user.mk)
endif

# Include main Sming Makefile
include $(SMING_HOME)/Makefile-project.mk
27 changes: 27 additions & 0 deletions Basic_AirUpdate/Makefile-user.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Local build configuration
## Parameters configured here will override default and ENV values.
## Uncomment and change examples:

## ESP_HOME sets the path where ESP tools and SDK are located.
## Windows:
# ESP_HOME = c:/Espressif

## MacOS / Linux:
#ESP_HOME = /opt/esp-open-sdk

## SMING_HOME sets the path where Sming framework is located.
## Windows:
# SMING_HOME = c:/tools/sming/Sming

# MacOS / Linux
# SMING_HOME = /opt/sming/Sming

## COM port parameter is reqruied to flash firmware correctly.
## Windows:
# COM_PORT = COM3

# MacOS / Linux:
# COM_PORT = /dev/tty.usbserial

# Com port speed
# COM_SPEED = 115200
Loading