Linker error in GCC

Hi, I am using CodeSourcery’s GCC 4.1.0 compiler to do a port to an ARM7TDMI-based system.  So I took the ARM7_LPC2106_GCC port and am in the process of modifying.  I am trying to compile after some mods and I get a linker error: arm-none-eabi/bin/ld: region ram is full (rtosdemo.elf section .bss) Not sure why this is happening, especially since my board has 4MB of RAM.  I have modified the linker script to reflect the increased RAM but otherwise left it as it was: MEMORY {     flash    : ORIGIN = 0, LENGTH = 512K     ram    : ORIGIN = 0xc0000000, LENGTH = 4M } __stack_end__ = 0xc0000000 + 4M – 4; SECTIONS {     . = 0;     startup : { *(.startup)} >ram     prog :     {         *(.text)         *(.rodata)         *(.rodata*)         *(.glue_7)         *(.glue_7t)     } >ram     __end_of_text__ = .;     .data :     {         __data_beg__ = .;         __data_beg_src__ = __end_of_text__;         *(.data)         __data_end__ = .;     } >ram     .bss :     {         __bss_beg__ = .;         *(.bss)     } >ram     /* Align here to ensure that the .bss section occupies space up to     _end.  Align after .bss to ensure correct alignment even if the     .bss section disappears because there are no input sections.  */     . = ALIGN(32 / 8); }     . = ALIGN(32 / 8);     _end = .;     _bss_end__ = . ; __bss_end__ = . ; __end__ = . ;     PROVIDE (end = .); In the map file, what looks shady to me is: [snip] .bss           0xc0006640      0x100 ../../Source/tasks.o                 0xc0006640                pxCurrentTCB .bss           0xc0006740   0x400018 ../../Source/portable/MemMang/heap_2.o COMMON         0xc0406758        0x4 ../Common/Minimal/dynamic.o                 0xc0406758                xSuspendedTestQueue                 0xc040675c                . = ALIGN (0x4)                 0xc040675c                . = ALIGN (0x4)                 0xc040675c                _end = .                 0xc040675c                _bss_end__ = .                 0xc040675c                __bss_end__ = .                 0xc040675c                __end__ = .                 0xc040675c                PROVIDE (end, .) OUTPUT(rtosdemo.elf elf32-littlearm) [snip] What’s weird is there is the line .bss           0xc0006740   0x400018 ../../Source/portable/MemMang/heap_2.o because after this the addresses go beyond the 4MB limit.  Not sure though. Any help is appreciated. james

Linker error in GCC

Are you running your code from RAM? I’m not sure about the line: startup : { *(.startup)} >ram seems you are placing your code above the RAM whereas the lines: MEMORY { flash : ORIGIN = 0, LENGTH = 512K ram : ORIGIN = 0xc0000000, LENGTH = 4M } would seem to put your flash below the RAM?

Linker error in GCC

Even if I comment out the flash memory layout info in the MEMORY section of the linker script, I get the same error.   grr this is frustrating.. Any clues anyone?

Linker error in GCC

Found the problem!  For posterity, the problem was that I set #define configTOTAL_HEAP_SIZE to occupy all 4MB!!  Changed it to smaller and it links ok.