Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
pvvx committed Jul 21, 2015
1 parent 705ab32 commit b594aec
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 33 deletions.
9 changes: 4 additions & 5 deletions Makefile
Expand Up @@ -16,7 +16,7 @@ FIRMWAREDIR = ..//bin//

SDK_TOOLS ?= c:/Espressif/utils
#ESPTOOL ?= $(SDK_TOOLS)/esptool.exe
ESPTOOL ?= C:/Python27/python.exe $(SDK_TOOLS)/esptool.py
ESPTOOL ?= C:/Python27/python.exe $(CWD)esptool.py
ESPTOOL-CK ?= $(SDK_TOOLS)/esptool-ck.exe
ESPPORT ?= COM2
ESPBAUD ?= 460800
Expand Down Expand Up @@ -106,7 +106,7 @@ CPP := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-cpp
OBJCOPY := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objcopy
OBJDUMP := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objdump
#CCFLAGS += -Os
CCFLAGS += -g -std=gnu90 -ffunction-sections -fno-jump-tables -fdata-sections
CCFLAGS += -std=gnu90 -ffunction-sections -fno-jump-tables -fdata-sections
# -ffunction-sections -fno-jump-tables -fdata-sections -foptimize-register-move -mno-target-align

CSRCS ?= $(wildcard *.c)
Expand Down Expand Up @@ -184,9 +184,8 @@ endef
$(BINODIR)/%.bin: $(IMAGEODIR)/%.out
@mkdir -p $(BINODIR)
$(vecho) "------------------------------------------------------------------------------"
@echo "FW ../bin/$(ADDR_FW1).bin + ../bin/$(ADDR_FW2).bin"
ifeq ("1","1")
$(ESPTOOL) elf2image -o ../bin/ $(flashimageoptions) $<
@$(ESPTOOL) elf2image -o ../bin/ $(flashimageoptions) $<
$(vecho) "------------------------------------------------------------------------------"
$(vecho) "Add rapid_loader:"
@mv -f ../bin/$(ADDR_FW1).bin ../bin/0.bin
Expand All @@ -207,11 +206,11 @@ else
$(RM) -f eagle.app.v6.rodata.bin
mv eagle.app.flash.bin ../bin/$(ADDR_FW1).bin
mv eagle.app.v6.irom0text.bin ../bin/$(ADDR_FW2).bin
endif
$(vecho) "------------------------------------------------------------------------------"
$(vecho) "Section info:"
$(Q) $(SDK_TOOLS)/memanalyzer.exe $(OBJDUMP).exe $<
$(vecho) "------------------------------------------------------------------------------"
endif


all: .subdirs $(OBJS) $(OLIBS) $(OIMAGES) $(OBINS) $(SPECIAL_MKTARGETS)
Expand Down
15 changes: 8 additions & 7 deletions README.md
Expand Up @@ -21,13 +21,14 @@
- Используются Integer и Float.

