MSP430: Using INFO sections from C

Comments

6 comments

  • Avatar
    Paul Curtis

    I'm not sure it's possible to do that if you are actually initializing the info segments using data definitions.

    You can always use, e.g. unsigned char GBL_Info_D __at 0x1040 (or wherver info D is...)

    0
    Comment actions Permalink
  • Avatar
    Steve
    I use the INFO memory to hold config which I don't want to lose when reprogramming. The config is held in a structure of type CFG which I defined. Under the definition of CFG in the header file I put volatile CFG cfg __at 0x1000 - you can figure out the address that you need. I can use the cfg structure normally and I can write to it using a function which copies from RAM to an INFO segment. The segment is initiallised using this code when the device is first run. I have a USB FET and in the target properties/loader options I disable SegmentA Erase/Write and turn off Erase All. As this segment is not initialised in the compiler, it is not written to by the download.
    0
    Comment actions Permalink
  • Avatar
    Roy Deabill

    Hi Steve,

    Thanks for the advice, and this is certainly neater than just setting a pointer to the address. I was hoping to use the INFO_D address information from the linker file to set the value. I believe that this was possible with the USB FET in Crossworks 1.4 as there were options in the target configuration to disable eraseing of each specific Flash segment. This seems to have been removed in V2.0

    0
    Comment actions Permalink
  • Avatar
    Steve
    Hi Roy, just a word of warning about turning off Erase All. You may not get a complete download. I have seen the last 512 byte block of my program was not loaded when the last block was not completely filled. That can occur in my system because I have a boot loader in the last 6k of the F149 memory so my program may end at any address below this. I have not checked this on the F2418 where the last block is above 64k. I would be interested to see if you have a similar experience. Steve
    0
    Comment actions Permalink
  • Avatar
    Roy Deabill

    Hi Steve,

    I am working with the MSP430F247. It seems that this may also suffer from a problem when Erase All is turned off.

    I have been working with some code that at times fails to start up correctly, then by including a __no_operation() function or two it suddenly works again. Also swithching between Debug and Release version seems to mak it work again. I have not really been able to tie down what is going on, but I think that it may be due to the Flash not being erased correctly. It does appear that changing the "Erase All" to Yes gets it to work without changing any code.

     

     

    0
    Comment actions Permalink
  • Avatar
    Steve

    Hi Roy,

    the typical symptom is a jump to a point near the end of your program then a jump onto oblivion, but it can be more subtle. I was caught out a couple of days ago when my program size increased by 4 bytes. I only got a few instructions into the startup code before jumping to an infinite loop at the top of memory! The loop counter was set up in R12 but the loop itself used R15. Unfortunately the increase in size caused the call to jump past the mov.w R12,R15 instruction in the older image. I might try padding the image to the next block boundary to see if that forces a complete load. Steve

    0
    Comment actions Permalink

Please sign in to leave a comment.