public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Kinetis heap size?
@ 2013-02-28  6:05 Michael Jones
  2013-03-01  9:30 ` [ECOS] " John Dallaway
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Jones @ 2013-02-28  6:05 UTC (permalink / raw)
  To: ecos discuss

I am trying to figure out how the heap size for kinetis K60 is set.

There is a memory layout like below. From my limited knowledge, it appears that the heap is not in a memory section, but instead a fixed size memory in some other section.

What I can't figure out is where the memory size is defined and how to control it. Also, whether mallinfo(...) will return the value of the allocated space or some other value. Basically I want to make it bigger, and to be sure that the amount of heap available reported by mallinfo is correct.

Does anybody know how this works and what files define this? I spend a lot of time with find/grep and came up empty.

Mike

// eCos memory layout

#ifndef __ASSEMBLER__
#include <cyg/infra/cyg_type.h>
#include <stddef.h>

#endif
#define CYGMEM_REGION_ram (0x20000000 - CYGHWR_HAL_KINETIS_SRAM_BANK_SIZE)
#define CYGMEM_REGION_ram_SIZE (CYGHWR_HAL_KINETIS_SRAM_SIZE-CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE)
#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)

#define CYGMEM_REGION_flash (0x00000000)
#define CYGMEM_REGION_flash_SIZE (CYGHWR_HAL_KINETIS_FLASH_SIZE)
#define CYGMEM_REGION_flash_ATTR (CYGMEM_REGION_ATTR_R)

#ifndef __ASSEMBLER__
extern char CYG_LABEL_NAME (__heap1) [];
#endif
#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1))
#define CYGMEM_SECTION_heap1_SIZE (CYGMEM_REGION_ram+CYGMEM_REGION_ram_SIZE - (size_t) CYG_LABEL_NAME (__heap1))

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ECOS] Re: Kinetis heap size?
  2013-02-28  6:05 [ECOS] Kinetis heap size? Michael Jones
@ 2013-03-01  9:30 ` John Dallaway
  0 siblings, 0 replies; 2+ messages in thread
From: John Dallaway @ 2013-03-01  9:30 UTC (permalink / raw)
  To: Michael Jones; +Cc: eCos Discussion

Hi Mike

On 28/02/13 06:04, Michael Jones wrote:

> I am trying to figure out how the heap size for kinetis K60 is set.
> 
> There is a memory layout like below. From my limited knowledge, it
> appears that the heap is not in a memory section, but instead a
> fixed size memory in some other section.
> 
> What I can't figure out is where the memory size is defined and how
> to control it. Also, whether mallinfo(...) will return the value of
> the allocated space or some other value. Basically I want to make
> it bigger, and to be sure that the amount of heap available reported
> by mallinfo is correct.
> 
> Does anybody know how this works and what files define this? I spend
> a lot of time with find/grep and came up empty.

Take a look at the files:

   hal/cortexm/kinetis/var/current/include/pkgconf/mlt*.ldi

Depending on your selection of startup type (CYG_HAL_STARTUP) and
possibly other configuration options, one of these files will be
processed by the C pre-processor during build to generate the eCos
linker script (target.ld).

Note that __heap1 is typically defined as a label following the last of
the linker output sections in the .ldi files. This is the start address
of the heap. So the heap typically occupies the remainder of RAM that
the linker has not allocated to code and data.

If you want to modify the location of the heap, you will need to edit
the .ldi file and possibly also the corresponding .h file (to ensure the
heap size calculation is correct).

mallinfo() should work as expected.

I hope this helps...

John Dallaway
eCos maintainer
http://www.dallaway.org.uk/john

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-01  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-28  6:05 [ECOS] Kinetis heap size? Michael Jones
2013-03-01  9:30 ` [ECOS] " John Dallaway

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).