I now have an "official" answer from avr@atmel.com as follows: > On new devices is the stack pointer initialized to REMEND at reset, and you don't need to do that in your code. > Please see the datasheet of the device you're using. > I'll update the FAQ. > > Best regards > Jan HÃ¥vard Ugelstad > Atmel AVR Technical Support > As pointed out in my original query, the "datasheet" is in conflict with itself and should be cleaned up considerably in this area. Looking at other recent AVR parts datasheets (mega48/88/168 series for example), they are all incorrect and confusing. Thanks to everyone on this list who replied and confirmed what I thought was true. And in my case of code for a tiny45 bootloader (fitting into 64 words), I don't need to worry about finding two more words (besides the two I already have) to init the stack pointer. Don Don AE5K wrote: > As a longtime user of micros (since the Intel 4004), I know about the > necessity of initializing the stack pointer in those devices which have it. > > However, some of the most recent Atmel datasheets (for example > doc2586.pdf, 2586F dated 4/06 on the tiny 25/45/85) lead me to believe > that Atmel has gone the way of initializing the stack pointer to the top > of SRAM at reset/powerup time. In this doc (2586F), paragraph 5.6.1 > shows the "Initial Value" to be "RAMEND". > > This is great if true, BUT in the paragraph above it (par. 5.6) it says > "This Stack space in the data SRAM must be defined by the program before > any subroutine calls are executed or interrupts are enabled. The Stack > Pointer must be set to point above 0x60." > > Also an answer to FAQ on the Atmel website that I read says "For all AVR > devices with SRAM the stack pointer must be set to point at the last > address in SRAM." [I should note that this is not exactly true -- it > can be set anywhere in SRAM, just as long as there is enough room in > SRAM addresses below it to accommodate anything pushed on the stack!] > > So the question is "Which is correct?" Is the stack pointer in these > newer devices initialized as shown so that the programmer does not need > to do the initialization? > > Regards, > Don >
Message
Re: [AVR-Chat] Stack Pointer - documentation conflict? -- resolved
2006-04-06 by Don AE5K
Attachments
- No local attachments were found for this message.