Allow cc65 ethernet drivers to be loaded statically instead of dynamically. This saved quite some space in scenarios without additional cc65 drivers to be loaded for i.e. a mouse because in those scenarios the cc65 module loader isn't necessary. And without the module loader typically the cc65 heap manager isn't necessary.
This commit is contained in:
parent
cd24e920b6
commit
55d61d317b
|
@ -30,7 +30,7 @@
|
|||
#
|
||||
# Author: Oliver Schmidt <ol.sc@web.de>
|
||||
#
|
||||
# $Id: Makefile.6502,v 1.31 2010/02/04 23:52:30 oliverschmidt Exp $
|
||||
# $Id: Makefile.6502,v 1.32 2010/09/28 23:02:16 oliverschmidt Exp $
|
||||
#
|
||||
|
||||
ifndef CC65_HOME
|
||||
|
@ -52,6 +52,11 @@ CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c cfs-posix-dir.c \
|
|||
|
||||
TARGET_LIBFILES = $(TARGET).lib
|
||||
|
||||
ifdef ETHERNET
|
||||
CONTIKI_SOURCEFILES += $(ETHERNET)-eth.S
|
||||
CFLAGS += -DETHERNET=$(ETHERNET)
|
||||
endif
|
||||
|
||||
### Compiler definitions
|
||||
|
||||
AS = ca65
|
||||
|
@ -87,3 +92,8 @@ CUSTOM_RULE_C_TO_CO = 1
|
|||
|
||||
%.eth: $(OBJECTDIR)/%.o
|
||||
$(LD) -t module -m $@.map $< -o $@
|
||||
|
||||
ifdef ETHERNET
|
||||
$(ETHERNET)-eth.S: $(ETHERNET).eth
|
||||
co65 --code-label _$(ETHERNET) -o $@ $<
|
||||
endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* Author: Oliver Schmidt <ol.sc@web.de>
|
||||
*
|
||||
* @(#)$Id: ethernet.c,v 1.6 2007/12/23 15:37:28 oliverschmidt Exp $
|
||||
* @(#)$Id: ethernet.c,v 1.7 2010/09/28 23:02:16 oliverschmidt Exp $
|
||||
*/
|
||||
|
||||
#include <modload.h>
|
||||
|
@ -59,6 +59,9 @@ void CC_FASTCALL
|
|||
ethernet_init(struct ethernet_config *config)
|
||||
{
|
||||
static const char signature[4] = {0x65, 0x74, 0x68, 0x01};
|
||||
|
||||
#ifndef ETHERNET
|
||||
|
||||
struct mod_ctrl module_control = {cfs_read};
|
||||
u8_t byte;
|
||||
|
||||
|
@ -85,6 +88,14 @@ ethernet_init(struct ethernet_config *config)
|
|||
}
|
||||
}
|
||||
|
||||
#else /* !ETHERNET */
|
||||
|
||||
extern void ETHERNET;
|
||||
|
||||
module = ÐERNET;
|
||||
|
||||
#endif /* !ETHERNET */
|
||||
|
||||
module->buffer = uip_buf;
|
||||
module->buffer_size = UIP_BUFSIZE;
|
||||
module->init(config->addr);
|
||||
|
@ -109,6 +120,8 @@ ethernet_exit(void)
|
|||
{
|
||||
module->exit();
|
||||
|
||||
#ifndef ETHERNET
|
||||
mod_free(module);
|
||||
#endif /* !ETHERNET */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
Loading…
Reference in a new issue