Skip to content

Commit

Permalink
Toolchain update
Browse files Browse the repository at this point in the history
Mostly fixed examples and makefiles
  • Loading branch information
mateoconlechuga committed Mar 18, 2016
1 parent 167c079 commit 2816b64
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 66 deletions.
52 changes: 35 additions & 17 deletions CEdev/examples/demo_0/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
TARGET ?= demo0
#----------------------------

#Change ICONC to "ICON" to include a custom icon, and "NICON" to not use an icon
#Change TARGET to specify the output program name
#Change ICONC to "ICON" to include a custom icon, and "NICON" to not use an icon. Icons use the palette located in \include\ce\pal, and is named iconc.png in your project's root directory.
#Change DEBUGMODE to "DEBUG" in order to compile debug.h functions in, and "NDEBUG" to not compile debugging functions
#Change DESCRIPTION to modify what is displayed within a compatible shell
#Change ARCHIVED to "YES" to mark the output as archived, and "NO" to not
#Change APPVAR to "YES" to create the file as an AppVar, otherwise "NO" for programs

#----------------------------
TARGET ?= DEMO0
ICONC ?= ICON
DESCRIPTION ?= "Demo C Program"
DEBUGMODE ?= NDEBUG
DESCRIPTION ?= "CE C SDK program - Demo 0"
ARCHIVED ?= NO
APPVAR ?= NO
#----------------------------

#Add shared library names to the L varible, i.e.
# L := graphc fileioc keypadc

#----------------------------

empty :=
space := $(empty) $(empty)
comma := ,
suffix := .asm$(empty) $(empty)
TARGETHEX = $(TARGET).hex
TARGET8XP = $(TARGET).8xp
TARGETHEX := $(TARGET).hex

BIN = $(call NATIVEPATH,$(CEDEV)/bin)
ifeq ($(OS),Windows_NT)
Expand All @@ -25,7 +39,7 @@ PG = "$(BIN)convpng" >nul
RM = del /f 2>nul
else
NATIVEPATH = $(subst \,/,$(1))
WINPATH = $(shell winepath --windows $(1))
WINPATH = $(subst \,\\,$(shell winepath --windows $(1)))
CEDEV ?= $(realpath ../..)
CC = wine "$(BIN)eZ80cc"
LD = wine "$(BIN)eZ80link"
Expand All @@ -40,6 +54,9 @@ CVFLAGS := -a
endif
ifneq ($(APPVAR),NO)
CVFLAGS += -v
TARGETTYPE := $(TARGET).8xv
else
TARGETTYPE := $(TARGET).8xp
endif

SOURCES := $(wildcard *.c)
Expand All @@ -54,36 +71,37 @@ ASMSOURCES := $(filter-out iconc.asm, $(wildcard *.asm))
PNG_FLAGS := -h
endif
OBJECTS := $(SOURCES:%.c=%.obj) $(ASMSOURCES:%.asm=%.obj)
ASMSOURCES += $(call NATIVEPATH,$(addprefix $(CEDEV)/include/ce/asm/,cstartup.asm))
ASMSOURCES += $(call WINPATH,$(addprefix $(CEDEV)/include/ce/asm/,cstartup.asm))
ifdef L
ASMSOURCES += $(call NATIVEPATH,$(addprefix $(CEDEV)/include/ce/asm/,libheader.asm))
ASMSOURCES += $(call WINPATH,$(addprefix $(CEDEV)/include/ce/asm/,libheader.asm))
OBJECTS += libheader.obj
endif
LIBS := $(call NATIVEPATH,$(addprefix $(CEDEV)/lib/ce/,$(addsuffix $(suffix),$(L))))
LIBS := $(call WINPATH,$(addprefix $(CEDEV)/lib/ce/,$(addsuffix $(suffix),$(L))))
ASMSOURCES += $(LIBS)
OBJECTS += $(notdir $(LIBS:%.asm=%.obj))
OBJECTS += cstartup.obj
HEADERS := $(subst $(space),;,$(call WINPATH,$(realpath .) $(addprefix $(CEDEV)/,include/ce/asm include/ce/c include include/std lib/std/ce lib/ce)))
LIBRARIES := $(call NATIVEPATH,$(addprefix $(CEDEV)/lib/std/,ce/ctice.lib ce/cdebug.lib chelp.lib crt.lib crtS.lib nokernel.lib fplib.lib fplibS.lib))
HEADERS := $(subst $(space),;,$(call WINPATH,. $(addprefix $(CEDEV)/,. include/ce/asm include/ce/c include include/std lib/std/ce lib/ce)))
LIBRARIES := $(call WINPATH,$(addprefix $(CEDEV)/lib/std/,ce/ctice.lib ce/cdebug.lib chelp.lib crt.lib crtS.lib nokernel.lib fplib.lib fplibS.lib))

