EmbDev.net

Forum: ARM programming with GCC/GNU tools newbie questions about memory allocation


Author: Sergio d. Reyes (sdplox)
Posted on:

Rate this post
0 useful
not useful
Hi everibody, thanks for reading..

im newbie with GNU-ARM and i want to compile my first project and test
it in my machine, ARM7, so i need personalize the makefile, i searched
other makefiles to learn how to do one, and after read many of them, i
found that the changes on memory allocation, "always"(in the projects
that i see, always) are here:

------------------------+
FIQ_STACK_SIZE = 0x0100;|
IRQ_STACK_SIZE = 0x0100;|
ABT_STACK_SIZE = 0x0100;|  <---- all of this block remains unchangeable
but i
UND_STACK_SIZE = 0x0100;|        have my doubts :S
SVC_STACK_SIZE = 0x0400;|
------------------------+

MEMORY
{
  ram : org = 0x20000000, len = 64k <---OK, only this changed
}


:S, my memory machine specs are:
-----------------------------------------------start
here--------------------
SRAM :
0x080FFFFF 0x08081000 user AP <---- here i must put my app
0x08080FFF 0x08080000 PM      <---- application manager, i must not
touch it
0x0807FFFF 0x08070000 Stack
0x0806FFFF 0x08040000 System buffer
0x0803FFFF 0x08022000 OS
0x08021FFF 0x08000000 System used



FLASH:
0x003FFFFF 0x00210000 User’s AP <---here too, this is the source, in the
other
                                    ocurrence i store the variables i
think.
0x0020FFFF 0x00200000 PM        <---- application manager, i must not
touch it
0x001FFFFF 0x000B0000 Font & Buffer
0x000AFFFF 0x00080000 System F/W
0x0007FFFF 0x00010000 OS
0x0000FFFF 0x00000000 System used
--------------------------------------------------ends
here-------------------


so i dont know what to do, the argument above in:

MEMORY
{
  ram : org = 0x20000000, len = 64k
}

only specs one memory... i have 2... and one is sram, and other flash...

what must i to do?

Thanks for reading, whatever info is very useful for me please post your
answer, im really afraid about the lost of time :(

Author: Martin Thomas (mthomas) (Moderator)
Posted on:

Rate this post
0 useful
not useful
Sergio d. Reyes wrote:
> MEMORY
> {
>   ram : org = 0x20000000, len = 64k
> }
>
> only specs one memory... i have 2... and one is sram, and other flash...
>
> what must i to do?

include a the 2nd section in the linker script, i.e.

MEMORY
{
  flash : org = 0xXXXXXXXX, len = 0xXXXXXX
  ram   : org = 0x20000000, len = 64k
}

and use the ">flash" at the end of a linker-section (i.e. .text) to
select the memory-section. But you should give some more details. Do you
want your user-application to run from flash or RAM? For "run from
flash" you can use the approach described above. Keep in mind that that
non-zero initial values of variable have to be copied from Flash to RAM
and the address-range which holds the variable which are expected to
init with zero most be filled with zeros (usualy done in the
startup-code). If the user-app should run from RAM (implied by "here i
must put my app") it's a little different since you have to copy the
code from a "persistent" storage (flash) to the memory where it should
be executed (RAM) too. Maybe this is done by a "loader" from your OS,
but wíthout further information it's difficult to help. Anyway, search
for the GNU binutils-manuals and read the linker-manual (ld), it
explains how to place sections at specific LMAs/VMAs.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.