Workaround for compiling some examples available

This commit is contained in:
matsutsuka 2009-12-16 06:47:17 +00:00
parent 26ade836b4
commit 23d5f84a46
7 changed files with 179 additions and 98 deletions

View File

@ -2,7 +2,7 @@
# Makefile for z80/SDCC # Makefile for z80/SDCC
# @author Takahide Matsutsuka <markn@markn.org> # @author Takahide Matsutsuka <markn@markn.org>
# #
# $Id: Makefile.z80,v 1.14 2009/12/11 14:59:32 matsutsuka Exp $ # $Id: Makefile.z80,v 1.15 2009/12/16 06:47:17 matsutsuka Exp $
# #
### Compiler definitions ### Compiler definitions
@ -25,16 +25,21 @@ ASFLAGS +=
LDFLAGS += -mz80 --out-fmt-ihx --no-std-crt0 LDFLAGS += -mz80 --out-fmt-ihx --no-std-crt0
AROPTS = -a AROPTS = -a
ifdef CONTIKI_PROJECT
CFLAGS += -DAUTOSTART_ENABLE=1
CONTIKI_SOURCEFILES += $(CONTIKI_PROJECT).c
endif
### CPU-dependent cleanup files ### CPU-dependent cleanup files
CLEAN += CLEAN += *.ihx *.lnk *.sym contiki-$(TARGET).lib *.$(TARGET)
### CPU-dependent directories ### CPU-dependent directories
CONTIKI_CPU_DIRS = . dev lib loader CONTIKI_CPU_DIRS = . dev lib loader
### CPU-dependent source files ### CPU-dependent source files
CONTIKI_SOURCEFILES += strcasecmp.c mtarch.c uip_arch.c \ CONTIKI_SOURCEFILES += strcasecmp.c mtarch.c uip_arch.c \
libconio_z80.c log-conio.c rs232.c \ libconio_z80.c log-conio.c rs232.c
mef.c
CONTIKI_ASMFILES += uip_arch-asm.S crt0.S CONTIKI_ASMFILES += uip_arch-asm.S crt0.S
CONTIKI_ASMOBJECTFILES = ${addprefix $(OBJECTDIR)/,$(CONTIKI_ASMFILES:.S=.o)} CONTIKI_ASMOBJECTFILES = ${addprefix $(OBJECTDIR)/,$(CONTIKI_ASMFILES:.S=.o)}
@ -64,17 +69,15 @@ $(OBJECTDIR)/%.o: %.cS
endif endif
#CUSTOM_RULE_ALLOBJS_TO_TARGETLIB #CUSTOM_RULE_ALLOBJS_TO_TARGETLIB
$(OBJECTDIR)/contiki-$(TARGET).lib: $(CONTIKI_OBJECTFILES) $(PROJECT_OBJECTFILES) $(CONTIKI_ASMOBJECTFILES) $(CONTIKI_CASMOBJECTFILES) contiki-$(TARGET).lib: $(CONTIKI_OBJECTFILES) $(PROJECT_OBJECTFILES) $(CONTIKI_ASMOBJECTFILES) $(CONTIKI_CASMOBJECTFILES)
rm -f $@ rm -f $@
for target in $^; do echo $$target >> $@; done for target in $^; do echo $$target >> $@; done
sed -i -e "s/$(OBJECTDIR)\///" $@
#CUSTOM_RULE_LINK (workaround for compiling examples)
$(CONTIKI_PROJECT): $(CONTIKI_PROJECT).ihx
mv $(CONTIKI_PROJECT).ihx $(CONTIKI_PROJECT).$(TARGET)
#CUSTOM_RULE_LINK #CUSTOM_RULE_LINK
$(OBJECTDIR)/contiki.ihx: $(OBJECTDIR)/contiki-$(TARGET).lib $(OBJECTDIR)/crt0.o %.ihx: contiki-$(TARGET).lib
$(CC) $(LDFLAGS) -o $@ $(OBJECTDIR)/crt0.o -L$(OBJECTDIR) -lcontiki-$(TARGET).lib $(CC) $(LDFLAGS) -o $@ $(OBJECTDIR)/crt0.o -lcontiki-$(TARGET).lib
$(LD) -nf $(OBJECTDIR)/contiki
mv $(OBJECTDIR)/contiki.map .
$(OBJECTDIR)/%.ihx: $(OBJECTDIR)/contiki-$(TARGET).lib $(OBJECTDIR)/%*.o
$(CC) $(LDPFLAGS) -o $@ $(OBJECTDIR)/$*.o -lcontiki-$(TARGET).lib
$(LD) -nf $* $(LD) -nf $*

View File