ASM_FLAGS := \
-define:_EZ80=1 -define:_SIMULATE=1 -define:$(ICONC) -include:$(HEADERS) -NOlist -NOlistmac \
-pagelen:250 -pagewidth:132 -quiet -sdiopt -warn -NOdebug -NOigcase -cpu:EZ80F91

CFLAGS := \
-quiet -define:NDEBUG -define:_EZ80F91 -define:_EZ80 -define:$(ICONC) -define:_SIMULATE -NOlistinc -NOmodsect -cpu:EZ80F91 -keepasm \
-quiet -define:DEBUG -define:_EZ80F91 -define:_EZ80 -define:$(ICONC) -define:_SIMULATE -NOlistinc -NOmodsect -cpu:EZ80F91 -keepasm \
-optspeed -NOreduceopt -NOgenprintf -stdinc:"$(HEADERS)" -usrinc:"." -NOdebug \
-asmsw:"$(ASM_FLAGS)" -asm $(ASMSOURCES)

LDFLAGS += GROUP MEMORY = ROM, RAM

all : $(TARGET8XP)
all : $(TARGETTYPE)

$(TARGETHEX) : $(OBJECTS) $(LIBRARIES)
@$(LD) @Linkcmd $@ = "$(subst $(space),$(comma),$(call WINPATH,$^))" $(LDFLAGS) || @$(RM) $(OBJECTS) $(TARGET).hex
@$(RM) $(ICONASM)
@$(RM) $(OBJECTS)
@$(LD) @Linkcmd $@ = "$(subst $(space),$(comma),$(call WINPATH,$^))" $(LDFLAGS) || @$(RM) $(TARGETTYPE) $(TARGETHEX)

%.8xv : %.hex
@$(CV) $(CVFLAGS) $(@:%.8xv=%)

%.8xp : %.hex
@$(CV) $(CVFLAGS) $(@:%.8xp=%)

Expand All @@ -99,6 +117,6 @@ $(TARGETHEX) : $(OBJECTS) $(LIBRARIES)
@$(CC) $(CFLAGS) $<

clean :
@$(RM) $(ICONASM) $(OBJECTS:%.obj=%.src) $(OBJECTS) $(TARGET).*
@$(RM) $(ICONASM) $(OBJECTS) $(OBJECTS:%.obj=%.src) $(TARGETTYPE) $(TARGETHEX) $(TARGET).map

.PHONY : all clean
19 changes: 8 additions & 11 deletions CEdev/examples/demo_0/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
#include <string.h>

/* Other available headers */
// stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h
// stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h, debug.h

/* Put function prototypes here */
void printText(const char *text, uint8_t x, uint8_t y);
void printTextSmall(const char *text, uint8_t xpos, uint8_t ypos);

/* Initialize some strings */
/* Initialize some strings -- It is faster to place strings as globals */
const char HelloWorld[] = "Hello World!";
const char Welcome[] = "Welcome to C!";
char Apples[] = "Apples";
char Apples[] = "Apples!";
char Oranges[] = "Oranges";

/* Put all your code here */
Expand Down Expand Up @@ -49,22 +49,19 @@ void main(void) {
}

/* Do not use os_GetKey() in your programs; this is just a demo */
_OS( os_GetKey() );
os_GetKey();

/* Clean up, and exit */
pgrm_CleanUp();
}

