1 diff --git a/ao-tools/ao-elftohex/ao-elftohex.c b/ao-tools/ao-elftohex/ao-elftohex.c
2 index 265908c5..f3ab0c38 100644
3 --- a/ao-tools/ao-elftohex/ao-elftohex.c
4 +++ b/ao-tools/ao-elftohex/ao-elftohex.c
12 #include "ao-verbose.h"
13 diff --git a/ao-tools/ao-flash/ao-flash-lpc b/ao-tools/ao-flash/ao-flash-lpc
14 index 7ac5b523..9e1d1cdb 100755
15 --- a/ao-tools/ao-flash/ao-flash-lpc
16 +++ b/ao-tools/ao-flash/ao-flash-lpc
19 trap "rm $cmds" 0 1 15
21 -echo "program $file verify reset" > $cmds
22 +echo "program $file reset" > $cmds
24 -f interface/stlink-v2.cfg \
25 - -f target/lpc11u14.cfg \
26 + -f target/lpc11xx.cfg \
29 diff --git a/ao-tools/lib/ao-elf.c b/ao-tools/lib/ao-elf.c
30 index c44102f8..cc127b62 100644
31 --- a/ao-tools/lib/ao-elf.c
32 +++ b/ao-tools/lib/ao-elf.c
33 @@ -186,6 +186,7 @@ load_write(struct ao_hex_image *from, uint32_t address, uint32_t length, void *d
39 * Construct a large in-memory block for all
40 * of the loaded sections of the program
41 @@ -202,7 +203,7 @@ get_load(Elf *e)
44 struct ao_hex_image *load = NULL;
50 @@ -231,7 +232,7 @@ get_load(Elf *e)
52 /* Get the associated file section */
56 fprintf (stderr, "offset %08x vaddr %08x paddr %08x filesz %08x memsz %08x\n",
57 (uint32_t) phdr.p_offset,
58 (uint32_t) phdr.p_vaddr,
59 @@ -252,18 +253,16 @@ get_load(Elf *e)
65 section_name = elf_strptr(e, shstrndx, shdr.sh_name);
68 - if (phdr.p_offset <= shdr.sh_offset && shdr.sh_offset < phdr.p_offset + phdr.p_filesz) {
70 - if (shdr.sh_size == 0)
73 + if (shdr.sh_size != 0 && shdr.sh_type != SHT_NOBITS && (shdr.sh_flags & SHF_ALLOC) &&
74 + phdr.p_offset <= shdr.sh_offset && shdr.sh_offset < phdr.p_offset + phdr.p_filesz)
76 sh_paddr = phdr.p_paddr + shdr.sh_offset - phdr.p_offset;
80 fprintf (stderr, "\tsize %08x rom %08x exec %08x %s\n",
81 (uint32_t) shdr.sh_size,
83 diff --git a/src/lpc/Makefile.defs b/src/lpc/Makefile.defs
84 index b6d739c2..5bb8133d 100644
85 --- a/src/lpc/Makefile.defs
86 +++ b/src/lpc/Makefile.defs
88 include $(TOPDIR)/lpc/Makefile-lpc.defs
89 include $(TOPDIR)/Makedefs
91 -LDFLAGS=$(CFLAGS) -L$(TOPDIR)/lpc -Wl,-Taltos.ld
92 +LDFLAGS=$(CFLAGS) -L$(TOPDIR)/lpc -Wl,-Taltos.ld -n
94 ao_serial_lpc.h: $(TOPDIR)/lpc/baud_rate ao_pins.h
95 nickle $(TOPDIR)/lpc/baud_rate `awk '/AO_LPC_CLKOUT/{print $$3}' ao_pins.h` > $@
96 diff --git a/src/stmf0/Makefile.defs b/src/stmf0/Makefile.defs
97 index a1d93eb5..3da42874 100644
98 --- a/src/stmf0/Makefile.defs
99 +++ b/src/stmf0/Makefile.defs
100 @@ -4,6 +4,6 @@ endif
102 include $(TOPDIR)/stmf0/Makefile-stmf0.defs
104 -LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Wl,-Taltos.ld
105 +LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Wl,-Taltos.ld -n
108 diff --git a/src/telegps-v0.3/Makefile b/src/telegps-v0.3/Makefile
109 index 1eaf7c47..834609d9 100644
110 --- a/src/telegps-v0.3/Makefile
111 +++ b/src/telegps-v0.3/Makefile
112 @@ -67,8 +67,6 @@ OBJ=$(SRC:.c=.o)
116 -LDFLAGS=-L../lpc -Wl,-Taltos.ld
118 $(PROG): Makefile $(OBJ) altos.ld
119 $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)
121 diff --git a/src/telegps-v1.0/Makefile b/src/telegps-v1.0/Makefile
122 index bd13cfe7..76dc0371 100644
123 --- a/src/telegps-v1.0/Makefile
124 +++ b/src/telegps-v1.0/Makefile
125 @@ -70,8 +70,6 @@ OBJ=$(SRC:.c=.o)
129 -LDFLAGS=-L../lpc -Wl,-Taltos.ld
131 $(PROG): Makefile $(OBJ) altos.ld
132 $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)