@ -27,7 +27,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: z80def.h,v 1.7 2009/07/09 18:26:55 matsutsuka Exp $ * $Id: z80def.h,v 1.8 2009/12/16 06:47:17 matsutsuka Exp $
* *
*/ */
@ -44,7 +44,7 @@
#define CC_CONF_FUNCTION_POINTER_ARGS 1 #define CC_CONF_FUNCTION_POINTER_ARGS 1
#define CC_CONF_FASTCALL #define CC_CONF_FASTCALL
#define CC_CONF_VA_ARGS 1 #define CC_CONF_VA_ARGS 0
#define CC_CONF_UNSIGNED_CHAR_BUGS 0 #define CC_CONF_UNSIGNED_CHAR_BUGS 0
#define CC_CONF_REGISTER_ARGS 0 #define CC_CONF_REGISTER_ARGS 0

View File

@ -2,7 +2,7 @@
# Makefile for PC-6001 using z80/SDCC # Makefile for PC-6001 using z80/SDCC
# @author Takahide Matsutsuka <markn@markn.org> # @author Takahide Matsutsuka <markn@markn.org>
# #
# $Id: Makefile,v 1.6 2007/11/28 10:11:55 matsutsuka Exp $ # $Id: Makefile,v 1.7 2009/12/16 06:47:18 matsutsuka Exp $
# #
CONTIKI = ../.. CONTIKI = ../..
@ -16,7 +16,6 @@ APPS_NETWORK_SERVER = program-handler cmdd telnetd shell
PLATFORM_APPS_DESKTOP = multithread tinysample PLATFORM_APPS_DESKTOP = multithread tinysample
PLATFORM_APPS_NETWORK = webserver-mini PLATFORM_APPS_NETWORK = webserver-mini
PLATFORM_APPS=$(PLATFORM_APPS_DESKTOP) PLATFORM_APPS=$(PLATFORM_APPS_DESKTOP)
ifeq ($(MAKECMDGOALS),client) ifeq ($(MAKECMDGOALS),client)
@ -27,6 +26,42 @@ else
APPS = $(APPS_DESKTOP) APPS = $(APPS_DESKTOP)
endif endif
# Default values
MEMORY=32K
PLATFORM_APPS=$(PLATFORM_APPS_DESKTOP)
CONTIKI_TARGET_MAIN = contiki-desktop-main.c
CTKCONF = NORMAL
LOADER = 0
# Target dependent options
ifeq ($(MAKECMDGOALS),p62)
ARCH=PC6001MK2
else ifeq ($(MAKECMDGOALS),p6A)
ARCH=PC6001A
else ifeq ($(MAKECMDGOALS),minimal)
MEMORY=16K
CONTIKI_TARGET_MAIN=contiki-minimal-main.c
else ifeq ($(MAKECMDGOALS),serial)
CONTIKI_TARGET_MAIN=contiki-serial-main.c
else ifeq ($(MAKECMDGOALS),rom)
CTKCONF=NOICON
MEMORY=ROM
LOADER = 1
CONTIKI_TARGET_MAIN=contiki-loader-main.c
else ifeq ($(MAKECMDGOALS),load)
CTKCONF=NOICON
LOADER = 1
CONTIKI_TARGET_MAIN=contiki-loader-main.c
else ifeq ($(MAKECMDGOALS),server)
CTKCONF=SERVER
PLATFORM_APPS = $(PLATFORM_APPS_NETWORK)
CONTIKI_TARGET_MAIN=contiki-server-main.c
else ifeq ($(MAKECMDGOALS),client)
CTKCONF=CLIENT
PLATFORM_APPS = $(PLATFORM_APPS_NETWORK)
CONTIKI_TARGET_MAIN=contiki-client-main.c
endif
all : p6 all : p6
p6 : contiki p6 : contiki
@ -39,4 +74,14 @@ load : contiki
server : contiki server : contiki
client : contiki client : contiki
remove-ctk:
rm -f obj_$(TARGET)/ctk*;
rm -f contiki.ihex
remove-net:
rm -f ${addprefix obj_$(TARGET)/,uip*.o hc.o psock.o rawpacket-udp.o resolv.o slip*.o tcp*.o uaod*.o rime*.o http*.o web*.o};
rm -f contiki.ihex
remove-mt:
rm -f obj_$(TARGET)/mt*.o
rm -f contiki.ihex
include $(CONTIKI)/Makefile.include include $(CONTIKI)/Makefile.include

View File

