[En-Nut-Discussion] Large Arrays -- automatic change of starting??

Harald Kipp harald.kipp at egnite.de
Mon Feb 10 11:27:41 CET 2003


>
>So, does everyone that needs large global arrays just make a global
>pointer to that same data type, and in NutMain() do the NutHeapAlloc()
>and assign the returned void * to the global pointer var?

Exactly, except that Nut/OS 3.0 now uses main().


>Any ideas on how much space is available for global vars out of the 4k
>after ethernut (ie. the httpd app) takes what it needs?  Is there
>anyway that the compiler could auto-inform of inherently breaking the
>beginning of the SRAM that NutHeapAdd() assumes is available, or maybe
>a flag that NutHeapAdd() uses to know where the end of the
>compiler-used SRAM begins so NutHeapAdd() calculates this automagically
>and doesn't try to share this area with what the compiler has used?

Best way to determine the available static RAM is to check
the map file of the linker. The heap is initialized in nutinit.c
(previous init.c). All external RAM is added to the heap. If you
don't want this, you need to make a local copy of nutinit.c and
modify it.

The initialization makes use of _bss_end, which is defined by the
compiler's runtime lib and points to the end of the global data
area.

Harald




More information about the En-Nut-Discussion mailing list