[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] avr-size .bss bigger than RAM?
From: |
Matt.Vandewerken |
Subject: |
Re: [avr-chat] avr-size .bss bigger than RAM? |
Date: |
Tue, 25 Jul 2017 22:43:02 +0000 |
I'm not sure that you can determine how big the stack is (nor can you constrain
it). In the AVR, the stack grows unconstrained downwards from the top of RAM.
See here: http://www.nongnu.org/avr-libc/user-manual/malloc.html for an
explanation of the memory sections in the AVR.
If you're running an RTOS you can often allocate/specify where the stacks for
each process reside, and how big they are, but you can't actually constrain
them to always fit within that space so you have to be careful to allocate
enough space for them.
-----Original Message-----
From: AVR-chat [mailto:address@hidden On Behalf Of Stuart Longland
Sent: Wednesday, 26 July 2017 8:11 AM
To: address@hidden
Subject: Re: [avr-chat] avr-size .bss bigger than RAM?
On 25/07/17 22:36, Rolf Pfister wrote:
> I would say it uses more than 29 bytes too much. Because data also
> needs SRAM. And subroutine calling and interrupts will also need some
> bytes of SRAM for the stack.
> Maybe you didn't see something going wrong yet because it didn't fill
> all reserved data structures yet.
Right… I was a bit surprised that it would allow such a program to link.
arm-ld complains when the data structures won't fit into the spaces allocated
by the linker script.
I did another check, and found one of my structures occupied the full
512 bytes, so I've cut it back, .bss is now 279 bytes.
Often the code will define a big integer array somewhere and call that the
stack, so you know exactly where it is and how big it is. AVR though, all that
is abstracted.
Anyone know where I can find out how much RAM is allocated for stack on AVR?
--
Stuart Longland (aka Redhatter, VK4MSL)
I haven't lost my mind...
...it's backed up on a tape somewhere.