From bf8d0c68312793631ed4ade1541ec36168b3722b Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 13 Sep 2012 22:04:47 +0000 Subject: Fixes for z80 compilation with SDCC toolchain. There are still a few header file and linker issues git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5149 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/z80/src/Makefile.sdcc | 2 +- nuttx/arch/z80/src/z80/z80_io.c | 28 +++++++++++++++++++++------- nuttx/arch/z80/src/z80/z80_irq.c | 18 +++++++++++++----- 3 files changed, 35 insertions(+), 13 deletions(-) (limited to 'nuttx/arch') diff --git a/nuttx/arch/z80/src/Makefile.sdcc b/nuttx/arch/z80/src/Makefile.sdcc index d5ff3b793..522c8d6f9 100644 --- a/nuttx/arch/z80/src/Makefile.sdcc +++ b/nuttx/arch/z80/src/Makefile.sdcc @@ -94,7 +94,7 @@ $(AOBJS) $(HEAD_OBJ): %$(OBJEXT): %$(ASMEXT) $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) -# This is a kludge to work around some conflicting symbols in libsdcc.liXqueb +# This is a kludge to work around some conflicting symbols in libsdcc.lib $(SDCCLIBDIR)/myz80.lib: $(SDCCLIBDIR)/$(SDCCLIB) @cat $(SDCCLIBDIR)/$(SDCCLIB) | \ diff --git a/nuttx/arch/z80/src/z80/z80_io.c b/nuttx/arch/z80/src/z80/z80_io.c index cddaa6831..bdd55bc6b 100644 --- a/nuttx/arch/z80/src/z80/z80_io.c +++ b/nuttx/arch/z80/src/z80/z80_io.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z80/src/z80/z80_io.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -44,9 +44,23 @@ #include "up_internal.h" /**************************************************************************** - * Private Definitions + * Pre-processor Definitions ****************************************************************************/ +#undef ASM +#undef ENDASM +#undef NAKED + +#ifdef CONFIG_SDCC_OLD +# define ASM _asm +# define ENDASM _endasm +# define NAKED +#else +# define ASM __asm +# define ENDASM __endasm +# define NAKED __naked +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -69,11 +83,11 @@ void outp(char p, char c) { - _asm + ASM ld c, 4(ix) ; port ld a, 5(ix) ; value out (c), a - _endasm; + ENDASM; } @@ -85,10 +99,10 @@ void outp(char p, char c) * ****************************************************************************/ -char inp(char p) +char inp(char p) NAKED { - _asm + ASM ld c, 4(ix) ;port in l, (c) - _endasm; + ENDASM; } diff --git a/nuttx/arch/z80/src/z80/z80_irq.c b/nuttx/arch/z80/src/z80/z80_irq.c index 08b426235..87ea7063a 100644 --- a/nuttx/arch/z80/src/z80/z80_irq.c +++ b/nuttx/arch/z80/src/z80/z80_irq.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z80/src/z80/z80_irq.c * - * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,14 @@ * Private Definitions ****************************************************************************/ +#ifdef CONFIG_SDCC_OLD +# define ASM _asm +# define ENDASM _endasm +#else +# define ASM __asm +# define ENDASM __endasm +#endif + /**************************************************************************** * Public Data ****************************************************************************/ @@ -80,13 +88,13 @@ volatile chipreg_t *current_regs; irqstate_t irqsave(void) __naked { - _asm + ASM ld a, i ; AF Parity bit holds interrupt state di ; Interrupts are disabled push af ; Return AF in HL pop hl ; ret ; - _endasm; + ENDASM; } /**************************************************************************** @@ -99,7 +107,7 @@ irqstate_t irqsave(void) __naked void irqrestore(irqstate_t flags) __naked { - _asm + ASM di ; Assume disabled pop hl ; HL = return address pop af ; AF Parity bit holds interrupt state @@ -109,5 +117,5 @@ statedisable: push af ; Restore stack push hl ; ret ; and return - _endasm; + ENDASM; } -- cgit v1.2.3