diff --git a/cpu/6502/Makefile.6502 b/cpu/6502/Makefile.6502 index 7ef11fe21..9308335ea 100644 --- a/cpu/6502/Makefile.6502 +++ b/cpu/6502/Makefile.6502 @@ -47,15 +47,16 @@ 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 +ETHERNET_SOURCEFILES = cs8900a.S lan91c96.S w5100.S + CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c cfs-posix-dir.c \ - $(CONTIKI_TARGET_SOURCEFILES) $(CONTIKI_CPU_SOURCEFILES) + $(CONTIKI_TARGET_SOURCEFILES) $(CONTIKI_CPU_SOURCEFILES) \ + $(ETHERNET_SOURCEFILES) MODULES += core/ctk core/net/ip core/net/ipv4 core/net/ipv6 -ifdef ETHERNET - CONTIKI_SOURCEFILES += $(ETHERNET)-eth.S - CFLAGS += -DETHERNET=$(ETHERNET) -endif +# Set target-specific variable values +${addprefix $(OBJECTDIR)/,${call oname, $(ETHERNET_SOURCEFILES)}}: ASFLAGS += -D DYN_DRV=0 AS = ca65 CC = cl65 diff --git a/cpu/6502/Makefile.customrules-6502 b/cpu/6502/Makefile.customrules-6502 index 80b22294e..d477a1d15 100644 --- a/cpu/6502/Makefile.customrules-6502 +++ b/cpu/6502/Makefile.customrules-6502 @@ -13,11 +13,10 @@ CUSTOM_RULE_LINK = 1 $(TRACE_LD) $(Q)$(LD) -o $@ $(LDFLAGS) -u _main $^ $(TARGET).lib -%.eth: $(OBJECTDIR)/%.o +%.o: %.S + $(TRACE_AS) + $(Q)$(AS) $(ASFLAGS) -o $@ $< + +%.eth: %.o $(TRACE_LD) $(Q)$(LD) -o $@ -t module -m $@.map $< - -ifdef ETHERNET -$(ETHERNET)-eth.S: $(ETHERNET).eth - co65 -o $@ --code-label _$(ETHERNET) $< -endif diff --git a/cpu/6502/README.md b/cpu/6502/README.md index 93f4b5276..a928d81bd 100644 --- a/cpu/6502/README.md +++ b/cpu/6502/README.md @@ -40,6 +40,11 @@ high-level configuration macros may be set: - Default: 10 - Purpose: Set the maximum number of concurrent TCP connections. +- ETHERNET + - Default: N/A + - Purpose: Link Ethernet driver statically instead of loading it dynamically + using the network configuration file. + - WITH_LOGGING - Default: 0 - Purpose: Have log_message() and UIP_LOG() write messages to the screen. diff --git a/cpu/6502/net/cs8900a.S b/cpu/6502/net/cs8900a.S index 8cf3bea23..784f1673e 100644 --- a/cpu/6502/net/cs8900a.S +++ b/cpu/6502/net/cs8900a.S @@ -32,7 +32,8 @@ ; ;--------------------------------------------------------------------- - .segment "HEADER" + .macpack module + module_header _cs8900a ; Driver signature .byte $65, $74, $68 ; "eth" @@ -54,14 +55,25 @@ bufsize:.res 2 ; Size ;--------------------------------------------------------------------- - .zeropage + .if DYN_DRV + .zeropage sp: .res 2 ; Stack pointer (Do not trash !) reg: .res 2 ; Address of rxtxreg ptr: .res 2 ; Indirect addressing pointer len: .res 2 ; Frame length cnt: .res 2 ; Frame length counter + .else + + .include "zeropage.inc" +reg := ptr1 ; Address of rxtxreg +ptr := ptr2 ; Indirect addressing pointer +len := ptr3 ; Frame length +cnt := ptr4 ; Frame length counter + + .endif + ;--------------------------------------------------------------------- .rodata diff --git a/cpu/6502/net/lan91c96.S b/cpu/6502/net/lan91c96.S index e3f92b75a..926e9c2c2 100644 --- a/cpu/6502/net/lan91c96.S +++ b/cpu/6502/net/lan91c96.S @@ -33,7 +33,8 @@ ; ;--------------------------------------------------------------------- - .segment "HEADER" + .macpack module + module_header _lan91c96 ; Driver signature .byte $65, $74, $68 ; "eth" @@ -55,13 +56,23 @@ bufsize:.res 2 ; Size ;--------------------------------------------------------------------- - .zeropage + .if DYN_DRV -sp: .res 2 ; Stack pointer (Do not trash !) + .zeropage +sp: .res 2 ; Stack pointer (Do not trash !) reg: .res 2 ; Address of register base ptr: .res 2 ; Indirect addressing pointer len: .res 2 ; Frame length + .else + + .include "zeropage.inc" +reg := ptr1 ; Address of register base +ptr := ptr2 ; Indirect addressing pointer +len := ptr3 ; Frame length + + .endif + ;--------------------------------------------------------------------- .rodata diff --git a/cpu/6502/net/w5100.S b/cpu/6502/net/w5100.S index ca0878bf3..c38b22459 100644 --- a/cpu/6502/net/w5100.S +++ b/cpu/6502/net/w5100.S @@ -32,7 +32,8 @@ ; ;--------------------------------------------------------------------- - .segment "HEADER" + .macpack module + module_header _w5100 ; Driver signature .byte $65, $74, $68 ; "eth" @@ -54,8 +55,9 @@ bufsize:.res 2 ; Size ;--------------------------------------------------------------------- - .zeropage + .if DYN_DRV + .zeropage sp: .res 2 ; Stack pointer (Do not trash !) reg: .res 2 ; Pointer Register content ptr: .res 2 ; Indirect addressing pointer @@ -67,6 +69,21 @@ bas: .res 1 ; Socket 0 Base Address (hibyte) lim: .res 1 ; Socket 0 memory limit (hibyte) tmp: .res 1 ; Temporary value + .else + + .include "zeropage.inc" +reg := ptr1 ; Pointer Register content +ptr := ptr2 ; Indirect addressing pointer +len := ptr3 ; Data length +cnt := ptr4 ; Data length counter +adv := sreg ; Data pointer advancement +dir := tmp1 ; Transfer direction +bas := tmp2 ; Socket 0 Base Address (hibyte) +lim := tmp3 ; Socket 0 memory limit (hibyte) +tmp := tmp4 ; Temporary value + + .endif + ;--------------------------------------------------------------------- .rodata