/* Draw text on the homescreen at the given X/Y location */
void printText(const char *text, uint8_t xpos, uint8_t ypos) {
_OS(
os_SetCursorPos(ypos, xpos);
os_PutStrFull(text);
);
os_SetCursorPos(ypos, xpos);
os_PutStrFull(text);
}

/* Draw small text at the given X/Y location */
void printTextSmall(const char *text, uint8_t xpos, uint8_t ypos) {
_OS(
os_FontDrawText(text, xpos, ypos);
);
os_FontDrawText(text, xpos, ypos);
}
52 changes: 35 additions & 17 deletions CEdev/examples/demo_1/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
TARGET ?= demo1
#----------------------------

#Change ICONC to "ICON" to include a custom icon, and "NICON" to not use an icon
#Change TARGET to specify the output program name
#Change ICONC to "ICON" to include a custom icon, and "NICON" to not use an icon. Icons use the palette located in \include\ce\pal, and is named iconc.png in your project's root directory.
#Change DEBUGMODE to "DEBUG" in order to compile debug.h functions in, and "NDEBUG" to not compile debugging functions
#Change DESCRIPTION to modify what is displayed within a compatible shell
#Change ARCHIVED to "YES" to mark the output as archived, and "NO" to not
#Change APPVAR to "YES" to create the file as an AppVar, otherwise "NO" for programs

#----------------------------
TARGET ?= DEMO1
ICONC ?= NICON
DESCRIPTION ?= "Demo C Program"
DEBUGMODE ?= NDEBUG
DESCRIPTION ?= "CE C SDK program - Demo 1"
ARCHIVED ?= NO
APPVAR ?= NO
#----------------------------

#Add shared library names to the L varible, i.e.
# L := graphc fileioc keypadc

#----------------------------

empty :=
space := $(empty) $(empty)
comma := ,
suffix := .asm$(empty) $(empty)
TARGETHEX = $(TARGET).hex
TARGET8XP = $(TARGET).8xp
TARGETHEX := $(TARGET).hex

BIN = $(call NATIVEPATH,$(CEDEV)/bin)
ifeq ($(OS),Windows_NT)
Expand All @@ -25,7 +39,7 @@ PG = "$(BIN)convpng" >nul
RM = del /f 2>nul
else
NATIVEPATH = $(subst \,/,$(1))
WINPATH = $(shell winepath --windows $(1))
WINPATH = $(subst \,\\,$(shell winepath --windows $(1)))
CEDEV ?= $(realpath ../..)
CC = wine "$(BIN)eZ80cc"
LD = wine "$(BIN)eZ80link"
Expand All @@ -40,6 +54,9 @@ CVFLAGS := -a
endif
ifneq ($(APPVAR),NO)
CVFLAGS += -v
TARGETTYPE := $(TARGET).8xv
else
TARGETTYPE := $(TARGET).8xp
endif

SOURCES := $(wildcard *.c)
Expand All @@ -54,36 +71,37 @@ ASMSOURCES := $(filter-out iconc.asm, $(wildcard *.asm))
PNG_FLAGS := -h
endif
OBJECTS := $(SOURCES:%.c=%.obj) $(ASMSOURCES:%.asm=%.obj)
ASMSOURCES += $(call NATIVEPATH,$(addprefix $(CEDEV)/include/ce/asm/,cstartup.asm))
ASMSOURCES += $(call WINPATH,$(addprefix $(CEDEV)/include/ce/asm/,cstartup.asm))
ifdef L
ASMSOURCES += $(call NATIVEPATH,$(addprefix $(CEDEV)/include/ce/asm/,libheader.asm))
ASMSOURCES += $(call WINPATH,$(addprefix $(CEDEV)/include/ce/asm/,libheader.asm))
OBJECTS += libheader.obj
endif
LIBS := $(call NATIVEPATH,$(addprefix $(CEDEV)/lib/ce/,$(addsuffix $(suffix),$(L))))
LIBS := $(call WINPATH,$(addprefix $(CEDEV)/lib/ce/,$(addsuffix $(suffix),$(L))))
ASMSOURCES += $(LIBS)
OBJECTS += $(notdir $(LIBS:%.asm=%.obj))
OBJECTS += cstartup.obj
HEADERS := $(subst $(space),;,$(call WINPATH,$(realpath .) $(addprefix $(CEDEV)/,include/ce/asm include/ce/c include include/std lib/std/ce lib/ce)))
LIBRARIES := $(call NATIVEPATH,$(addprefix $(CEDEV)/lib/std/,ce/ctice.lib ce/cdebug.lib chelp.lib crt.lib crtS.lib nokernel.lib fplib.lib fplibS.lib))
HEADERS := $(subst $(space),;,$(call WINPATH,. $(addprefix $(CEDEV)/,. include/ce/asm include/ce/c include include/std lib/std/ce lib/ce)))
LIBRARIES := $(call WINPATH,$(addprefix $(CEDEV)/lib/std/,ce/ctice.lib ce/cdebug.lib chelp.lib crt.lib crtS.lib nokernel.lib fplib.lib fplibS.lib))

