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.

Boot from flash issue

Other Parts Discussed in Thread: TMDSDOCK28035, CONTROLSUITE

I am running modified program from controsuite 2XPM_Sensorless in TMDSDOCK28035 using XDS510USB emulator.

I can compile and link and flash, however it boots from Flash and my program runs fine only  if I uncomment the folowing instructions in the original code:

//#ifdef FLASH

MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);

InitFlash();

//#endif //(FLASH)

and

// while (EnableFlag==FALSE)

// {

// BackTicker++;

// }

 

These instructions are there in the original 2XPM_Sensorless.c file.

Can anybody explain what settings I am missing while building the project.

 

  • Chakra,

    Memcopy function and flash initialization function should be executed when running the code from flash. This part of the code copies the flash initialization routine from flash to ram and executes from RAM. This is done because you can't initialize flash from flash.

    Please refer the http://www.ti.com/lit/an/spra958j/spra958j.pdf for more details.

    Regards,

    Manoj

  • Thanks for your response. I understand that, however my question is why do I have to comment "ifdef FLASH" in the program so that MemCopy is executed. Am I not setting the "Flash" flag properly so that this part gets executed ? If not, how can I set this flag 'FLASH' ?

  • Chakra,

    #ifdef FLASH is preprocessor directive. When FLASH is not set the subsequent statements within the #endif are not compiled. I don't have your project / source code. So, I wouldn't be able to tell you which file has that definition. I am pretty sure you should have this definition in one of the soure files in the project.

    Regards,

    Manoj

  • Manoj,

    Thanks for your quick response. I am using 2xPM_Sensorless Project from Controlsuite adn using TMDSDOCK28035 and XDS510USB as emulator. I modified certain things in the original program and was so far running it in the original location in the Controlsuite. However, I had to comment out the commands in the 2xPM_Sensorless.C as following to make it running from FLASH.

    // while (EnableFlag==FALSE)

    // {

    // BackTicker++;

    // }

    Even then, I was happy as things were running fine in the target.

    However, recently I moved my prgrams to a new directory under ControlSuite and had to comment out as following to make the project running:

    //#ifdef FLASH

    //#endif //(FLASH)

    as I said in the previous mail.

    So, commenting out of ifdef was not necessary earlier, why its needed now to make it working with change in directory. I did not modify any file, however some of the settings during compilation and linking could be different than earlier. I need to understand a little bit in depth why this has happened. Since I did not change any source file, this setting is not part of that.

  • Please check what is the value of FLASH variable in CCS?

    -Manoj

  • Manoj,

    Thanks for your help. Eventually, I figured out that there is something called "Predefined Symbols" in the compiler setting and I had to insert "FLASH" as a symbol there and it worked.

    Can you please respond to my question I posted on 10/29 please.