Moved from last cc65 release (2.13.3) to recent cc65 snapshot (2.13.9).

Relevant cc65 changes...

General:
- The compiler generates "extended" dependency info (like gcc) so there's no need for postprocessing whatsoever :-)
- The linker is very pernickety regarding the ordering of cmdline options so a custom linker rule is necessary :-(

Apple2:
- The various memory usage scenarios aren't specified anymore via separate linker configs but via defines overriding default values in the builtin linker config.

Atari:
- The builtin linker config allows to override the start addr so there no more need for a custom linker config.
- The C library comes with POSIX directory access. So there's no more need for for a custom coding.

CBM:
- The C library comes with POSIX directory access. So there's no more need for for a custom coding.
This commit is contained in:
Oliver Schmidt 2013-02-14 15:42:43 +01:00
parent c385dd1393
commit 98060c1eab
10 changed files with 35 additions and 345 deletions

View file

@ -39,7 +39,7 @@ endif
all: cs8900a.eth lan91c96.eth
CONTIKI_TARGET_DIRS = . lib sys cfs
CONTIKI_TARGET_DIRS = . lib sys
CONTIKI_CPU_DIRS = . lib sys ctk net
CONTIKI_TARGET_SOURCEFILES += contiki-main.c
@ -47,11 +47,9 @@ CONTIKI_CPU_SOURCEFILES += log.c error.c unload.c config.c ctk-mouse.c \
clock.c mtarch.c mtarch-asm.S lc-asm.S \
uip_arch.c ethernet-drv.c ethernet.c
CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c \
CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c cfs-posix-dir.c \
$(CONTIKI_TARGET_SOURCEFILES) $(CONTIKI_CPU_SOURCEFILES)
TARGET_LIBFILES = $(TARGET).lib
ifdef ETHERNET
CONTIKI_SOURCEFILES += $(ETHERNET)-eth.S
CFLAGS += -DETHERNET=$(ETHERNET)
@ -60,7 +58,7 @@ endif
### Compiler definitions
AS = ca65
CC = cc65
CC = cl65
LD = ld65
AR = ar65
@ -69,35 +67,29 @@ AR = ar65
ASFLAGS = -t $(TARGET)
CFLAGS += -t $(TARGET) -Or
LDFLAGS = -D __STACKSIZE__=0x200 -u _main -m contiki-$(TARGET).map
LDFLAGS = $(STARTADDR_FLAG) -t $(TARGET) -m contiki-$(TARGET).map -D __STACKSIZE__=0x200
AROPTS = a
### Compilation rules
.SUFFIXES:
CMD.EXE := $(shell echo)
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.o: %.c
$(CC) $(CFLAGS) --create-dep $< -o $(@:.o=.s)
@$(AS) $(ASFLAGS) $(@:.o=.s) -o $@
@sed -e "s!.s:!.o:!" -e "s!\t! !" < $(@:.o=.u) > $(@:.o=.d)
@rm -f $(@:.o=.s) $(@:.o=.u)
ifndef CMD.EXE
@$(FINALIZE_DEPENDENCY)
endif
$(CC) -c -o $@ $(CFLAGS) --create-dep $(@:.o=.d) $<
CUSTOM_RULE_C_TO_CO = 1
%.co: %.c
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $(@:.co=.s)
@$(AS) $(ASFLAGS) $(@:.co=.s) -o $@
@rm -f $(@:.co=.s)
$(CC) -c -o $@ $(CFLAGS) -DAUTOSTART_ENABLE --create-dep $(@:.o=.d) $<
CUSTOM_RULE_LINK = 1
%.$(TARGET): %.co contiki-$(TARGET).a
$(LD) -o $@ $(LDFLAGS) -u _main $^ $(TARGET).lib
%.eth: $(OBJECTDIR)/%.o
$(LD) -t module -m $@.map $< -o $@
$(LD) -o $@ -t module -m $@.map $<
ifdef ETHERNET
$(ETHERNET)-eth.S: $(ETHERNET).eth
co65 --code-label _$(ETHERNET) -o $@ $<
co65 -o $@ --code-label _$(ETHERNET) $<
endif

View file

@ -33,22 +33,22 @@
# $Id: Makefile.apple2enh,v 1.19 2010/10/23 08:17:45 oliverschmidt Exp $
#
CONTIKI_SOURCEFILES += cfs-posix-dir.c
CONTIKI_TARGET_SOURCEFILES += pfs.S
CONTIKI_CPU = $(CONTIKI)/cpu/6502
include $(CONTIKI_CPU)/Makefile.6502
LDFLAGS += -D __HIMEM__=0xBF00
ifeq ($(findstring WITH_REBOOT,$(DEFINES)),WITH_REBOOT)
HIGHCODE_SOURCEFILES = process.c etimer.c uip_arp.c
LDFLAGS += -C apple2enh-reboot.cfg
LC_SOURCEFILES = process.c etimer.c uip_arp.c
LDFLAGS += -D __LCADDR__=0xD000 -D __LCSIZE__=0x1000
else
HIGHCODE_SOURCEFILES = process.c etimer.c ethernet.c
LDFLAGS += -C apple2enh-loader.cfg
LC_SOURCEFILES = process.c etimer.c ethernet.c
endif
# Set a target-specific variable value
${addprefix $(OBJECTDIR)/,${call oname, $(HIGHCODE_SOURCEFILES)}}: CFLAGS += --code-name HIGHCODE
${addprefix $(OBJECTDIR)/,${call oname, $(LC_SOURCEFILES)}}: CFLAGS += --code-name LC
ifeq ($(MAKECMDGOALS),disk)
ifndef AC

View file

@ -35,13 +35,10 @@
ETHERNET = cs8900a
CONTIKI_SOURCEFILES += cfs-posix-dir.c
CONTIKI_TARGET_SOURCEFILES += posixdirent.S
CONTIKI_CPU = $(CONTIKI)/cpu/6502
include $(CONTIKI_CPU)/Makefile.6502
LDFLAGS += -C $(CONTIKI)/platform/$(TARGET)/$(TARGET).cfg -S 0x2000
STARTADDR_FLAG = -S 0x2000
ifeq ($(MAKECMDGOALS),disk)
ifndef DIR2ATR
@ -51,15 +48,15 @@ endif
disk: all
mkdir atr
cp $(CONTIKI)/tools/$(TARGET)/dos.sys atr/dos.sys
cp $(CONTIKI)/tools/$(TARGET)/dup.sys atr/dup.sys
cp $(CONTIKI_PROJECT).$(TARGET) atr/autorun.sys
cp $(CONTIKI)/tools/$(TARGET)/sample.cfg atr/contiki.cfg
cp $(CONTIKI)/tools/$(TARGET)/dos25/dos.sys atr/dos.sys
cp $(CONTIKI)/tools/$(TARGET)/dos25/dup.sys atr/dup.sys
cp $(CONTIKI_PROJECT).$(TARGET) atr/autorun.sys
cp $(CONTIKI)/tools/$(TARGET)/sample.cfg atr/contiki.cfg
ifeq ($(HTTPD-CFS),1)
cp httpd-cfs/index.htm atr/index.htm
cp httpd-cfs/backgrnd.gif atr/backgrnd.gif
cp httpd-cfs/contiki.gif atr/contiki.gif
cp httpd-cfs/notfound.htm atr/notfound.htm
cp httpd-cfs/index.htm atr/index.htm
cp httpd-cfs/backgrnd.gif atr/backgrnd.gif
cp httpd-cfs/contiki.gif atr/contiki.gif
cp httpd-cfs/notfound.htm atr/notfound.htm
endif
$(DIR2ATR) -b Dos25 1040 contiki.atr atr
rm -r atr

View file

@ -1,159 +0,0 @@
; Native: Shawn Jefferson, December 2005
; POSIX: Stefan Haubenthal, April 2008
.include "atari.inc"
.export _opendir, _readdir, _closedir
.import findfreeiocb, clriocb
.import __oserror, return0, __do_oserror
.importzp ptr1, tmp1
.ifdef DEFAULT_DEVICE
.import __defdev
.endif
.proc _opendir
sta ptr1
stx ptr1+1
jsr findfreeiocb
beq @iocbok
bne cioerr
@iocbok: stx diriocb
jsr clriocb
ldx diriocb
ldy #0 ; '.' -> "D:*.*"
lda (ptr1),y
cmp #'.'
bne @use_parm
; "." was given as parameter, use default device/dir
.ifdef DEFAULT_DEVICE
; construct a "Dn:*.*" like string from the default drive
lda __defdev+1
sta dddefdev+1 ; copy drive number (overwrite 2nd 'D')
lda #<dddefdev
sta ICBAL,x
lda #>dddefdev
sta ICBAH,x
bne @cont
.else
lda #<defdev
sta ICBAL,x
lda #>defdev
sta ICBAH,x
bne @cont
.endif
@use_parm: lda ptr1
sta ICBAL,x
lda ptr1+1
sta ICBAH,x
@cont: lda #OPEN
sta ICCOM,x
lda #OPNIN|DIRECT
sta ICAX1,x
jsr CIOV
bmi cioerr
lda #0
sta __oserror
tax
lda diriocb
rts
.endproc
cioerr: sty __oserror
jmp return0
.proc _readdir
tax
lda #GETREC
sta ICCOM,x
lda #<entry
sta ICBAL,x
sta ptr1
lda #>entry
sta ICBAH,x
sta ptr1+1
lda #DSCTSZ
sta ICBLL,x
lda #0
sta ICBLH,x
jsr CIOV
bmi cioerr
ldy #0 ; FREE SECTORS
lda (ptr1),y
cmp #'0'
bcs cioerr
dey
@next: iny ; remove trailing spaces
iny
iny
lda (ptr1),y
dey
dey
sta (ptr1),y
cpy #9
bcs @break
cmp #' '
bne @next
@break: lda #'.' ; extension dot
sta (ptr1),y
iny ; copy extension
sty tmp1
ldy #10
lda (ptr1),y
cmp #' '
bne @hasext
; no extension present: remove the trailing dot and be done
ldy tmp1
dey
bne @done
@hasext: jsr copychar
ldy #11
jsr copychar
ldy #12
jsr copychar
@done: lda #0 ; end of string
sta (ptr1),y
lda ptr1
ldx ptr1+1
rts
copychar: lda (ptr1),y ; src=y dest=tmp1
ldy tmp1
cmp #' '
beq @break
sta (ptr1),y
iny
sty tmp1
@break: rts
.endproc
.proc _closedir
tax
lda #CLOSE
sta ICCOM,x
jsr CIOV
bmi @cioerr
ldx #0
stx __oserror ; clear system specific error code
txa
rts
@cioerr: jmp __do_oserror
.endproc
.data
.ifdef DEFAULT_DEVICE
dddefdev: .byte "D"
.endif
defdev: .asciiz "D:*.*"
.bss
diriocb: .res 1
entry: .res DSCTSZ

View file

@ -33,13 +33,12 @@
# $Id: Makefile.c128,v 1.15 2010/10/23 13:48:06 oliverschmidt Exp $
#
CONTIKI_TARGET_SOURCEFILES += cfs-cbm-dir.c pfs.S pfs_write.S
CONTIKI_TARGET_SOURCEFILES += pfs.S pfs_write.S
CONTIKI_CPU = $(CONTIKI)/cpu/6502
include $(CONTIKI_CPU)/Makefile.6502
CFLAGS += -DWITH_PETSCII
LDFLAGS += -t $(TARGET)
CFLAGS += -DWITH_PETSCII
ifeq ($(MAKECMDGOALS),disk)
ifndef C1541

View file

@ -1,69 +0,0 @@
/*
* Copyright (c) 2010, Swedish Institute of Computer Science.
* 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. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
*
* This file is part of the Contiki operating system.
*
* Author: Oliver Schmidt <ol.sc@web.de>
*
*/
#include <string.h>
#include <cbm.h>
#include "contiki.h"
#include "cfs/cfs.h"
/*---------------------------------------------------------------------------*/
int
cfs_opendir(struct cfs_dir *p, const char *n)
{
return cbm_opendir(12, _curunit);
}
/*---------------------------------------------------------------------------*/
int
cfs_readdir(struct cfs_dir *p, struct cfs_dirent *e)
{
struct cbm_dirent dirent;
do {
if(cbm_readdir(12, &dirent)) {
return -1;
}
} while(dirent.type == CBM_T_HEADER);
strcpy(e->name, dirent.name);
e->size = dirent.size;
return 0;
}
/*---------------------------------------------------------------------------*/
void
cfs_closedir(struct cfs_dir *p)
{
cbm_closedir(12);
}
/*---------------------------------------------------------------------------*/

View file

@ -36,7 +36,7 @@
.constructor init_pfs
.destructor done_pfs
.importzp ptr1, ptr2, ptr3, sp
.import __curunit, __filetype, popax, addysp, subysp
.import curunit, __filetype, popax, addysp, subysp
.export pfs_rwcommon, pfs_rwsetflags, pfs_rwcommonend
.if F_IDE64
.export ide64_rwprepare, ide64_rwfinish
@ -178,7 +178,7 @@ next: inc ptr2 ;next file number
stx ptr2+1
nextsa: inc ptr2+1 ;next channel
retr: lda ptr2 ;file number
ldx __curunit
ldx curunit
ldy ptr2+1 ;secondary address
jsr SETLFS
jsr OPEN ;open

View file

@ -33,13 +33,12 @@
# $Id: Makefile.c64,v 1.17 2010/10/23 13:48:06 oliverschmidt Exp $
#
CONTIKI_TARGET_SOURCEFILES += cfs-cbm-dir.c pfs.S pfs_write.S
CONTIKI_TARGET_SOURCEFILES += pfs.S pfs_write.S
CONTIKI_CPU = $(CONTIKI)/cpu/6502
include $(CONTIKI_CPU)/Makefile.6502
CFLAGS += -DWITH_PETSCII
LDFLAGS += -t $(TARGET)
CFLAGS += -DWITH_PETSCII
ifeq ($(MAKECMDGOALS),disk)
ifndef C1541

View file

@ -1,69 +0,0 @@
/*
* Copyright (c) 2010, Swedish Institute of Computer Science.
* 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. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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.
*
* This file is part of the Contiki operating system.
*
* Author: Oliver Schmidt <ol.sc@web.de>
*
*/
#include <string.h>
#include <cbm.h>
#include "contiki.h"
#include "cfs/cfs.h"
/*---------------------------------------------------------------------------*/
int
cfs_opendir(struct cfs_dir *p, const char *n)
{
return cbm_opendir(12, _curunit);
}
/*---------------------------------------------------------------------------*/
int
cfs_readdir(struct cfs_dir *p, struct cfs_dirent *e)
{
struct cbm_dirent dirent;
do {
if(cbm_readdir(12, &dirent)) {
return -1;
}
} while(dirent.type == CBM_T_HEADER);
strcpy(e->name, dirent.name);
e->size = dirent.size;
return 0;
}
/*---------------------------------------------------------------------------*/
void
cfs_closedir(struct cfs_dir *p)
{
cbm_closedir(12);
}
/*---------------------------------------------------------------------------*/

View file

@ -36,7 +36,7 @@
.constructor init_pfs
.destructor done_pfs
.importzp ptr1, ptr2, ptr3, sp
.import __curunit, __filetype, popax, addysp, subysp
.import curunit, __filetype, popax, addysp, subysp
.export pfs_rwcommon, pfs_rwsetflags, pfs_rwcommonend
.if F_IDE64
.export ide64_rwprepare, ide64_rwfinish
@ -178,7 +178,7 @@ next: inc ptr2 ;next file number
stx ptr2+1
nextsa: inc ptr2+1 ;next channel
retr: lda ptr2 ;file number
ldx __curunit
ldx curunit
ldy ptr2+1 ;secondary address
jsr SETLFS
jsr OPEN ;open