diff --git a/arch/z80/src/Makefile.sdcc b/arch/z80/src/Makefile.sdcc index d45be7f933e90be802e41f5688653df5c164d761..13e56c4bf89e59adcca56d55a06a119b4077f1a6 100644 --- a/arch/z80/src/Makefile.sdcc +++ b/arch/z80/src/Makefile.sdcc @@ -104,15 +104,17 @@ $(SDCCLIBDIR)/myz80.lib: $(SDCCLIBDIR)/$(SDCCLIB) # Create a header file that contains addressing information needed by the code up_mem.h: - @echo "#ifndef __ARCH_MEM_H" >up_mem.h - @echo "#define __ARCH_MEM_H" >>up_mem.h + @echo "#ifndef __UP_MEM_H" >up_mem.h + @echo "#define __UP_MEM_H" >>up_mem.h @echo "" >>up_mem.h - @echo "#define UP_STACK_END $(CONFIG_DRAM_SIZE)" >> up_mem.h - @echo "#define UP_STACK_BASE (UP_STACK_END - $(CONFIG_PROC_STACK_SIZE))" >> up_mem.h - @echo "#define UP_HEAP1_END UP_STACK_BASE" >> up_mem.h - @echo "#define UP_HEAP1_BASE $(HEAP_BASE)" >> up_mem.h + @echo "#include <nuttx/config.h> @echo "" >>up_mem.h - @echo "#endif /* __ARCH_MEM_H */" >>up_mem.h + @echo "#define CONFIG_STACK_END $(CONFIG_DRAM_SIZE)" >> up_mem.h + @echo "#define CONFIG_STACK_BASE (CONFIG_STACK_END - $(CONFIG_PROC_STACK_SIZE))" >> up_mem.h + @echo "#define CONFIG_HEAP1_END CONFIG_STACK_BASE" >> up_mem.h + @echo "#define CONFIG_HEAP1_BASE $(HEAP_BASE)" >> up_mem.h + @echo "" >>up_mem.h + @echo "#endif /* __UP_MEM_H */" >>up_mem.h asm_mem.h: @echo " UP_COMPILER_OTHER == 0" > asm_mem.h diff --git a/arch/z80/src/Makefile.zdsii b/arch/z80/src/Makefile.zdsii index 199293ef36296f9f90f205da8fea6227c0018a5c..c6dcf653c900fe9d73baabe6ded4e62ba7e8ba69 100644 --- a/arch/z80/src/Makefile.zdsii +++ b/arch/z80/src/Makefile.zdsii @@ -77,12 +77,30 @@ $(AOBJS) $(HEAD_AOBJ): %$(OBJEXT): %$(ASMEXT) $(COBJS): %$(OBJEXT): %.c $(call COMPILE, `cygpath -w $<`, $@) -libarch$(LIBEXT): $(OBJS) +up_mem.h: + @echo "#ifndef __UP_MEM_H" >up_mem.h + @echo "#define __UP_MEM_H" >>up_mem.h + @echo "" >>up_mem.h + @echo "#include <nuttx/config.h>" >>up_mem.h + @echo "" >>up_mem.h + @echo "#ifndef CONFIG_HEAP1_BASE" >>up_mem.h + @echo " extern far unsigned long far_heapbot;" >>up_mem.h + @echo "# define CONFIG_HEAP1_BASE ((unsigned long)&far_heapbot)" >>up_mem.h + @echo "#endif" >>up_mem.h + @echo "" >>up_mem.h + @echo "#ifndef CONFIG_HEAP1_END" >>up_mem.h + @echo " extern far unsigned long far_heaptop;" >>up_mem.h + @echo "# define CONFIG_HEAP1_END ((unsigned long)&far_heaptop)" >>up_mem.h + @echo "#endif" >>up_mem.h + @echo "" >>up_mem.h + @echo "#endif /* __UP_MEM_H */" >>up_mem.h + +libarch$(LIBEXT): up_mem.h $(OBJS) @( for obj in $(OBJS) ; do \ $(call ARCHIVE, $@, $${obj}); \ done ; ) -board/libboard$(LIBEXT): +board/libboard$(LIBEXT): up_mem.h @$(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) nuttx.linkcmd: $(LINKCMDTEMPLATE) @@ -98,11 +116,11 @@ nuttx.linkcmd: $(LINKCMDTEMPLATE) @echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/csioLDD$(LIBEXT)}\", \\" >>nuttx.linkcmd @echo " \"${shell cygpath -w $(ZDSSTDLIBDIR)/zsldevinitdummy.lib$(LIBEXT)}\" \\" >>nuttx.linkcmd -nuttx$(EXEEXT): $(HEAD_AOBJ) board/libboard$(LIBEXT) nuttx.linkcmd +nuttx$(EXEEXT): up_mem.h $(HEAD_AOBJ) board/libboard$(LIBEXT) nuttx.linkcmd @echo "LD: nuttx.hex" @$(LD) $(LDFLAGS) -.depend: Makefile chip/Make.defs $(DEPSRCS) +.depend: Makefile up_mem.h chip/Make.defs $(DEPSRCS) @if [ -e board/Makefile ]; then \ $(MAKE) -C board TOPDIR="$(TOPDIR)" depend ; \ fi @@ -116,7 +134,7 @@ clean: $(MAKE) -C board TOPDIR="$(TOPDIR)" clean ; \ fi @rm -f libarch$(LIBEXT) *~ .*.swp - @rm -f nuttx.linkcmd *.asm *.tmp *.map + @rm -f nuttx.linkcmd up_mem.h *.asm *.tmp *.map $(call CLEAN) distclean: clean diff --git a/arch/z80/src/common/up_allocateheap.c b/arch/z80/src/common/up_allocateheap.c index 0c5f9fc300fff9174e99558a36cfeeae7b3e9d83..4b21b575c3dd0f963a57fcf2dc900b41b9a99e09 100644 --- a/arch/z80/src/common/up_allocateheap.c +++ b/arch/z80/src/common/up_allocateheap.c @@ -76,8 +76,8 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) { - *heap_start = (FAR void*)UP_HEAP1_BASE; - *heap_size = UP_HEAP1_END - UP_HEAP1_BASE; + *heap_start = (FAR void*)CONFIG_HEAP1_BASE; + *heap_size = CONFIG_HEAP1_END - CONFIG_HEAP1_BASE; up_ledon(LED_HEAPALLOCATE); } @@ -93,6 +93,6 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) #if CONFIG_MM_REGIONS > 1 void up_addregion(void) { - mm_addregion((FAR void*)UP_HEAP2_BASE, UP_HEAP2_END - UP_HEAP2_BASE); + mm_addregion((FAR void*)CONFIG_HEAP2_BASE, CONFIG_HEAP2_END - CONFIG_HEAP2_BASE); } #endif diff --git a/arch/z80/src/common/up_arch.h b/arch/z80/src/common/up_arch.h index b0158325aa01d2656aeae2e8fd962556dbc59a77..5ef0b932c71a7437d6223b979751e05929e8dc5f 100644 --- a/arch/z80/src/common/up_arch.h +++ b/arch/z80/src/common/up_arch.h @@ -46,7 +46,7 @@ #endif #include <arch/board/board.h> -#include "chip.h" +#include "chip/chip.h" /************************************************************************************ * Definitions diff --git a/arch/z80/src/common/up_assert.c b/arch/z80/src/common/up_assert.c index f226c943100a26663393c68bc32ce66b776bc5dd..c1e2e4a8cd5c1baf51198f1127933947df43bc6f 100644 --- a/arch/z80/src/common/up_assert.c +++ b/arch/z80/src/common/up_assert.c @@ -46,8 +46,8 @@ #include <nuttx/irq.h> #include <nuttx/arch.h> -#include <chip/chip.h> +#include "chip/chip.h" #include "up_arch.h" #include "os_internal.h" #include "up_internal.h" diff --git a/arch/z80/src/common/up_exit.c b/arch/z80/src/common/up_exit.c index d8c94fece9bc38c521084fa03fbfd47604e4e75f..45409800efa86faf5c21942737e9b825e99ddc6c 100644 --- a/arch/z80/src/common/up_exit.c +++ b/arch/z80/src/common/up_exit.c @@ -44,8 +44,8 @@ #include <debug.h> #include <nuttx/arch.h> -#include <chip/chip.h> +#include "chip/chip.h" #include "os_internal.h" #include "up_internal.h" diff --git a/arch/z80/src/common/up_internal.h b/arch/z80/src/common/up_internal.h index d340a56312fe1c2ef230f1f730d22cb25eeadb71..e90bec766dbdd8f423098d55cb5a60a86e6ff1a7 100644 --- a/arch/z80/src/common/up_internal.h +++ b/arch/z80/src/common/up_internal.h @@ -41,7 +41,7 @@ ****************************************************************************/ #include <arch/irq.h> -#include <chip/chip.h> +#include "chip/chip.h" /**************************************************************************** * Definitions @@ -111,8 +111,8 @@ extern int up_restoreusercontext(chipreg_t *regs); extern FAR chipreg_t *up_decodeirq(uint8 rstno, FAR chipreg_t *regs); extern void up_irqinitialize(void); extern int up_timerisr(int irq, FAR chipreg_t *regs); -extern void up_lowputc(char ch) __naked; -extern char up_lowgetc(void) __naked; +extern void up_lowputc(char ch) naked_function; +extern char up_lowgetc(void) naked_function; /* Defined in up_doirq.c */ diff --git a/arch/z80/src/common/up_releasepending.c b/arch/z80/src/common/up_releasepending.c index 3b2b119a3c5f776d73279bb9c17f91934766f189..853cc73507532ccd7758a8f785f391e4fda53c30 100644 --- a/arch/z80/src/common/up_releasepending.c +++ b/arch/z80/src/common/up_releasepending.c @@ -44,8 +44,8 @@ #include <debug.h> #include <nuttx/arch.h> -#include <chip/chip.h> +#include "chip/chip.h" #include "os_internal.h" #include "up_internal.h" diff --git a/arch/z80/src/common/up_reprioritizertr.c b/arch/z80/src/common/up_reprioritizertr.c index b5961d92d23f0b00cf120c0bb4299e56430dccd9..3adf33735c52dff050bb6cc45f6dced5102402a8 100644 --- a/arch/z80/src/common/up_reprioritizertr.c +++ b/arch/z80/src/common/up_reprioritizertr.c @@ -44,8 +44,8 @@ #include <debug.h> #include <nuttx/arch.h> -#include <chip/chip.h> +#include "chip/chip.h" #include "os_internal.h" #include "up_internal.h" diff --git a/arch/z80/src/common/up_unblocktask.c b/arch/z80/src/common/up_unblocktask.c index 93bfdf472f34f9e3f65e78d8152ee92b83b9af25..1ce672a5da638cd2e6718e379116afbc6be92952 100644 --- a/arch/z80/src/common/up_unblocktask.c +++ b/arch/z80/src/common/up_unblocktask.c @@ -44,8 +44,8 @@ #include <debug.h> #include <nuttx/arch.h> -#include <chip/chip.h> +#include "chip/chip.h" #include "os_internal.h" #include "clock_internal.h" #include "up_internal.h" diff --git a/arch/z80/src/z8/Make.defs b/arch/z80/src/z8/Make.defs index 8488efc96b407fb22d427310d60e58014837ad25..3c48749d7bdd14ae77528ceed5471c79440a0d24 100644 --- a/arch/z80/src/z8/Make.defs +++ b/arch/z80/src/z8/Make.defs @@ -36,9 +36,9 @@ HEAD_ASRC = z8_head.asm CMN_ASRCS = -CMN_CSRCS = up_initialize.c up_allocateheap.c up_initialstate.c \ - up_createstack.c up_releasestack.c up_interruptcontext.c \ - up_blocktask.c up_unblocktask.c up_exit.c up_releasepending.c \ +CMN_CSRCS = up_initialize.c up_allocateheap.c up_createstack.c \ + up_releasestack.c up_interruptcontext.c up_blocktask.c \ + up_unblocktask.c up_exit.c up_releasepending.c \ up_reprioritizertr.c up_copystate.c up_irq.c up_idle.c \ up_assert.c up_mdelay.c up_udelay.c \ up_schedulesigaction.c up_sigdeliver.c \ diff --git a/arch/z80/src/z80/Make.defs b/arch/z80/src/z80/Make.defs index 1d4d5c29edfd56ee8d6ef1c4cbcb976cc41157ce..ae5bdf56b3b7113657c268882d8a3644fbf18eb0 100644 --- a/arch/z80/src/z80/Make.defs +++ b/arch/z80/src/z80/Make.defs @@ -36,14 +36,13 @@ HEAD_ASRC = z80_head.asm CMN_ASRCS = -CMN_CSRCS = up_initialize.c up_allocateheap.c up_initialstate.c \ - up_createstack.c up_releasestack.c up_interruptcontext.c \ - up_blocktask.c up_unblocktask.c up_exit.c up_releasepending.c \ +CMN_CSRCS = up_initialize.c up_allocateheap.c up_createstack.c \ + up_releasestack.c up_interruptcontext.c up_blocktask.c \ + up_unblocktask.c up_exit.c up_releasepending.c \ up_reprioritizertr.c up_copystate.c up_irq.c up_idle.c \ - up_assert.c up_mdelay.c up_udelay.c \ - up_schedulesigaction.c up_sigdeliver.c \ - up_registerdump.c up_usestack.c + up_assert.c up_mdelay.c up_udelay.c up_schedulesigaction.c \ + up_sigdeliver.c up_registerdump.c up_usestack.c CHIP_ASRCS = z80_saveusercontext.asm z80_restoreusercontext.asm -CHIP_CSRCS = +CHIP_CSRCS = z80_initialstate.c diff --git a/arch/z80/src/common/up_initialstate.c b/arch/z80/src/z80/z80_initialstate.c similarity index 99% rename from arch/z80/src/common/up_initialstate.c rename to arch/z80/src/z80/z80_initialstate.c index 0e26af9a2d09f3fe1e946306a83a36f7d8cb2ad6..767c7b605762b6c8c65005c2794512fcc098b813 100644 --- a/arch/z80/src/common/up_initialstate.c +++ b/arch/z80/src/z80/z80_initialstate.c @@ -1,5 +1,5 @@ /**************************************************************************** - * common/up_initialstate.c + * arch/z80/src/z80/up_initialstate.c * * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/configs/z8encore000zco/include/board.h b/configs/z8encore000zco/include/board.h index 8007523181fcf0d42404a8a71915a393974e9b47..64632bee4f480646c548a8edf9bd7c2070f0e1b9 100644 --- a/configs/z8encore000zco/include/board.h +++ b/configs/z8encore000zco/include/board.h @@ -43,6 +43,18 @@ /**************************************************************************** * Definitions ****************************************************************************/ + +/* LED pattern definitions */ + +#define LED_STARTED 0 +#define LED_HEAPALLOCATE 1 +#define LED_IRQSENABLED 2 +#define LED_STACKCREATED 3 +#define LED_IDLE 4 +#define LED_INIRQ 5 +#define LED_ASSERTION 6 +#define LED_SIGNAL 6 +#define LED_PANIC 7 /**************************************************************************** * Public Functions diff --git a/configs/z8encore000zco/ostest/defconfig b/configs/z8encore000zco/ostest/defconfig index ad5c6a47eaf8126264ccd25797da6c3f3f838ca4..5fa382a59359d2c3cfc375ed99d63e78df59fa06 100644 --- a/configs/z8encore000zco/ostest/defconfig +++ b/configs/z8encore000zco/ostest/defconfig @@ -66,7 +66,7 @@ CONFIG_ARCH_BOARD_Z8ENCORE000ZCO=y CONFIG_BOARD_LOOPSPERMSEC=1250 CONFIG_ENDIAN_BIG=y CONFIG_DRAM_SIZE=65536 -CONFIG_ARCH_LEDS=y +CONFIG_ARCH_LEDS=n # # Z16F specific device driver settings # diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index 7183288cbf659324d1c5b58f81bd4df078c4780a..d14f816c07b3780f9a8b2b058133874f39ccfc37 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -59,9 +59,8 @@ /* Attributes * - * GCC supports weak symbols which can be used to reduce - * code size because unnecessary "weak" functions can be - * excluded from the link. + * GCC supports weak symbols which can be used to reduce code size because + * unnecessary "weak" functions can be excluded from the link. */ # ifndef __CYGWIN__ @@ -77,21 +76,20 @@ # define weak_const_function #endif -/* The noreturn attribute informs GCC that the function will - * not return. - */ +/* The noreturn attribute informs GCC that the function will not return. */ # define noreturn_function __attribute__ ((noreturn)) -/* The packed attribute informs GCC that the stucture elements - * are packed, ignoring other alignment rules. +/* The packed attribute informs GCC that the stucture elements are packed, + * ignoring other alignment rules. */ # define packed_struct __attribute__ ((packed)) -/* GCC does not support the reentrant attribute */ +/* GCC does not support the reentrant or naked attributes */ # define reentrant_function +# define naked_function /* GCC has does not use storage classes to qualify addressing */ @@ -158,6 +156,10 @@ # define noreturn_function # define packed_struct +/* SDCC does support "naked" function s*/ + +# define naked_function __naked + /* The reentrant attribute informs SDCC that the function * must be reentrant. In this case, SDCC will store input * arguments on the stack to support reentrancy. @@ -249,10 +251,11 @@ # define weak_function # define weak_const_function -/* The Zilog compiler does not support the noreturn or packed attributes */ +/* The Zilog compiler does not support the noreturn, packed, or naked attributes */ # define noreturn_function # define packed_struct +# define naked_function /* The Zilog compiler does not support the reentrant attribute */ @@ -317,6 +320,8 @@ # define noreturn_function # define packed_struct # define reentrant_function +# define naked_function + # define FAR # define NEAR