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.

Integer division does not work in ccs6.1.0

Other Parts Discussed in Thread: TMS320F28027

I am programming chip TMS320F28027, PROBE: xds100v2 usb emulator, software: CCS6.1.0.

my problem is Integer division does not work. I defined 3 intergers, a, b, c. a=2424072, b=4095, program can not get results of c=a/b.

my code is :

int32 c=0;

int32 a=0;

int32 b=0;

a=2424072;

b=4095;

c=a/b; program stuck here.

later on, I set b=2, my program can not calculate c=a/b;

later on, I set c=10*40950/b; the program stuck here too.

I am wondering what is wrong with the program. 

are there any compile settings are not right?

also, the program is proved to be working by other users. why it stuck in my system?

Thank you.

Zhiyang

  • Zhiyang,

    Can you start by confirming your compiler optimizer is turned off? If variables aren't used later in the program sometimes the optimizer will remove them.

    If that's not it, can you elaborate on "program stuck here" - what exactly happens when you single-step through the program?

    Regards,

    Richard
  • Hi, Richard,

    Thank you for your reply.

    I double checked the optimizer of compiler, it is turned-off. see image below.

    program "stuck" means the program is not move forward. debug window shows the program is running, however, the program stay that condition forever, and don't move to the next instruction. before program runs into integer division, program status is all right, see image below.

    During the integer division execution, the program status is running forever, for a couple of hours. see image below.

    as you see, the related information about the program is not shown in debug window any more.

    Thanks.

    Zhiyang

  • Zhiyang,

    Thanks for the additional information. It's strange - almost like you have a break-point there. If you move just the division line to a different part of the program, does the behavior follow the line?

    Regards,

    Richard
  • Hi, Richard,

    yes, if I move the division to another line, program will be trapped in the new line of the integer division.

    Thanks.

    Zhiyang
  • Zhiyang,

    Thanks.  Could you post the assembly instructions at that line please?  

    In the Debug perspective in CCS, select "View -> Disassembly" and run to the offending line in the program.  Then post the contents of that window.

    Also, could you let me know which compiler version you have?

    In CCS, select "Help -> About Composer Studio -> Installation Details (button)", then I need the number next to "C2800 Compiler Tools".

    Regards,

    Richard

  • Hi, Richard,

     

    Thank you a lot for your help.

     

    Here, in my code, the integer division expression is: t_off=10*40950/Vaux; (Vaux=4095, as shown in expression window.)

     

    Below is the window before execution the line: t_off=10*40950/Vaux;

    After the execution of the line: t_off=10*40950/Vaux;

    Assembly code runs to nowhere, as shown in figure below. The assembly code window is totally empty. No line number, no code, no content.


    About the compiler, it is the shown below. The version is 6.4.2.

     

    I suspect the problem might come from unstable workspace directory. The code was proved to be working my other people before delivered to me. It should not have problem like this.

     

    Also, this specific line of code was able to be executed before in my system. I changed to a new workspace folder in order to remove problems of CCS6.1 (at that time, the debugger “resume” button and other auto run functions do not work). After I changed workspace folder, debugger “resume” button works, but this line does not work.

     

    I do not exactly know how to select workspace of CCS. keep changing work space until all problems are fixed?

    I appreciate your feedbacks.

     

    Zhiyang

  • I found that the program can run through the integer division line if I keep clicking the button "assembly step into".
    if I click regular "step into", this line can not be finished.
    The difficulty only exists in c language debugging.

    it is weird.
  • Zhiyang,

    Yes, it is weird. Let me ask around in case anyone else has seen something similar.

    Can you try this: in the Debug perspective in CCS, select "Tools -> Debugger Options -> Mics/Other Options".  Then un-check the box that says "Allow software breakpoints to be used".  Save your work, then close and re-start CCS.  Does that change anything?

    Regards,

    Richard