Add logic to init global data on bootup
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@473 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
b6f43e7144
commit
c2c6b55515
7
TODO
7
TODO
@ -17,7 +17,7 @@ NuttX TODO List (Last updated December 13, 2007)
|
||||
(0) ARM/C5471 (arch/arm/src/c5471/)
|
||||
(1) ARM/DM320 (arch/arm/src/dm320/)
|
||||
(2) ARM/LPC214x (arch/arm/src/lpc214x/)
|
||||
(3) pjrc-8052 / MCS51 (arch/pjrc-8051/)
|
||||
(4) pjrc-8052 / MCS51 (arch/pjrc-8051/)
|
||||
(0) z80 (arch/z80/)
|
||||
|
||||
o Task/Scheduler (sched/)
|
||||
@ -306,6 +306,11 @@ o pjrc-8052 / MCS51 (arch/pjrc-8051/)
|
||||
Status: Open
|
||||
Priority: Medium
|
||||
|
||||
Description Global data is not being initialized. Logic like that of SDCCs
|
||||
crt0*.s needs to be incorporated into the system boot logic
|
||||
Status: Open
|
||||
Priority: Low -- only because there as so many other issues with 8051
|
||||
|
||||
o z80 (arch/z80)
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -126,12 +126,8 @@ $(COBJS): %$(OBJEXT): %.c
|
||||
|
||||
$(SDCCLIBDIR)/myz80.lib: $(SDCCLIBDIR)/$(SDCCLIB)
|
||||
@cat $(SDCCLIBDIR)/$(SDCCLIB) | \
|
||||
grep -v calloc | grep -v malloc | grep -v realloc | \
|
||||
grep -v free | grep -v getenv | grep -v vprintf | \
|
||||
grep -v sprintf | grep -v _strncpy | grep -v _strchr | \
|
||||
grep -v _strlen | grep -v _strcmp | grep -v _strcpy | \
|
||||
grep -v _memcmp | grep -v _memcpy | grep -v _memset | \
|
||||
grep -v crt0 \
|
||||
grep -v alloc | grep -v free | grep -v printf | \
|
||||
grep -v _str | grep -v _mem | grep -v crt0\.o \
|
||||
> myz80.lib
|
||||
@sudo mv -f myz80.lib $(SDCCLIBDIR)/myz80.lib
|
||||
|
||||
@ -149,6 +145,13 @@ up_mem.h:
|
||||
@echo "#endif /* __ARCH_MEM_H */" >>up_mem.h
|
||||
|
||||
asm_mem.h:
|
||||
@echo " UP_COMPILER_OTHER == 0" > asm_mem.h
|
||||
@echo " UP_COMPILER_SDCC == 1" >> asm_mem.h
|
||||
ifeq ($(CC),sdcc)
|
||||
@echo " UP_COMPILER == 1" >> asm_mem.h
|
||||
else
|
||||
@echo " UP_COMPILER == 0" >> asm_mem.h
|
||||
endif
|
||||
@echo " UP_STACK_END == ($(CONFIG_DRAM_SIZE) - 1)" >> asm_mem.h
|
||||
@echo " UP_STACK_BASE == (UP_STACK_END - $(CONFIG_PROC_STACK_SIZE))" >> asm_mem.h
|
||||
@echo " UP_HEAP1_END == (UP_STACK_END - $(CONFIG_PROC_STACK_SIZE) - 1)" >> asm_mem.h
|
||||
@ -170,7 +173,8 @@ board/libboard$(LIBEXT):
|
||||
# This target builds the final executable
|
||||
|
||||
pass1.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboard$(LIBEXT)
|
||||
@echo "-k $(BOARDDIR)" >pass1.lnk # Path to board library
|
||||
@echo "--" >pass1.lnk # Non-interactive
|
||||
@echo "-k $(BOARDDIR)" >>pass1.lnk # Path to board library
|
||||
@echo "-k $(SDCCLIBDIR)" >>pass1.lnk # Path to SDCC z80 library
|
||||
@echo "-l libboard$(LIBEXT)" >>pass1.lnk # Name of board library
|
||||
@for LIB in $(LINKLIBS); do \
|
||||
@ -180,8 +184,9 @@ pass1.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboar
|
||||
@echo "-b START=0" >>pass1.lnk # Start of START area
|
||||
@echo "-b _CODE=256" >>pass1.lnk # Start of _CODE area
|
||||
@echo "-i" >>pass1.lnk # Intel hex format
|
||||
@echo "-m" >>pass1.lnk # Generate a map file
|
||||
@echo "-j" >>pass1.lnk # Generate a symbol file
|
||||
@echo "-x" >>pass1.lnk # Hexadecimal
|
||||
@echo "-m" >>pass1.lnk # Generate a map file
|
||||
@echo "-j" >>pass1.lnk # Generate a symbol file
|
||||
@echo "pass1.ihx" >>pass1.lnk # Path to head object
|
||||
@echo "$(HEAD_AOBJ)" >>pass1.lnk # Path to head object
|
||||
@echo "-e" >>pass1.lnk # End of script
|
||||
@ -192,7 +197,8 @@ pass1.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboar
|
||||
@$(MAKE) TOPDIR=$(TOPDIR) $(HEAD_AOBJ)
|
||||
|
||||
nuttx.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboard$(LIBEXT)
|
||||
@echo "-k $(BOARDDIR)" >nuttx.lnk # Path to board library
|
||||
@echo "--" >nuttx.lnk # Non-interactive
|
||||
@echo "-k $(BOARDDIR)" >>nuttx.lnk # Path to board library
|
||||
@echo "-k $(SDCCLIBDIR)" >>nuttx.lnk # Path to SDCC z80 library
|
||||
@echo "-l libboard$(LIBEXT)" >>nuttx.lnk # Name of board library
|
||||
@for LIB in $(LINKLIBS); do \
|
||||
@ -202,6 +208,7 @@ nuttx.ihx: up_mem.h asm_mem.h $(SDCCLIBDIR)/myz80.lib $(HEAD_AOBJ) board/libboar
|
||||
@echo "-b START=0" >>nuttx.lnk # Start of START area
|
||||
@echo "-b _CODE=256" >>nuttx.lnk # Start of _CODE area
|
||||
@echo "-i" >>nuttx.lnk # Intel hex format
|
||||
@echo "-x" >>nuttx.lnk # Hexadecimal
|
||||
@echo "-m" >>nuttx.lnk # Generate a map file
|
||||
@echo "-j" >>nuttx.lnk # Generate a symbol file
|
||||
@echo "nuttx.ihx" >>nuttx.lnk # Path to head object
|
||||
|
@ -67,7 +67,7 @@
|
||||
; Reset entry point
|
||||
;**************************************************************************
|
||||
|
||||
.area START (ABS)
|
||||
.area _HEADER (ABS)
|
||||
.org 0x0000
|
||||
|
||||
di ; Disable interrupts
|
||||
@ -162,17 +162,31 @@
|
||||
; System start logic
|
||||
;**************************************************************************
|
||||
|
||||
_up_reset:
|
||||
_up_reset::
|
||||
; Set up the stack pointer at the location determined the Makefile
|
||||
; and stored in asm_mem.h
|
||||
|
||||
ld SP, #UP_STACK_END ; Set stack pointer
|
||||
jp _os_start ; jump to the OS entry point
|
||||
forever:
|
||||
jp forever
|
||||
|
||||
; Performed initialization unique to the SDCC toolchain
|
||||
|
||||
call gsinit ; Initialize the data section
|
||||
|
||||
; Then start NuttX
|
||||
|
||||
call _os_start ; jump to the OS entry point
|
||||
|
||||
; NuttX will never return, but just in case...
|
||||
|
||||
_up_halt::
|
||||
halt ; We should never get here
|
||||
jp _up_halt
|
||||
|
||||
;**************************************************************************
|
||||
; Common Interrupt handler
|
||||
;**************************************************************************
|
||||
|
||||
_up_rstcommon:
|
||||
_up_rstcommon::
|
||||
; Create a register frame. SP points to top of frame + 4, pushes
|
||||
; decrement the stack pointer. Already have
|
||||
;
|
||||
@ -241,10 +255,29 @@ _up_rstcommon:
|
||||
ex af, af' ; Restore AF (before enabling interrupts)
|
||||
ei ; yes
|
||||
reti
|
||||
nointenable:
|
||||
nointenable::
|
||||
ex af, af' ; Restore AF
|
||||
reti
|
||||
|
||||
;**************************************************************************
|
||||
; Ordering of segments for the linker (SDCC only)
|
||||
;**************************************************************************
|
||||
|
||||
.area _HOME
|
||||
.area _CODE
|
||||
.area _GSINIT
|
||||
.area _GSFINAL
|
||||
|
||||
.area _DATA
|
||||
.area _BSS
|
||||
.area _HEAP
|
||||
|
||||
;**************************************************************************
|
||||
; Global data initialization logic (SDCC only)
|
||||
;**************************************************************************
|
||||
|
||||
.area _GSINIT
|
||||
gsinit::
|
||||
.area _GSFINAL
|
||||
ret
|
||||
|
||||
|
@ -49,6 +49,7 @@
|
||||
; up_restoreusercontext
|
||||
;**************************************************************************
|
||||
|
||||
.area _CODE
|
||||
_up_restoreusercontext:
|
||||
; On entry, stack contains return address (not used), then address
|
||||
; of the register save structure
|
||||
|
@ -62,7 +62,7 @@
|
||||
; Name: up_saveusercontext
|
||||
;*************************************************************************
|
||||
|
||||
; .area _CODE (ABS,OVR)
|
||||
.area _CODE
|
||||
_up_saveusercontext:
|
||||
; Set up a stack frame
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user