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.

Cannot run to main

Other Parts Discussed in Thread: MSP430F5419

 Hi,

I'm using Code Composer Studio 4.2.3.00004 to write code for an MSP430F5419 and debugging with an MSP-FETU430IF USB debugger.

I've recently returned to a project that I was working on some time ago and the debugger seems unable to run to main after it's programmed the device. I have allocated some of the flash to run a custom boot loader and to store some config data which means I'm using a modified linker file, but this all used to work so I'm not sure what the problem might be.

Any help woudl be greatly appreciated.

Regards,

Ben

 

  • It seems like it is something to do with my changes to the linker file as if I undo my changes the debugger does run to main. As I said this used to work so I dont really understand.

  • Ben Walpole said:
    It seems like it is something to do with my changes to the linker file as if I undo my changes the debugger does run to main.

    What were these changes that were made to the linker command file?

    When you say the code does not run to main, is it actually running and just doesn't halt at main, or is halted at some other address?

  • The changes I made were to allocate a section of flash for a custom bootloader and a section for some configuration data.

    LOADER :

    origin = 0x5C00, length = 0x0400,

    DEFAULTS :

    origin = 0x6000, length = 0x0200,

    FLASH :

    origin = 0x6200, length = 0x9D80, fill = 0xFFFE

    FLASH2 :

    origin = 0x10000,length = 0x15C00

     

     

     

     

    .defaults

     

     

     

    .loader : {} > LOADER

     

     

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

     

     

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

     

    It seems like the code is running it just doesn't get to main, if I stop it running then it's usally at an address close to main but seems to be stuck. I can only see this in the disassembly it doesnt show where it is in the C code.

  • ummmmm,,,,,maybe it's not the linker file I've tried it again with the original and now it doesn't work with that either.

  • Ok after unchecking the option to run to main and stepping through the disassmebly it seems that after going throught the compiler generated intiaisation code it ends up in a call to memcpy. I'm guessing that beacuse this is accidentle and the parameters being passed in and random then we end up just endlessly looping around the function.

    This is really holding me up now, this exact project used to work fine.

  • I now understand more about how the compiler works, so the call to memcpy is deliberate to intialise global variables in the RAM. I've removed the global variables that needed intialising and that seems to have fixed the problem.

    I still dont understand how this exact code was working and then suddenly wasn't working.