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.

porting code to msp430fr5730

Other Parts Discussed in Thread: MSP430FR5730

Hi,

I am porting FRAM code to msp430fr5730, but i am getting error as : Code cannot fit into available memory. I know fram size of 5730 is 4K, but my code is around 11k.

Is there any way to reduce this size, any thing can we do in makefile? Or its only possible to dump code in 16K fram?

Regards

  • You can trim 7kB off your 11kB code to make it fit in 4kB.

    Or, you can fool the linker so that it would not generate error msg.

  • nikit biraj said:
    Is there any way to reduce this size

    What have you tried so far?

    Have you investigated the compiler's Optimisation settings?

    Have you reviewed your own code for unnecessary bloat?

    http://www.8052.com/forum/read/187553

  • Or, you can fool the linker so that it would not generate error msg.


    Hello,

    How to fool the linker so that i can fit my code?

    What change should i make in settings? May i know

  • Have you investigated the compiler's Optimisation settings?


    I haven't investigated compiler settings.?

    What change should i do to fit my code? Any change in makefile or settings in compiler?

  • nikit biraj said:
    How to fool the linker so that i can fit my code?

    Don't be silly - he was being facetious!

    Think about it: you obviously cannot fit more code than the physical size of the memory!!  Ignoring or disabling the warning will not change that fact!

    nikit biraj said:
    I haven't investigated compiler settings.

    So do that, then!!

    Study your compiler manuals for details.

    What change should i do to fit my code?

    Make it smaller!

    Again, have you reviewed your code?

    Did you study the document in the link I provided?

  • nikit biraj said:
    I know fram size of 5730 is 4K, but my code is around 11k.

    So your code is over twice (nearly three times) the size of the available memory!!?

    Unless there is serious unneeded bloat, that's going to be a tall order...

  • I studied your document. I made few changes in compiler and linker optimization. It dosen't make much difference til i have enough memory.  There's nothing i can change in my code. Everything i want, i have commented out what is not needed, but size is 11K.

    Is there any alternative method in make file or any other file to optimize the code? 

  • Fooling the linker will not help in solving the problem. It is just a joke.

    Tell the linker to generate a link map to see how your current code uses memory.

    Some of the library functions consume a lot of memory. If you do not need the full services of these functions, try to avoid them and use alternatives or do your own.

  • If you've really thoroughly explored all the compiler & linker optimisations, and really can't change the code, and it still takes 11K, then 11K is what it takes - and nothing else can change that.

  • Thank you all for possible reply. Will find solution to this problem.

  • old_cow_yellow said:
    Fooling the linker will not help in solving the problem. It is just a joke.
    Tell the linker to generate a link map to see how your current code uses memory.

    Well, you won't get a map file unless the linker finishes linking. And it refuses to do so.
    So fooling the linker to accept the code size won't make the code fit into the MSP, but it would allow the linekr to generate a map file so you can inspect it.

    It wasn't as much of a joke as you thought :)

    old_cow_yellow said:
    Some of the library functions consume a lot of memory.

    That's why I prefer not using libraries. Hand-trimmed code that exactly does what is needed for a project and does not contain gazillions of ifs switches for all pssible (and unneeded) cases, is much smaller and faster. Especially on MSPs with a low memory count.

**Attention** This is a public forum