@ -2,51 +2,30 @@
# Makefile for PC-6001 using z80/SDCC # Makefile for PC-6001 using z80/SDCC
# @author Takahide Matsutsuka <markn@markn.org> # @author Takahide Matsutsuka <markn@markn.org>
# #
# $Id: Makefile.pc-6001,v 1.12 2009/12/11 14:59:31 matsutsuka Exp $ # $Id: Makefile.pc-6001,v 1.13 2009/12/16 06:47:18 matsutsuka Exp $
# #
ifndef CONTIKI ifndef CONTIKI
$(error CONTIKI not defined! You must specify where CONTIKI resides!) $(error CONTIKI not defined! You must specify where CONTIKI resides!)
endif endif
# Default values ### setup default values
ARCH=PC6001 ifndef ARCH
MEMORY=32K ARCH=PC6001
PLATFORM_APPS=$(PLATFORM_APPS_DESKTOP) endif
CONTIKI_TARGET_MAIN = contiki-main.c ifndef MEMORY
CTKCONF = NORMAL MEMORY=32K
LOADER = 0 endif
ifndef CONTIKI_TARGET_MAIN
# Target dependent options CONTIKI_TARGET_MAIN = contiki-main.c
ifeq ($(MAKECMDGOALS),p62) endif
ARCH=PC6001MK2 ifndef CTKCONF
else ifeq ($(MAKECMDGOALS),p6A) CTKCONF=NORMAL
ARCH=PC6001A endif
else ifeq ($(MAKECMDGOALS),minimal) ifndef LOADER
MEMORY=16K LOADER=0
CONTIKI_TARGET_MAIN=contiki-minimal-main.c
else ifeq ($(MAKECMDGOALS),serial)
CONTIKI_TARGET_MAIN=contiki-serial-main.c
else ifeq ($(MAKECMDGOALS),rom)
CTKCONF=NOICON
MEMORY=ROM
LOADER = 1
CONTIKI_TARGET_MAIN=contiki-loader-main.c
else ifeq ($(MAKECMDGOALS),load)
CTKCONF=NOICON
LOADER = 1
CONTIKI_TARGET_MAIN=contiki-loader-main.c
else ifeq ($(MAKECMDGOALS),server)
CTKCONF=SERVER
PLATFORM_APPS = $(PLATFORM_APPS_NETWORK)
CONTIKI_TARGET_MAIN=contiki-server-main.c
else ifeq ($(MAKECMDGOALS),client)
CTKCONF=CLIENT
PLATFORM_APPS = $(PLATFORM_APPS_NETWORK)
CONTIKI_TARGET_MAIN=contiki-client-main.c
endif endif
### setup default values
ifndef HEX2BIN ifndef HEX2BIN
HEX2BINDIR = ../../tools/z80/hex2bin/ HEX2BINDIR = ../../tools/z80/hex2bin/
HEX2BIN = $(HEX2BINDIR)/hexameter HEX2BIN = $(HEX2BINDIR)/hexameter
@ -56,7 +35,6 @@ endif
PLATFORM = $(CONTIKI)/platform/$(TARGET) PLATFORM = $(CONTIKI)/platform/$(TARGET)
CONTIKI_TARGET_DIRS = . ctk dev loader CONTIKI_TARGET_DIRS = . ctk dev loader
CFLAGS += -DMEMORY_$(MEMORY) -DARCH_$(ARCH) -DCTK_$(CTKCONF) CFLAGS += -DMEMORY_$(MEMORY) -DARCH_$(ARCH) -DCTK_$(CTKCONF)
#-Wp-includecontiki-conf.h
ifeq ($(MEMORY),16K) ifeq ($(MEMORY),16K)
LDFLAGS += --code-loc 0xc40f --data-loc 0 LDFLAGS += --code-loc 0xc40f --data-loc 0
@ -108,24 +86,14 @@ contiki: $(HEX2BIN) contiki.p6
.SUFFIXES: .SUFFIXES:
%.p6: $(OBJECTDIR)/%.ihx %.p6: %.ihx
$(HEX2BIN) $(HEX2BINFLAGS) $< $(HEX2BINDIR)/ihx/suffix.ihx $(HEX2BIN) $(HEX2BINFLAGS) $< $(HEX2BINDIR)/ihx/suffix.ihx
%.rom: $(OBJECTDIR)/%.ihx %.rom: %.ihx
$(HEX2BIN) $(HEX2BINFLAGS) $< $(HEX2BIN) $(HEX2BINFLAGS) $<
$(HEX2BIN): $(HEX2BIN):
cd $(HEX2BINDIR); make cd $(HEX2BINDIR); make
remove-ctk:
rm -f obj_$(TARGET)/ctk*;
rm -f contiki.ihex
remove-net:
rm -f ${addprefix obj_$(TARGET)/,uip*.o hc.o psock.o rawpacket-udp.o resolv.o slip*.o tcp*.o uaod*.o rime*.o http*.o web*.o};
rm -f contiki.ihex
remove-mt:
rm -f obj_$(TARGET)/mt*.o
rm -f contiki.ihex
### Define the CPU directory ### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/cpu/z80 CONTIKI_CPU=$(CONTIKI)/cpu/z80
include $(CONTIKI_CPU)/Makefile.z80 include $(CONTIKI_CPU)/Makefile.z80

