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.

MSP430 CC 4.1.5 and 4.2.3 question regarding .text and program allocation

Other Parts Discussed in Thread: MSP430F5342, CSD

I noticed I got a few strange errors (.cinit couldn't find a home if FLASH) I have the LARGE model set for both data and code space so I changed the file lnk_msp430f5342.cmd and put FLASH2 for allocating .cinit.


Easy right? Well now I'm puzzled is .text contiguously allocated or will the linker split it between FLASH and FLASH2 (in my possibly vain hopes I guess). Just a bit nervous as my FLASH space is 99% with that small move and my const is only 4226. So I'm pretty sure I can and will overrun the code space in FLASH and need to flood into FLASH2. (I have 9K statically allocated in FLASH2).

Also if the latter is the case (it floods into FLASH2) would it be a good or bad idea for the ISR functions to call another function if the code for the ISR gets a bit more than a few bytes (the biggest currently is 106 bytes and that makes me nervous as well).

Thanks for any input!

Stephen

  • That particular linker command file uses the split operator (">>") to indicate that .text may be split between FLASH and FLASH2.  I would not expect any problems with your proposed change, as long as you are using large data model and large code model.

  • To be certain of my comments, I need to see a few of the lines from the linker command file you are using.  Just because it is easier, please attach the entire file to your next post.

    Stephen Phillips1 said:
    is .text contiguously allocated or will the linker split it between FLASH and FLASH2

    Probably so.  I need to see your link command file to be sure.

    Stephen Phillips1 said:
    Also if the latter is the case (it floods into FLASH2) would it be a good or bad idea for the ISR functions to call another function if the code for the ISR gets a bit more than a few bytes (the biggest currently is 106 bytes and that makes me nervous as well).

    I'm sorry, but I just don't understand what you are asking here.

    Thanks and regards,

    -George

  • George Mock said:

    To be certain of my comments, I need to see a few of the lines from the linker command file you are using.  Just because it is easier, please attach the entire file to your next post.

    Done

    George Mock said:

    is .text contiguously allocated or will the linker split it between FLASH and FLASH2

    Probably so.  I need to see your link command file to be sure.

    [/quote]

    Indeed it is certainly most uncertain until that is seen

    George Mock said:

    Also if the latter is the case (it floods into FLASH2) would it be a good or bad idea for the ISR functions to call another function if the code for the ISR gets a bit more than a few bytes (the biggest currently is 106 bytes and that makes me nervous as well).

    I'm sorry, but I just don't understand what you are asking here.

    Thanks and regards,

    -George

    [/quote]

    Ok well let me clarify what I was saying:

    I have an ISR (function?) routine that is in the memory area called FLASH does it make sense for that to call a function that is in the .text section (so that it can be anywhere in memory) or just leave the .text:_isr section to itself (I doubt I will have need of greater than 0xBB80 in size for ISR execution just a suspicion),. I was wondering if it would "make sense" to do that or just leave the ISRs too their own FLASH memory.

    I was looking for the syntax information for the link command files, I found a lot of examples but ... no syntax let alone BNF diagrams (hehe).

    The help seemed a little messed up (mostly a cosmetic thing I supposed but it was quite confusing) I found lots of references such as "Section 2.7.1" which would refer to other sections (than what was in quotes) (http://127.0.0.1:1486/help/topic/com.ti.cgt.msp430.4.2.help/MSP430_ALT/ch08.html for example has numerous strange links like this the above goes to http://127.0.0.1:1486/help/topic/com.ti.cgt.msp430.4.2.help/MSP430_ALT/ch08s07.html#STDZ0755410 for example).


    just a side note anyhow. I also noticed it won't accept 'files with the extension cmd so I appended a .txt (message from 'jscript stuff' "Only known URLs and the following file extensions are allowed: 123, 7z, aac, ai, aiff, art, asf, asx, avi, bmp, config, csd, css, db, db, dmg, doc, docx, drw, eml, flac, flv, gif, gz, htm, html, ics, jpeg, jpg, log, m4a, m4p, m4v, mdb, mdbx, mid, midi, mmv, mov, mp3, mp4, mpg, mpp, msg, ogg, pdf, png, pps, ppt, pptx, ps, psd, qt, ram, rar, rm, rtf, sit, sitx, sql, swf, tif, tiff, txt, vcf, vcs, wav, wma, wmv, wpd, wps, xls, xlsx, xml, zip, tsc, tsm, ibs, diff, tar, tar.gz, gel, ccs, cpp, asm, sa, c, cc, sch, ini, cfg, cxx, s, asm, pjt, vsd, sch, pcb, lib, cir, mcd, xmcdz, xmct, jmp, jsl, dat, brd, vsm, h, usb. Please select a valid file or enter a valid URL.").

    Thanks.

    Stephen

  • Because of this line in your linker command file ...

        .text       : {}>> FLASH | FLASH2     /* CODE                              */
    

    The .text section may be split across the FLASH and FLASH2 memory ranges.  If you want more details on section splitting, please see this application note.  

    Stephen Phillips1 said:
    I have an ISR (function?) routine that is in the memory area called FLASH does it make sense for that to call a function that is in the .text section (so that it can be anywhere in memory) or just leave the .text:_isr section to itself (I doubt I will have need of greater than 0xBB80 in size for ISR execution just a suspicion),. I was wondering if it would "make sense" to do that or just leave the ISRs too their own FLASH memory.

    The link command file has this line ...

       .text:_isr  : {} > FLASH              /* ISR CODE SPACE                    */
    

    The effect is that the _isr subsection of .text is allocated to the FLASH memory range.  No part of it will ever go to FLASH2.  I do not know why the isr routines are set aside the like this.  I recommend you ask in the MSP430 forum about that.

    Stephen Phillips1 said:
    I was looking for the syntax information for the link command files, I found a lot of examples but ... no syntax let alone BNF diagrams (hehe).

    The best information is in the linker chapter of the Assembly Language Tools manual you have already found in CCS.  You can also find it online here.

    Stephen Phillips1 said:
    The help seemed a little messed up

    I'd appreciate if you would post a screen shot of that.

    Thanks and regards,

    -George

  • George Mock said:
    The effect is that the _isr subsection of .text is allocated to the FLASH memory range.  No part of it will ever go to FLASH2.  I do not know why the isr routines are set aside the like this.

    The MSP430 interrupt vectors are only 16-bits, so the ISR entry point has to be in the first 64K of memory (FLASH memory range).

  • On screen shot

    note section 2.7.1 is highlighted and notice what it's pointing at. Numerous links like this (interestingly alsol labeled section 2.7.1) seem to be in this section of the documentation. I doubt it was a cut and paste issue. You folks use doxygen to generate the documentation?