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.

MSP430F4616: Is there a way to seperate code into two areas of the flash memory.

Part Number: MSP430F4616

Hi ,

 My application code size is small(about 6K). I would like to put most code in the lower portion of flash, but would like a couple of ISR's and a BSL program to reside at higher memory location say starting at  0xA000? Is there an easy way to do that, maybe using a linker directive?

Thanks

  • Hi Jerry,

    Yes you can create specific sections to help partition your memory in a location you specified. You would want to look at the MSP430 Optimizing C/C++ compiler user's guide, it helps give some details on the linker and compiler.

    Specifically I would look at creating and using data sections and/or code sections (See section 4.3.8 and 5.11.30). You can edit the linker file (.cmd file) to help do this.

    Regards,

    Luke

  • Certainly you can but it might be more difficult that you think.

    Compilers have the ability to assign functions to a named section which the linker script can then put in a particular place. But what about library code those functions use? You have no control over that. Worse is that while you can avoid explicit references to library code the compiler can and will call in library code for some operations. The only way to prevent that is to avoid those operations.

  • Thanks Luke and David.

    I tried the #pragma directive and that did exactly what I wanted it to do. What I'm doing is writing a custom BSL(for field upgrades) that will always reside in upper memory with just the functions to read in a TI.txt file from a PC(via a USB bridge IC to Uart) and store it in upper unused memory. Then if it was downloaded correctly (checksums match), I can then erase the lower memory application and move the file data to replace it . I know you have examples of doing exactly this, in Custom BSL , however, it is for different versions of micros and after spending many hours to try and configure it for the 4616  unsuccessfully,  I find it easier to write my own. 

    I will check that no code is being used from the lower memory in the routines I have to do this.

    Thanks Again!

**Attention** This is a public forum