Skip to content

Commit a361476

Browse files
fix application support
1 parent de9cf43 commit a361476

5 files changed

Lines changed: 25 additions & 18 deletions

File tree

src/crt/crt0.S

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ __start:
163163
#if !HAS_APPLICATION
164164
___libload_libs:
165165
LIBLOAD_LIBS ; autogenerated by cedev-obj
166+
nop
167+
#else
168+
___libload_libs_ret:
166169
#endif
167170
#endif
168171

@@ -461,9 +464,13 @@ _exit.sp:
461464
_exit.flash_wait_states:
462465
.db 0
463466

467+
#if HAS_LIBLOAD
464468
.section .data
465469
___libload_libs:
466470
LIBLOAD_LIBS ; autogenerated by cedev-obj
471+
nop
472+
jp ___libload_libs_ret
473+
#endif
467474
#endif
468475

469476
#if HAS_MAIN_ARGC_ARGV

src/linker_script_app.ld

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ MEMORY
44
bss : ORIGIN = BSSHEAP_LOW, LENGTH = BSSHEAP_HIGH - BSSHEAP_LOW
55
}
66

7-
PHDRS
8-
{
9-
prgm PT_LOAD;
10-
}
11-
127
SECTIONS
138
{
149
. = LOAD_ADDR;
@@ -18,12 +13,12 @@ SECTIONS
1813
KEEP (*(.header))
1914
PROVIDE_HIDDEN (___icon_optional = .);
2015
KEEP (*(.header.icon))
21-
} >prgm :prgm
16+
} >prgm
2217

2318
.init :
2419
{
2520
*(.init)
26-
} >prgm :prgm
21+
} >prgm
2722

2823
.text :
2924
{
@@ -34,12 +29,12 @@ SECTIONS
3429
*(SORT(.text.sorted.*))
3530
*(.text .stub .text.* .gnu.linkonce.t.*)
3631
*(.gnu.warning)
37-
} >prgm :prgm
32+
} >prgm
3833

3934
.rodata :
4035
{
4136
*(.rodata .rodata.* .gnu.linkonce.r.*)
42-
} >prgm :prgm
37+
} >prgm
4338

4439
.init_array :
4540
{
@@ -48,25 +43,25 @@ SECTIONS
4843
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))
4944
KEEP (*(.init_array))
5045
PROVIDE_HIDDEN (__init_array_end = .);
51-
} >prgm :prgm
46+
} >prgm
5247

5348
.fini_array :
5449
{
5550
PROVIDE_HIDDEN (__fini_array_start = .);
5651
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))
5752
KEEP (*(.fini_array))
5853
PROVIDE_HIDDEN (__fini_array_end = .);
59-
} >prgm :prgm
54+
} >prgm
6055

6156
.data :
6257
{
6358
___data_vma = .;
59+
___data_lma = . + (LOADADDR(.data) - ADDR(.data));
6460
*(.data .data.* .gnu.linkonce.d.*)
6561
SORT(CONSTRUCTORS)
6662
*(.data1)
6763
___data_vma_end = .;
68-
} >bss AT>prgm :prgm
69-
___data_lma = LOADADDR(.data);
64+
} >bss AT>prgm
7065
___data_len = ___data_vma_end - ___data_vma;
7166

7267
.bss (NOLOAD) :

src/makefile.mk

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,20 @@ EZCXXFLAGS = $(EZCOMMONFLAGS) -isystem $(call QUOTE_ARG,$(call FORWARD_PATH,$(CE
317317
EZLTOFLAGS = $(EZLLVMFLAGS) $(LTOFLAGS)
318318
EZASFLAGS = -march=ez80+full $(ASFLAGS)
319319

320-
.PHONY: all clean version gfx debug
320+
BUILD = target
321+
322+
.PHONY: target clean version gfx debug
323+
324+
# override default build target here
325+
build: $(BUILD)
321326

322327
# this rule is trigged to build everything
323-
all: $(BINDIR)/$(TARGET)
328+
target: $(BINDIR)/$(TARGET)
324329

325330
# this rule is trigged to build debug everything
326331
debug: CC_DEBUG = -DDEBUG=1
327332
debug: LD_DEBUG = --defsym DEBUG=1
328-
debug: $(BINDIR)/$(TARGET)
333+
debug: $(BUILD)
329334

330335
$(BINDIR)/$(TARGET): $(BINDIR)/$(TARGETOBJ) $(MAKEFILE_LIST) $(DEPS)
331336
$(Q)$(call MKDIR,$(@D))

0 commit comments

Comments
 (0)