From 648045c23ec74fafc4416cfd27b8ce6a091d8a35 Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Mon, 3 Sep 2018 16:49:30 +0100 Subject: [PATCH] Update for SDK 2.2.1 with system compiler Move to using gcc/binutils from system paths (tested with gcc 7.3.0 packages on Debian) and the Espressif NONOS SDK 2.2.1. Also move to a 512k + 512k image format instead of trying to fit 2 images in a 512kB flash chip. --- Makefile | 19 +++++++++++-------- clock.c | 2 -- max7219.c | 1 - rom0.ld | 34 ++++++++++++++++++++++++++-------- rom1.ld | 34 ++++++++++++++++++++++++++-------- user_main.c | 2 -- 6 files changed, 63 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 9fdad10..511cfd5 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,18 @@ SDKDIR ?= /opt/esp8266-sdk -AR = $(SDKDIR)/bin/xtensa-lx106-elf-ar -CC = $(SDKDIR)/bin/xtensa-lx106-elf-gcc -LD = $(SDKDIR)/bin/xtensa-lx106-elf-gcc -OBJCOPY = $(SDKDIR)/bin/xtensa-lx106-elf-objcopy -OBJDUMP = $(SDKDIR)/bin/xtensa-lx106-elf-objdump +AR = xtensa-lx106-elf-ar +CC = xtensa-lx106-elf-gcc +LD = xtensa-lx106-elf-gcc +OBJCOPY = xtensa-lx106-elf-objcopy +OBJDUMP = xtensa-lx106-elf-objdump LIBS = -lc -lhal -lphy -lpp -lnet80211 -llwip -lwpa -lmain -CFLAGS = -Wall -Os -fno-inline-functions -mlongcalls -DICACHE_FLASH -I. -LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static +CFLAGS = -Wall -Os -fno-inline-functions -mlongcalls -DICACHE_FLASH -I. \ + -I$(SDKDIR)/xtensa-lx106-elf/include +LDFLAGS = -nostdlib -Wl,--no-check-sections -Wl,--gc-sections -Wl,-static \ + -u call_user_start \ + -L$(SDKDIR)/xtensa-lx106-elf/lib APP = clock OBJS = user_main.o max7219.o spi.o clock.o @@ -35,6 +38,6 @@ project_config.h: echo '#define CFG_WIFI_PASSWORD "password"' >> $@ clean: - rm -f $(OBJS) $(APP)_app.a $(APP).elf rom0.bin rom1.bin + rm -f $(OBJS) $(APP)_app.a rom0.elf rom1.elf rom0.bin rom1.bin .PHONY: all clean diff --git a/clock.c b/clock.c index 241b64c..e8df669 100644 --- a/clock.c +++ b/clock.c @@ -44,8 +44,6 @@ #include #include -#include "espmissingincludes.h" - #include "clock.h" #define NTP_SERVER "uk.pool.ntp.org" diff --git a/max7219.c b/max7219.c index 12c559e..0aa7bd6 100644 --- a/max7219.c +++ b/max7219.c @@ -23,7 +23,6 @@ #include #include -#include "espmissingincludes.h" #include "max7219.h" #include "spi.h" diff --git a/rom0.ld b/rom0.ld index 0d45739..1e5f327 100644 --- a/rom0.ld +++ b/rom0.ld @@ -5,7 +5,7 @@ MEMORY dport0_0_seg : org = 0x3FF00000, len = 0x10 dram0_0_seg : org = 0x3FFE8000, len = 0x14000 iram1_0_seg : org = 0x40100000, len = 0x8000 - irom0_0_seg : org = 0x40202010, len = 0x3C000 + irom0_0_seg : org = 0x40201010, len = 0x6B000 } PHDRS @@ -151,6 +151,31 @@ SECTIONS } >dram0_0_seg :dram0_0_bss_phdr /* __stack = 0x3ffc8000; */ + .irom0.text : ALIGN(4) + { + _irom0_text_start = ABSOLUTE(.); + + *libat.a:(.literal.* .text.*) + *libcrypto.a:(.literal.* .text.*) + *libespnow.a:(.literal.* .text.*) + *libjson.a:(.literal.* .text.*) + *liblwip.a:(.literal.* .text.*) + *libnet80211.a:(.literal.* .text.*) + *libsmartconfig.a:(.literal.* .text.*) + *libssl.a:(.literal.* .text.*) + *libupgrade.a:(.literal.* .text.*) + *libwpa.a:(.literal.* .text.*) + *libwpa2.a:(.literal.* .text.*) + *libwps.a:(.literal.* .text.*) + + *libmbedtls.a:(.literal.* .text.*) + + *libm.a:(.literal .text .literal.* .text.*) + + *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) + _irom0_text_end = ABSOLUTE(.); + } >irom0_0_seg :irom0_0_phdr + .text : ALIGN(4) { _stext = .; @@ -198,13 +223,6 @@ SECTIONS *(.gnu.linkonce.lit4.*) _lit4_end = ABSOLUTE(.); } >iram1_0_seg :iram1_0_phdr - - .irom0.text : ALIGN(4) - { - _irom0_text_start = ABSOLUTE(.); - *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) - _irom0_text_end = ABSOLUTE(.); - } >irom0_0_seg :irom0_0_phdr } /* get ROM code address */ diff --git a/rom1.ld b/rom1.ld index 4bfe271..c0bfae5 100644 --- a/rom1.ld +++ b/rom1.ld @@ -5,7 +5,7 @@ MEMORY dport0_0_seg : org = 0x3FF00000, len = 0x10 dram0_0_seg : org = 0x3FFE8000, len = 0x14000 iram1_0_seg : org = 0x40100000, len = 0x8000 - irom0_0_seg : org = 0x40242010, len = 0x3C000 + irom0_0_seg : org = 0x40281010, len = 0x6B000 } PHDRS @@ -151,6 +151,31 @@ SECTIONS } >dram0_0_seg :dram0_0_bss_phdr /* __stack = 0x3ffc8000; */ + .irom0.text : ALIGN(4) + { + _irom0_text_start = ABSOLUTE(.); + + *libat.a:(.literal.* .text.*) + *libcrypto.a:(.literal.* .text.*) + *libespnow.a:(.literal.* .text.*) + *libjson.a:(.literal.* .text.*) + *liblwip.a:(.literal.* .text.*) + *libnet80211.a:(.literal.* .text.*) + *libsmartconfig.a:(.literal.* .text.*) + *libssl.a:(.literal.* .text.*) + *libupgrade.a:(.literal.* .text.*) + *libwpa.a:(.literal.* .text.*) + *libwpa2.a:(.literal.* .text.*) + *libwps.a:(.literal.* .text.*) + + *libmbedtls.a:(.literal.* .text.*) + + *libm.a:(.literal .text .literal.* .text.*) + + *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) + _irom0_text_end = ABSOLUTE(.); + } >irom0_0_seg :irom0_0_phdr + .text : ALIGN(4) { _stext = .; @@ -198,13 +223,6 @@ SECTIONS *(.gnu.linkonce.lit4.*) _lit4_end = ABSOLUTE(.); } >iram1_0_seg :iram1_0_phdr - - .irom0.text : ALIGN(4) - { - _irom0_text_start = ABSOLUTE(.); - *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) - _irom0_text_end = ABSOLUTE(.); - } >irom0_0_seg :irom0_0_phdr } /* get ROM code address */ diff --git a/user_main.c b/user_main.c index 1484771..0ec6056 100644 --- a/user_main.c +++ b/user_main.c @@ -19,8 +19,6 @@ #include #include -#include "espmissingincludes.h" - #include "project_config.h" #include "clock.h" -- 2.39.5