# Журнал версий
2015-07-18 - добавление [SDRAM Optimization Patch for SDK_v1.2.0] (http://bbs.espressif.com/viewtopic.php?f=5&t=734&sid=abcc534cb6029dfed9c5c304a39e7341)<br />
2015-07-17 - замена п.п. ввода UART, ремонт spiffs<br />
2015-07-15 - перестройка вызовов задач (ets_ru(), wdt)<br />
2015-07-10 - переход на SDK ver 1.2.0<br />
2015-07-03 - добавлена первая весрия rapid_loader-а (ускоренного загрузчика)<br />
2015-07-02 - начато перераспределение констант и других данных только в 48 килобайтную область IRAM <br />
2015-07-01 - новые команды wifi.sta.rssi() и wifi.max_tpw()<br />
2015-07-21 - Новые команды =wifi.getchl() и =wifi.setchl(1..13)<br />
2015-07-18 - Добавление [SDRAM Optimization Patch for SDK_v1.2.0](http://bbs.espressif.com/viewtopic.php?f=5&t=734&sid=abcc534cb6029dfed9c5c304a39e7341) ('Heap' больше 36 килобайт)<br />
2015-07-17 - Замена п.п. ввода UART, ремонт spiffs<br />
2015-07-15 - Перестройка вызовов задач (ets_ru(), wdt)<br />
2015-07-10 - Переход на SDK ver 1.2.0<br />
2015-07-03 - Добавлена первая весрия rapid_loader-а (ускоренного загрузчика)<br />
2015-07-02 - Начато перераспределение констант и других данных только в 48 килобайтную область IRAM <br />
2015-07-01 - Новые команды =wifi.sta.rssi() и wifi.max_tpw(0..82)<br />
2015-06-27 - Исправления/дополнения + новая команда file.fsstat()<br />
2015-06-25 - Начало проекта<br />

Expand Down
2 changes: 1 addition & 1 deletion app/include/user_version.h
Expand Up @@ -7,6 +7,6 @@
#define NODE_VERSION_INTERNAL 0U

#define NODE_VERSION "EspLua.ru 1.2.0"
#define BUILD_DATE "build 20150718"
#define BUILD_DATE "build 20150721"

#endif /* __USER_VERSION_H__ */
5 changes: 2 additions & 3 deletions app/modules/net.c
Expand Up @@ -784,11 +784,10 @@ static int net_start( lua_State* L, const char* mt )
}

if(!isserver || pesp_conn->type == ESPCONN_UDP){ // self_ref is only needed by socket userdata, or udp server
#if 0
#if 1
if ( lua_isnumber(L, stack) ) {
unsigned lport = luaL_checkinteger( L, stack );
stack++;
if(lport) pesp_conn->proto.tcp->local_port = lport;
if(lport) pesp_conn->proto.udp->local_port = lport;
}
#endif
lua_pushvalue(L, 1); // copy to the top of stack
Expand Down
23 changes: 22 additions & 1 deletion app/modules/wifi.c
Expand Up @@ -1103,6 +1103,7 @@ static int wifi_ap_dhcp_stop( lua_State* L )
return 1;
}

// Lua: wifi.max_tpw()
static int wifi_phy_set_max_tpw( lua_State* L )
{
s32 tpw;
Expand All @@ -1115,13 +1116,31 @@ static int wifi_phy_set_max_tpw( lua_State* L )
return 0;
}


// Lua: =wifi.st.rssi()
static int wifi_st_get_rssi( lua_State* L )
{
lua_pushinteger(L, wifi_station_get_rssi());
return 1;
}

// Lua: =wifi.setchl(1..13)
static int wifi_set_chl( lua_State* L )
{
bool err = false;
int chl = luaL_checkinteger( L, 1 );
if ( chl >= 1 && chl <= 13 )
err = wifi_set_channel(chl);
lua_pushboolean(L, err);
return 1;
}

// Lua: =wifi.getchl()
static int wifi_get_chl( lua_State* L )
{
lua_pushinteger(L, wifi_get_channel());
return 1;
}

// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
Expand Down Expand Up @@ -1180,6 +1199,8 @@ const LUA_REG_TYPE wifi_map[] =
{ LSTRKEY( "stopsmart" ), LFUNCVAL( wifi_exit_smart ) },
{ LSTRKEY( "sleeptype" ), LFUNCVAL( wifi_sleeptype ) },
{ LSTRKEY( "max_tpw" ), LFUNCVAL( wifi_phy_set_max_tpw) },
{ LSTRKEY( "setchl" ), LFUNCVAL( wifi_set_chl ) },
{ LSTRKEY( "getchl" ), LFUNCVAL( wifi_get_chl ) },
#if LUA_OPTIMIZE_MEMORY > 0
{ LSTRKEY( "sta" ), LROVAL( wifi_station_map ) },
{ LSTRKEY( "ap" ), LROVAL( wifi_ap_map ) },
Expand Down
Binary file modified bin/0x00000.bin
Binary file not shown.
Binary file modified bin/0x0c000.bin
Binary file not shown.
46 changes: 30 additions & 16 deletions esptool.py
Expand Up @@ -413,20 +413,15 @@ def _fetch_symbols(self):
if self.symbols is not None:
return
self.symbols = {}
fname = os.getenv('TEMP');
if fname == None:
fname = '.'
fname += '\\eagle.app.sym'
cmd = 'C:\\Espressif\\xtensa-lx106-elf\\bin\\xtensa-lx106-elf-nm.exe ' + self.name + ' >'+fname
print cmd
os.system(cmd)
fps = file(fname)
if fps is None:
print "open sym file error\n"
exit(1)
lines = fps.readlines()
fps.close()
for l in lines:
try:
tool_nm = "C:\\Espressif\\xtensa-lx106-elf\\bin\\xtensa-lx106-elf-nm.exe"
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 "+tool_nm+", do you have Xtensa toolchain in PATH?"
sys.exit(1)
for l in proc.stdout:
fields = l.strip().split()
try:
self.symbols[fields[2]] = int(fields[0], 16)
Expand All @@ -439,6 +434,10 @@ def get_symbol_addr(self, sym):
self._fetch_symbols()
return self.symbols[sym]

def get_symbol_addr(self, sym):
self._fetch_symbols()
return self.symbols[sym]

def load_section(self, section):
tool_objcopy = "C:\\Espressif\\xtensa-lx106-elf\\bin\\xtensa-lx106-elf-objcopy.exe"
if os.getenv('XTENSA_CORE')=='lx106':
Expand Down Expand Up @@ -674,11 +673,10 @@ def arg_auto_int(x):
e = ELFFile(args.input)
image = ESPFirmwareImage()
image.entrypoint = e.get_symbol_addr(args.entry_symbol)
print args.entry_symbol+':\t\t\t\t\t0x%08x' % (image.entrypoint)

for section, start in ((".text", "_text_start"), (".data", "_data_start"), (".rodata", "_rodata_start")):
data = e.load_section(section)
image.add_segment(e.get_symbol_addr(start), data)
print section+': \t\t'+start+':\t\t0x%08x' % (e.get_symbol_addr(start))

image.flash_mode = {'qio':0, 'qout':1, 'dio':2, 'dout': 3}[args.flash_mode]
image.flash_size_freq = {'4m':0x00, '2m':0x10, '8m':0x20, '16m':0x30, '32m':0x40, '16m-c1': 0x50, '32m-c1':0x60, '32m-c2':0x70}[args.flash_size]
Expand All @@ -691,6 +689,22 @@ def arg_auto_int(x):
f = open(args.output + "0x%05x.bin" % off, "wb")
f.write(data)
f.close()
print "{0:>10}|{1:>30}|{2:>12}|{3:>12}|{4:>8}".format("Section", "Description", "Start (hex)", "End (hex)", "Used space")
print "------------------------------------------------------------------------------"
sec_name = ["data", "rodata", "bss", "text", "irom0_text"]
sec_des = ["Initialized Data (RAM)", "ReadOnly Data (RAM)", "Uninitialized Data (RAM)", "Uncached Code (IRAM)", "Cached Code (SPI)"]
sec_size = []
for i in range(len(sec_name)):
ss = e.get_symbol_addr('_' + sec_name[i] + '_start')
se = e.get_symbol_addr('_' + sec_name[i] + '_end')
sec_size.append(int(se-ss))
print "{0:>10}|{1:>30}|{2:>12X}|{3:>12X}|{4:>8d}".format(sec_name[i], sec_des[i], ss, se, sec_size[i])
print "------------------------------------------------------------------------------"
print "{0} : {1:X} {2}()".format("Entry Point", image.entrypoint, args.entry_symbol)
ram_used = sec_size[0] + sec_size[1] + sec_size[2]
print "{0} : {1:d}".format("Total Used RAM", ram_used)
print "{0} : {1:d}".format("Free RAM", 0x014000 - ram_used)
print "{0} : {1:d}".format("Free IRam", 0x0C000 - sec_size[3])

elif args.operation == 'read_mac':
esp.get_mac()
Expand Down

0 comments on commit b594aec

Please sign in to comment.