[En-Nut-Discussion] Heap Memory on STM32F4

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Wed Apr 2 11:04:06 CEST 2014

>>>>> "Harald" == Harald Kipp <harald.kipp at egnite.de> writes:

    Harald> Hi Holger, your post was rejected by the mailing list processor
    Harald> because of it size.  Please do not post large company logos in
    Harald> mailing lists. I manually approved your post, but it still
    Harald> doesn't appear in my list folder. Mhhh...

Also not visible here.

    Harald> I'll answer to the rejected message:

    Harald> On 01.04.2014 10:24, holger mai wrote:
    >> now i have up and running NutOS on an Olimex STM32-E407 Board.
    >> Ethernet works, but the system Memory is only 4096 kB. The debug
Was this really kB or Bytes?

    >> says:
    >> 114688 bytes RAM total 3472 bytes free

    Harald> Should be much more.

    >> NUTMEM_SIZE = "114688" NUTMEM_START = "0x02000000"

    Harald> The size looks a bit weird, but that shouldn't cause the
    Harald> problem.

The F4xx has 112 kByte general purpose SRAM0 , another block of 16 kByte
SRAM1, 64 kB of Core-Coupled RAM CCM1 and the F42/3x another block of 64
kByte SRAM3. The linker script maps SRAM1 as DMA  and eventual SRAM2.

Sorry, the names in the linker script collide with the name in the reference
manual (rm0090, SRAM1 <-> SRAM0, SRAM2 <-> SRAM1,  SRAM3 <-> SRAM2)
The definition is as follows:

#define FLASH_BASE       ((uint32_t)0x08000000) /*!< FLASH(up to 1 MB)*/
#define CCMDATARAM_BASE  ((uint32_t)0x10000000) /*!< CCM(core coupled memory) data RAM(64 KB)  */
#define SRAM1_BASE       ((uint32_t)0x20000000) /*!< SRAM1(112 KB) */
#define SRAM2_BASE       ((uint32_t)0x2001C000) /*!< SRAM2(16 KB) */
#define SRAM3_BASE       ((uint32_t)0x20020000) /*!< SRAM3(64 KB) */
I didn't understand fully the implication of using any of this areas. 
So at the moment only 112 kByte are used, as I wanted to be on the safe
side. Patches adding more intelligence to the linker script are welcome.


    Harald> Aha, you experienced other problems as well, right?

    Harald> First examine your linker map file to see, whether a large
    Harald> memory block at 0x02xxxxxx.

    Harald> If nothing suspicious can be found, you can look to the Nut/OS
    Harald> Software Manual about how to debug heap memory.

    >> In the linkerscript (stm32f10x_flash.ld & stm32f405xG_flash.ld ) the
    >> .heap section is commented out. If i uncomment this, it procuces a
    >> linker error, .heap exceeds RAM-Size.

Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

More information about the En-Nut-Discussion mailing list