From b2c3a559c7701728526026fcd64e85d9004715f2 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 7 Jun 2011 23:37:59 +0000 Subject: First AVR compile git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3681 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/avr/src/atmega/atmega_head.S | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'nuttx/arch/avr/src/atmega') diff --git a/nuttx/arch/avr/src/atmega/atmega_head.S b/nuttx/arch/avr/src/atmega/atmega_head.S index cf834bc70..cd3c194dc 100755 --- a/nuttx/arch/avr/src/atmega/atmega_head.S +++ b/nuttx/arch/avr/src/atmega/atmega_head.S @@ -46,8 +46,20 @@ * Pre-processor definitions ****************************************************************************/ +/* Stack is allocated just after .bss and before the heap */ + #define STACKBASE (_ebss+CONFIG_IDLETHREAD_STACKSIZE-4) +/* The RAMPZ register is only available for CPUs with more than 64Kb of FLASH. + * At present, only the ATMega128 is supported so RAMPZ should always be + * available. + * + * - Support for the EPLMX instructions is assumed if RAMPZ is present + * - If RAMPZ is not present, support for LPMX is assumed + */ + +#define HAVE_RAMPZ 1 + /**************************************************************************** * External Symbols ****************************************************************************/ @@ -174,6 +186,7 @@ __start: /* Copy initial global data values from FLASH into RAM */ +#ifdef HAVE_RAMPZ ldi r17, hi8(_edata) ldi r26, lo8(_sdata) ldi r27, hi8(_sdata) @@ -191,6 +204,22 @@ __start: cpi r26, lo8(_edata) cpc r27, r17 brne .Lcopyloop +#else + ldi r17, hi8(_edata) + ldi r26, lo8(_sdata) + ldi r27, hi8(_sdata) + ldi r30, lo8(_eronly) + ldi r31, hi8(_eronly) + rjmp .Lcopystart + +.Lcopyloop: + lpm r0, Z+ + st X+, r0 +.Lcopystart: + cpi r26, lo8(_edata) + cpc r27, r17 + brne .Lcopyloop +#endif /* Clear uninitialized data */ -- cgit v1.2.3