View File

@ -0,0 +1,83 @@
/*
* Copyright (c) 2007, Takahide Matsutsuka.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: contiki-desktop-main.c,v 1.1 2009/12/16 06:47:18 matsutsuka Exp $
*
*/
/*
* \file
* This is a sample main file with desktop.
* \author
* Takahide Matsutsuka <markn@markn.org>
*/
#include "contiki.h"
#include "program-handler.h"
#include "about-dsc.h"
#include "calc-dsc.h"
#include "process-list-dsc.h"
#include "shell-dsc.h"
#include "mt-test-dsc.h"
#if WITH_LOADER_ARCH
#include "directory-dsc.h"
#endif
/*---------------------------------------------------------------------------*/
int
main(void)
{
/* initialize process manager. */
process_init();
/* start services */
process_start(&ctk_process, NULL);
process_start(&program_handler_process, NULL);
process_start(&etimer_process, NULL);
/* register programs to the program handler */
#if WITH_LOADER_ARCH
program_handler_add(&directory_dsc, "Directory", 1);
program_handler_add(&processes_dsc, "Processes", 1);
// program_handler_add(&shell_dsc, "Command shell", 1);
#else
program_handler_add(&processes_dsc, "Processes", 1);
program_handler_add(&mttest_dsc, "Multithread", 1);
program_handler_add(&calc_dsc, "Calculator", 1);
program_handler_add(&about_dsc, "About", 1);
// program_handler_add(&shell_dsc, "Command shell", 1);
#endif
while(1) {
process_run();
etimer_request_poll();
}
}

View File

@ -27,29 +27,28 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: contiki-main.c,v 1.3 2008/07/20 07:44:39 matsutsuka Exp $ * $Id: contiki-main.c,v 1.4 2009/12/16 06:47:18 matsutsuka Exp $
* *
*/ */
/* /*
* \file * \file
* This is a sample main file with desktop. * This is a main file for standard configuration.
* \author * \author
* Takahide Matsutsuka <markn@markn.org> * Takahide Matsutsuka <markn@markn.org>
*/ */
#include "contiki.h" #include "contiki.h"
#include "ctk/ctk.h"
#include "program-handler.h" #ifndef WITHOUT_GUI
#include "about-dsc.h" #define CTK_PROCESS &ctk_process,
#include "calc-dsc.h" #else /* WITH_GUI */
#include "process-list-dsc.h" #define CTK_PROCESS
#include "shell-dsc.h" #endif /* WITH_GUI */
#include "mt-test-dsc.h"
#if WITH_LOADER_ARCH PROCINIT(CTK_PROCESS
#include "directory-dsc.h" &etimer_process);
#endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
@ -57,24 +56,7 @@ main(void)
{ {
/* initialize process manager. */ /* initialize process manager. */
process_init(); process_init();
autostart_start(autostart_processes);
/* start services */
process_start(&ctk_process, NULL);
process_start(&program_handler_process, NULL);
process_start(&etimer_process, NULL);
/* register programs to the program handler */
#if WITH_LOADER_ARCH
program_handler_add(&directory_dsc, "Directory", 1);
program_handler_add(&processes_dsc, "Processes", 1);
// program_handler_add(&shell_dsc, "Command shell", 1);
#else
program_handler_add(&processes_dsc, "Processes", 1);
program_handler_add(&mttest_dsc, "Multithread", 1);
program_handler_add(&calc_dsc, "Calculator", 1);
program_handler_add(&about_dsc, "About", 1);
// program_handler_add(&shell_dsc, "Command shell", 1);
#endif
while(1) { while(1) {
process_run(); process_run();

View File

@ -27,7 +27,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: ctk-conio_arch.c,v 1.3 2007/09/29 04:10:00 matsutsuka Exp $ * $Id: ctk-conio_arch.c,v 1.4 2009/12/16 06:47:18 matsutsuka Exp $
* *
*/ */
@ -71,7 +71,7 @@ const u8_t off_widget_textentry_state = offsetof(struct ctk_widget, widget) +
#if CTK_CONF_HYPERLINK #if CTK_CONF_HYPERLINK
const u8_t off_widget_hyperlink_text = offsetof(struct ctk_widget, widget) + const u8_t off_widget_hyperlink_text = offsetof(struct ctk_widget, widget) +
offsetof(struct ctk_widget_hyperlink, text); offsetof(struct ctk_widget_hyperlink, text);
#endif CTK_CONF_HYPERLINK #endif /* CTK_CONF_HYPERLINK */
#if CTK_CONF_ICONS #if CTK_CONF_ICONS
const u8_t off_widget_icon_title = offsetof(struct ctk_widget, widget) + const u8_t off_widget_icon_title = offsetof(struct ctk_widget, widget) +