From efc2cf23a849f7be1d65c4cdd7767f88917c46a7 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 21 Feb 2007 21:55:16 +0000 Subject: Progress toward clean SDCC compilation git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@18 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/sim/src/Makefile | 11 +++++++---- nuttx/arch/sim/src/up_createstack.c | 9 +++++---- nuttx/arch/sim/src/up_head.c | 4 ++-- nuttx/arch/sim/src/up_usestack.c | 9 +++++---- 4 files changed, 19 insertions(+), 14 deletions(-) (limited to 'nuttx/arch/sim/src') diff --git a/nuttx/arch/sim/src/Makefile b/nuttx/arch/sim/src/Makefile index 780cff596..53b4c6a7e 100644 --- a/nuttx/arch/sim/src/Makefile +++ b/nuttx/arch/sim/src/Makefile @@ -49,7 +49,7 @@ COBJS = $(CSRCS:.c=.o) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -all: up_head.o libarch.a +all: up_head.o libarch$(LIBEXT) $(AOBJS): %.o: %.S $(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@ @@ -57,8 +57,11 @@ $(AOBJS): %.o: %.S $(COBJS) up_head.o: %.o: %.c $(CC) -c $(CFLAGS) $< -o $@ -libarch.a: $(OBJS) - $(AR) rcs $@ $(OBJS) +libarch$(LIBEXT): $(OBJS) + ( for obj in $(OBJS) ; do \ + $(AR) $@ $${obj} || \ + { echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \ + done ; ) .depend: Makefile $(SRCS) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @@ -67,7 +70,7 @@ libarch.a: $(OBJS) depend: .depend clean: - rm -f libarch.a *.o *~ + rm -f libarch$(LIBEXT) *.o *~ distclean: clean rm -f Make.dep .depend diff --git a/nuttx/arch/sim/src/up_createstack.c b/nuttx/arch/sim/src/up_createstack.c index 0e2c63e4d..845c76661 100644 --- a/nuttx/arch/sim/src/up_createstack.c +++ b/nuttx/arch/sim/src/up_createstack.c @@ -81,14 +81,14 @@ * ************************************************************/ -STATUS up_create_stack(_TCB *tcb, uint32 stack_size) +STATUS up_create_stack(_TCB *tcb, size_t stack_size) { STATUS ret = ERROR; /* Move up to next even word boundary if necessary */ - uint32 adj_stack_size = (stack_size + 3) & ~3; - uint32 adj_stack_words = adj_stack_size >> 2; + size_t adj_stack_size = (stack_size + 3) & ~3; + size_t adj_stack_words = adj_stack_size >> 2; /* Allocate the memory for the stack */ @@ -97,9 +97,10 @@ STATUS up_create_stack(_TCB *tcb, uint32 stack_size) { /* This is the address of the last word in the allocation */ - uint32 *adj_stack_ptr = &stack_alloc_ptr[adj_stack_words - 1]; + size_t *adj_stack_ptr = &stack_alloc_ptr[adj_stack_words - 1]; /* Save the values in the TCB */ + tcb->adj_stack_size = adj_stack_size; tcb->stack_alloc_ptr = stack_alloc_ptr; tcb->adj_stack_ptr = adj_stack_ptr; diff --git a/nuttx/arch/sim/src/up_head.c b/nuttx/arch/sim/src/up_head.c index 9d1ccf153..1fc705b5b 100644 --- a/nuttx/arch/sim/src/up_head.c +++ b/nuttx/arch/sim/src/up_head.c @@ -64,13 +64,13 @@ int main(int argc, char **argv, char **envp) return 0; } -void up_assert(const ubyte *filename, uint32 line) +void up_assert(const ubyte *filename, int line) { fprintf(stderr, "Assertion failed at file:%s line: %d\n", filename, line); longjmp(sim_abort, 1); } -void up_assert_code(const ubyte *filename, uint32 line, uint16 code) +void up_assert_code(const ubyte *filename, int line, int code) { fprintf(stderr, "Assertion failed at file:%s line: %d error code: %d\n", filename, line, code); longjmp(sim_abort, 1); diff --git a/nuttx/arch/sim/src/up_usestack.c b/nuttx/arch/sim/src/up_usestack.c index 26bf14b21..0c6e7650f 100644 --- a/nuttx/arch/sim/src/up_usestack.c +++ b/nuttx/arch/sim/src/up_usestack.c @@ -81,18 +81,19 @@ * ************************************************************/ -STATUS up_use_stack(_TCB *tcb, uint32 *stack, uint32 stack_size) +STATUS up_use_stack(_TCB *tcb, void *stack, size_t stack_size) { /* Move up to next even word boundary if necessary */ - uint32 adj_stack_size = stack_size & ~3; - uint32 adj_stack_words = adj_stack_size >> 2; + size_t adj_stack_size = stack_size & ~3; + size_t adj_stack_words = adj_stack_size >> 2; /* This is the address of the last word in the allocation */ - uint32 *adj_stack_ptr = &stack[adj_stack_words - 1]; + size_t *adj_stack_ptr = &stack[adj_stack_words - 1]; /* Save the values in the TCB */ + tcb->adj_stack_size = adj_stack_size; tcb->stack_alloc_ptr = stack; tcb->adj_stack_ptr = adj_stack_ptr; -- cgit v1.2.3