Skip to content

Commit

Permalink
eZ80: Fix optimization issues
Browse files Browse the repository at this point in the history
board/z80/ez80/*/scripts/Make.defs:  Fix optimization definition use in assembly flags.  It was using the compiler optimization settings instead of the assembler optimization settings.  Hence, enabling optimization would could cause assembler command line errors.

arch/z80/src/ez80/Toolchain.defs:  Back out some work arounds.  Now compiler optimization flags can again set set without assembler command line errors.

boards/z80/ez80/z20x/README.txt:  Trivial update to size/optimization discussion.
  • Loading branch information
gregory-nutt authored and acassis committed Feb 29, 2020
1 parent 0ce4e15 commit 41ef33b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
14 changes: 5 additions & 9 deletions arch/z80/src/ez80/Toolchain.defs
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,12 @@ endif
# CPU Identification

ifeq ($(CONFIG_ARCH_CHIP_EZ80F91),y)
ARCHCPU = eZ80F91
ARCHCPU = eZ80F91
ARCHCPUDEF = _EZ80F91
ARCHFAMILY = _EZ80ACCLAIM!
else ifeq ($(CONFIG_ARCH_CHIP_EZ80F92),y)
#ARCHCPU = eZ80F92
#ARCHCPUDEF = _EZ80F92
ARCHCPU = eZ80F91
ARCHCPUDEF = _EZ80F91
ARCHCPU = eZ80F92
ARCHCPUDEF = _EZ80F92
ARCHFAMILY = _EZ80ACCLAIM!
endif

Expand All @@ -129,11 +127,9 @@ else
endif

ifeq ($(CONFIG_DEBUG_NOOPT),y)
# ARCHOPTIMIZATION += -promote -reduceopt -NOsdiopt
ARCHOPTIMIZATION += -NOsdiopt
ARCHOPTIMIZATION += -NOpromote -reduceopt -NOsdiopt
else
# ARCHOPTIMIZATION += -NOpromote -NOreduceopt -sdiopt -optsize
ARCHOPTIMIZATION += -sdiopt
ARCHOPTIMIZATION += -promote -NOreduceopt -sdiopt -optsize
endif

# Tool names/paths.
Expand Down
2 changes: 1 addition & 1 deletion boards/z80/ez80/ez80f910200kitg/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) $(ARCHASMWARNINGS)
# Compiler definitions

ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
-asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHOPTIMIZATION)"
-asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
ARCHPICFLAGS =
ARCHWARNINGS = -warn
Expand Down
2 changes: 1 addition & 1 deletion boards/z80/ez80/ez80f910200zco/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) $(ARCHASMWARNINGS)
# Compiler definitions

ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
-asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHOPTIMIZATION)"
-asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
ARCHPICFLAGS =
ARCHWARNINGS = -warn
Expand Down
2 changes: 1 addition & 1 deletion boards/z80/ez80/makerlisp/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) $(ARCHASMWARNINGS)
# Compiler definitions

ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
-asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHOPTIMIZATION)"
-asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
ARCHPICFLAGS =
ARCHWARNINGS = -warn
Expand Down
26 changes: 18 additions & 8 deletions boards/z80/ez80/z20x/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,6 @@ Memory Constaints
you enable assertions, debug outputs, or even debug symbols. It is very
unlikely that the nsh_flash configuration will fit into FLASH at all!

I believe that there is some issue with the optimization CFLAGS used with
the ZDS-II compiler. The size of the FLASH images that are generated are
larger than you would see with, say, an equivalent Cortex-M compilation.
I reviewed the individual object files. There is not one thing that is
causing the large size. Rather, the ZDS-II compiler is simply generating
larger CODE sections in the object files.

Serial Console
==============

Expand Down Expand Up @@ -222,9 +215,12 @@ Configuration Subdirectories
NOTES:

1. UNVERIFIED! I doubt that the nsh_flash program will fit into the
smaller FLASH memory of the eZ80F92 part. See discusssion under
smaller FLASH memory of the eZ80F92 part. See discussion under
"Memory Constraints" above.

The nsh_ram configuration, of course, depends on the sdboot
bootloader to load that program into RAM.

2. The two configurations different only in that one builds for
execution entirely from FLASH and the other for execution entirely
from RAM. A bootloader of some kind is required to support such
Expand Down Expand Up @@ -349,3 +345,17 @@ Configuration Subdirectories
64Kb of FLASH memory. It will not be possible to run programs in
SRAM *unless* some mechanism is developed to redirect interrupts
from ROM and into loaded SRAM logic.

For example, it might be possible to implement this kind of
vectoring to get to a RAM based interrupt handler:

a. The initial 16-bit address in the interrupt vector table can
transfer the interrupt to a larger jump table also in lower
flash memory.
b. That jump table could vector to another jump table at a known
location RAM.
c. The RAM jump table could then jump to the final RAM-based
interrupt handler.

This would effect the logic in arch/z80/src/ez80/ez80f92_handlers.am
and possible the z20x *.linkcmd files.
2 changes: 1 addition & 1 deletion boards/z80/ez80/z20x/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ AFLAGS = $(ARCHASMCPUFLAGS) $(ARCHASMINCLUDES) $(ARCHASMLIST) $(ARCHASMWARNINGS)
# Compiler definitions

ARCHCPUFLAGS = -chartype:S -promote -cpu:$(ARCHCPU) -NOgenprintf -NOmodsect \
-asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHOPTIMIZATION)"
-asmsw:" $(ARCHASMCPUFLAGS) $(EARCHASMINCLUDES) $(ARCHASMWARNINGS) $(ARCHASMOPTIMIZATION)"
ARCHLIST = -keeplst -NOlist -NOlistinc -keepasm
ARCHPICFLAGS =
ARCHWARNINGS = -warn
Expand Down

0 comments on commit 41ef33b

Please sign in to comment.