Build static Ethernet drivers directly from source.

This commit is contained in:
Oliver Schmidt 2014-06-09 23:14:11 +02:00
parent 2e166a83c7
commit f124425ee1
6 changed files with 63 additions and 18 deletions

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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

View file

@ -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

View file

@ -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