This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Cant allocate memory



Hi,

I am facing some issue related to the memory allocation.

Please refer the below details.

APP_L01SARAM(RW)    : origin = 0x008000, length = 0x2000

error: can't allocate DataVarSectn, size 00000546 (page 1) in
APP_L01SARAM (avail: 0000054c)
>> error: errors in input -

Can you please help me to resolve this issue?.

Thanks

Vishnu

  • Vishnu,

    The error message is saying that the section will not fit in the specified memory block.  Although it looks like there is enough room (section size of 0x546 words and available 0x54c words), there is probably alignment words wasted and therefore it won't fit.

    You need to adjust your linker command file to either link the section to a different memory, or free up some space in the specified memory by moving another section to an alternate memory.

    Regards,

    David

  • Hi David,

    Thanks for your reply.

    I did the same procedure you mentioned.

    It solved for the time being but after adding few other variables the same error is popping up with different 

    section size.

    I am completely stcuk at this point.

    Can you please provide me some approach wherein i can investigate more on this issue?.

    Thanks

    Vishnu

  • Vishnu,

    It's all in the linker .cmd file.  You need to have enough room in the memory block to fit the sections that you are linking to it.  You can combine contiguous physical memory blocks in the linker .cmd file into larger blocks to make larger section sizes fit.  Otherwise, you need to juggle things around to get them to fit in the memory that you've defined.

    Something I do to work through such issues is define a very large dummy memory block in the linker command.  Just stick it at some address where no other memory exists in the memory map (e.g., way up at some high address).  I then link the section that is causing the error to this dummy memory.  I then do a build.  The build should now work (but of course you cannot run the code on hardware because the dummy memory doesn't really exist -- it was just for build purposes).  With the build now successful, you can examine the .map file output by the linker to see how much memory is available and in which memory blocks.  You can then move things around in the .cmd file to make them fit.

    Good luck,

    David