ASM_FLAGS := \
-define:_EZ80=1 -define:_SIMULATE=1 -define:$(ICONC) -include:$(HEADERS) -NOlist -NOlistmac \
-pagelen:250 -pagewidth:132 -quiet -sdiopt -warn -NOdebug -NOigcase -cpu:EZ80F91

CFLAGS := \
-quiet -define:NDEBUG -define:_EZ80F91 -define:_EZ80 -define:$(ICONC) -define:_SIMULATE -NOlistinc -NOmodsect -cpu:EZ80F91 -keepasm \
-quiet -define:DEBUG -define:_EZ80F91 -define:_EZ80 -define:$(ICONC) -define:_SIMULATE -NOlistinc -NOmodsect -cpu:EZ80F91 -keepasm \
-optspeed -NOreduceopt -NOgenprintf -stdinc:"$(HEADERS)" -usrinc:"." -NOdebug \
-asmsw:"$(ASM_FLAGS)" -asm $(ASMSOURCES)

LDFLAGS += GROUP MEMORY = ROM, RAM

all : $(TARGET8XP)
all : $(TARGETTYPE)

$(TARGETHEX) : $(OBJECTS) $(LIBRARIES)
@$(LD) @Linkcmd $@ = "$(subst $(space),$(comma),$(call WINPATH,$^))" $(LDFLAGS) || @$(RM) $(OBJECTS) $(TARGET).hex
@$(RM) $(ICONASM)
@$(RM) $(OBJECTS)
@$(LD) @Linkcmd $@ = "$(subst $(space),$(comma),$(call WINPATH,$^))" $(LDFLAGS) || @$(RM) $(TARGETTYPE) $(TARGETHEX)

%.8xv : %.hex
@$(CV) $(CVFLAGS) $(@:%.8xv=%)

%.8xp : %.hex
@$(CV) $(CVFLAGS) $(@:%.8xp=%)

Expand All @@ -99,6 +117,6 @@ $(TARGETHEX) : $(OBJECTS) $(LIBRARIES)
@$(CC) $(CFLAGS) $<

clean :
@$(RM) $(ICONASM) $(OBJECTS:%.obj=%.src) $(OBJECTS) $(TARGET).*
@$(RM) $(ICONASM) $(OBJECTS) $(OBJECTS:%.obj=%.src) $(TARGETTYPE) $(TARGETHEX) $(TARGET).map

.PHONY : all clean
4 changes: 3 additions & 1 deletion CEdev/examples/demo_1/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string.h>

/* Other available headers */
// stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h
// stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h, debug.h

/* Put function prototypes here */
void fillScreen(unsigned color);
Expand Down Expand Up @@ -45,6 +45,8 @@ void fillScreen(unsigned color) {
}

/* Wait for a specified about of seconds between 0 and 60 */
/* Note that this will affect the user's actual time on the calculator */
/* A better option would be to use the general purpose timers, since they provide more accurate timming */
void waitSeconds(uint8_t seconds) {
/* Set the inital seconds to 0 */
rtc_SetSeconds(0);
Expand Down
Loading

0 comments on commit 2816b64

Please sign in to comment.