From a1e9e58a1e4672a17277a81906cfdb99b4a80c56 Mon Sep 17 00:00:00 2001 From: Simon John Date: Sat, 10 Jan 2015 12:30:52 +0000 Subject: [PATCH] Vastly simplified generating and flashing firmware. Uses the new elf2image features of esptool.py to do away with the myriad of shell scripts and binaries. Fixed permissions on esptool.py --- Makefile | 2 +- app/Makefile | 6 ++-- app/flash.bat | 19 ---------- app/flash.sh | 11 ------ app/gen_misc.bat | 41 --------------------- app/gen_misc.sh | 25 ------------- app/gen_misc_plus.bat | 41 --------------------- app/gen_misc_plus.sh | 28 --------------- tools/esptool.py | 0 tools/gen_appbin.py | 77 ---------------------------------------- tools/gen_flashbin.py | 33 ----------------- tools/genflashbinv6.exe | Bin 13824 -> 0 bytes 12 files changed, 5 insertions(+), 278 deletions(-) delete mode 100644 app/flash.bat delete mode 100644 app/flash.sh delete mode 100644 app/gen_misc.bat delete mode 100755 app/gen_misc.sh delete mode 100644 app/gen_misc_plus.bat delete mode 100755 app/gen_misc_plus.sh mode change 100644 => 100755 tools/esptool.py delete mode 100755 tools/gen_appbin.py delete mode 100755 tools/gen_flashbin.py delete mode 100644 tools/genflashbinv6.exe diff --git a/Makefile b/Makefile index 6984e4ea..171d666e 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,7 @@ endef $(BINODIR)/%.bin: $(IMAGEODIR)/%.out @mkdir -p $(BINODIR) - $(OBJCOPY) -O binary $< $@ + ../tools/esptool.py elf2image $< -o $(BINODIR)/ ############################################################# # Rules base diff --git a/app/Makefile b/app/Makefile index 84a5f424..e498fada 100644 --- a/app/Makefile +++ b/app/Makefile @@ -159,8 +159,10 @@ sinclude $(PDIR)Makefile $(BINODIR)/%.bin: $(IMAGEODIR)/%.out @mkdir -p $(BINODIR) - $(OBJCOPY) -O binary $< $@ + ../tools/esptool.py elf2image $< -o $(BINODIR)/ + +flash: + ../tools/esptool.py write_flash 0x00000 $(BINODIR)/0x00000.bin 0x10000 $(BINODIR)/0x10000.bin .PHONY: FORCE FORCE: - diff --git a/app/flash.bat b/app/flash.bat deleted file mode 100644 index 1b9e927b..00000000 --- a/app/flash.bat +++ /dev/null @@ -1,19 +0,0 @@ -@echo off -set BACKPATH=%PATH% -set PATH=%BACKPATH%;%CD%\..\tools -@echo on - -rem gen_misc.bat -rem eagle.app.v6.flash.bin: 0x00000 -rem eagle.app.v6.irom0text.bin: 0x10000 -rem esp_init_data_default.bin: 0x7c000 -rem blank.bin: 0x7e000 - -cd ..\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 -echo ************************* flash end ************************************* -cd ..\app - -@echo off -set PATH=%BACKPATH% -@echo on diff --git a/app/flash.sh b/app/flash.sh deleted file mode 100644 index 3ed9dffa..00000000 --- a/app/flash.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -x -### gen_misc.sh -### eagle.app.v6.flash.bin: 0x00000 -### eagle.app.v6.irom0text.bin: 0x10000 -### esp_init_data_default.bin: 0x7c000 -### blank.bin: 0x7e000 - -cd ../bin -../../../../../tools/esptool.py --port /dev/ttyUSB0 write_flash 0x00000 eagle.app.v6.flash.bin 0x10000 eagle.app.v6.irom0text.bin 0x7c000 esp_init_data_default.bin 0x7e000 blank.bin -echo "************************* flash end *************************************" -cd ../app diff --git a/app/gen_misc.bat b/app/gen_misc.bat deleted file mode 100644 index 6e8052a9..00000000 --- a/app/gen_misc.bat +++ /dev/null @@ -1,41 +0,0 @@ -@echo off -set BACKPATH=%PATH% -set PATH=%BACKPATH%;%CD%\..\tools -@echo on - -make %1 - -del /F ..\bin\eagle.app.v6.flash.bin ..\bin\eagle.app.v6.irom0text.bin ..\bin\eagle.app.v6.dump ..\bin\eagle.app.v6.S - -cd .output\eagle\debug\image - -@echo off -set OBJDUMP=xt-objdump -set OBJCOPY=xt-objcopy -if defined XTENSA_CORE ( - set OBJDUMP=xt-objdump - set OBJCOPY=xt-objcopy -) else ( - set OBJDUMP=xtensa-lx106-elf-objdump - set OBJCOPY=xtensa-lx106-elf-objcopy -) -@echo on - -%OBJDUMP% -x -s eagle.app.v6.out > ..\..\..\..\..\bin\eagle.app.v6.dump -%OBJDUMP% -S eagle.app.v6.out > ..\..\..\..\..\bin\eagle.app.v6.S - -%OBJCOPY% --only-section .text -O binary eagle.app.v6.out eagle.app.v6.text.bin -%OBJCOPY% --only-section .data -O binary eagle.app.v6.out eagle.app.v6.data.bin -%OBJCOPY% --only-section .rodata -O binary eagle.app.v6.out eagle.app.v6.rodata.bin -%OBJCOPY% --only-section .irom0.text -O binary eagle.app.v6.out eagle.app.v6.irom0text.bin - -gen_appbin.py eagle.app.v6.out v6 - -xcopy /y eagle.app.v6.irom0text.bin ..\..\..\..\..\bin\ -xcopy /y eagle.app.v6.flash.bin ..\..\..\..\..\bin\ - -cd ..\..\..\..\ - -@echo off -set PATH=%BACKPATH% -@echo on diff --git a/app/gen_misc.sh b/app/gen_misc.sh deleted file mode 100755 index 6ddf62af..00000000 --- a/app/gen_misc.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -x -make -if [ $? == 0 ];then -rm ../bin/eagle.app.v6.flash.bin ../bin/eagle.app.v6.irom0text.bin ../bin/eagle.app.v6.dump ../bin/eagle.app.v6.S - -cd .output/eagle/debug/image - -xtensa-lx106-elf-objdump -x -s eagle.app.v6.out > ../../../../../bin/eagle.app.v6.dump -xtensa-lx106-elf-objdump -S eagle.app.v6.out > ../../../../../bin/eagle.app.v6.S - -xtensa-lx106-elf-objcopy --only-section .text -O binary eagle.app.v6.out eagle.app.v6.text.bin -xtensa-lx106-elf-objcopy --only-section .data -O binary eagle.app.v6.out eagle.app.v6.data.bin -xtensa-lx106-elf-objcopy --only-section .rodata -O binary eagle.app.v6.out eagle.app.v6.rodata.bin -xtensa-lx106-elf-objcopy --only-section .irom0.text -O binary eagle.app.v6.out eagle.app.v6.irom0text.bin - -../../../../../tools/gen_appbin.py eagle.app.v6.out v6 - -cp eagle.app.v6.irom0text.bin ../../../../../bin/ -cp eagle.app.v6.flash.bin ../../../../../bin/ - -cd ../../../../../ - -else -echo "make error" -fi diff --git a/app/gen_misc_plus.bat b/app/gen_misc_plus.bat deleted file mode 100644 index 6331ebdd..00000000 --- a/app/gen_misc_plus.bat +++ /dev/null @@ -1,41 +0,0 @@ -@echo off -set BACKPATH=%PATH% -set PATH=%BACKPATH%;%CD%\..\tools -@echo on - -make APP=$1 - -rm ..\bin\upgrade\%1.bin - -cd .output\eagle\debug\image\ - -@echo off -set OBJDUMP=xt-objdump -set OBJCOPY=xt-objcopy -if defined XTENSA_CORE ( - set OBJDUMP=xt-objdump - set OBJCOPY=xt-objcopy -) else ( - set OBJDUMP=xtensa-lx106-elf-objdump - set OBJCOPY=xtensa-lx106-elf-objcopy -) -@echo on - -%OBJCOPY% --only-section .text -O binary eagle.app.v6.out eagle.app.v6.text.bin -%OBJCOPY% --only-section .data -O binary eagle.app.v6.out eagle.app.v6.data.bin -%OBJCOPY% --only-section .rodata -O binary eagle.app.v6.out eagle.app.v6.rodata.bin -%OBJCOPY% --only-section .irom0.text -O binary eagle.app.v6.out eagle.app.v6.irom0text.bin - -gen_appbin.py eagle.app.v6.out v6 - -gen_flashbin.py eagle.app.v6.flash.bin eagle.app.v6.irom0text.bin - -cp eagle.app.flash.bin %1.bin - -xcopy /y %1.bin ..\..\..\..\..\bin\upgrade\ - -cd ..\..\..\..\ - -@echo off -set PATH=%BACKPATH% -@echo on \ No newline at end of file diff --git a/app/gen_misc_plus.sh b/app/gen_misc_plus.sh deleted file mode 100755 index 8e1c5b43..00000000 --- a/app/gen_misc_plus.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -x -touch user/user_main.c -make APP=$1 -if [ $? == 0 ];then -rm ../bin/upgrade/user$1.bin ../bin/upgrade/user$1.dump ../bin/upgrade/user$1.S - -cd .output/eagle/debug/image/ - -xtensa-lx106-elf-objdump -x -s eagle.app.v6.out > ../../../../../bin/upgrade/user$1.dump -xtensa-lx106-elf-objdump -S eagle.app.v6.out > ../../../../../bin/upgrade/user$1.S - -xtensa-lx106-elf-objcopy --only-section .text -O binary eagle.app.v6.out eagle.app.v6.text.bin -xtensa-lx106-elf-objcopy --only-section .data -O binary eagle.app.v6.out eagle.app.v6.data.bin -xtensa-lx106-elf-objcopy --only-section .rodata -O binary eagle.app.v6.out eagle.app.v6.rodata.bin -xtensa-lx106-elf-objcopy --only-section .irom0.text -O binary eagle.app.v6.out eagle.app.v6.irom0text.bin - -../../../../../tools/gen_appbin.py eagle.app.v6.out v6 - -../../../../../tools/gen_flashbin.py eagle.app.v6.flash.bin eagle.app.v6.irom0text.bin - -cp eagle.app.flash.bin user$1.bin -cp user$1.bin ../../../../../bin/upgrade/ - -cd ../../../../../ - -else -echo "make error" -fi diff --git a/tools/esptool.py b/tools/esptool.py old mode 100644 new mode 100755 diff --git a/tools/gen_appbin.py b/tools/gen_appbin.py deleted file mode 100755 index f3820c09..00000000 --- a/tools/gen_appbin.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/python -# -# Copyright (c) 2010 Espressif System -# -# grab user_start() address and pass it to genflashbin program -# - -import string -import sys -import os -import re - -if len(sys.argv) != 3: - print 'Usage: gen_appbin.py eagle.app.out version' - sys.exit(0) - -elf_file = sys.argv[1] -ver = sys.argv[2] -#print elf_file - -if os.getenv('XTENSA_CORE')=='lx106': - cmd = 'xt-nm -g ' + elf_file + ' > eagle.app.sym' -else: - cmd = 'xtensa-lx106-elf-nm -g ' + elf_file + ' > eagle.app.sym' -#print cmd -os.system(cmd) - -fp = file('./eagle.app.sym') -if fp is None: - print "open sym file error\n" - exit - -lines = fp.readlines() - -fp.close() - -entry_addr = None -p = re.compile('(\w*)(\sT\s)(call_user_start)$') -for line in lines: - m = p.search(line) - if m != None: - entry_addr = m.group(1) - #entry_addr = int(entry_addr, 16) - print entry_addr - -if entry_addr is None: - print 'no entry point!!' - exit - -data_start_addr = '0' -p = re.compile('(\w*)(\sA\s)(_data_start)$') -for line in lines: - m = p.search(line) - if m != None: - data_start_addr = m.group(1) - print data_start_addr - -rodata_start_addr = '0' -p = re.compile('(\w*)(\sA\s)(_rodata_start)$') -for line in lines: - m = p.search(line) - if m != None: - rodata_start_addr = m.group(1) - print rodata_start_addr - -if os.getenv('XTENSA_CORE')=='lx106': - 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 -else: - 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 - -print cmd -os.system(cmd) - -cmd = 'mv eagle.app.flash.bin eagle.app.%s.flash.bin'%(ver) - -print cmd -os.system(cmd) diff --git a/tools/gen_flashbin.py b/tools/gen_flashbin.py deleted file mode 100755 index 0f8f92ba..00000000 --- a/tools/gen_flashbin.py +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/python -import os -import sys -import binascii -import string - -if len(sys.argv) != 3: - print 'Usage: gen_flashbin.py 1.bin 2.bin' - sys.exit(0) - -bin1_name = sys.argv[1] -bin2_name = sys.argv[2] - -bin1_file = open(bin1_name, 'rb') -bin2_file = open(bin2_name, 'rb') - -bin1_len = os.path.getsize(bin1_name) - -bin1 = bin1_file.read() -bin2 = bin2_file.read() - -bitlist = ['FF']*(0x10000-bin1_len) -bytes = binascii.a2b_hex(''.join(bitlist)) - -bitout = open('eagle.app.flash.bin', 'wb') -bitout.write(bin1) -bitout.write(bytes) -bitout.write(bin2) -bitout.close() - -bin1_file.close() -bin2_file.close() - diff --git a/tools/genflashbinv6.exe b/tools/genflashbinv6.exe deleted file mode 100644 index 0e1e1d36e6a4f7e674c21d3d5b017624cb669acd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13824 zcmeHOeNyNJ#Os}}})fMb} z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