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.

Ctrl-Shift-F causes errors


Hi,

when I edit a file and press Ctrl-Shift-F unintantionally (for Rowley's editor this is the Find command - it's so
difficult to suppress certain habits), the next compilation provides the following errors.

'Invoking: ARM Compiler'
"../mcasp_in.c", line 93: error #20: identifier "AUDIO_BUF_SIZE" is undefined
"../mcasp_in.c", line 119: error #20: identifier "WORD_SIZE" is undefined
"../mcasp_in.c", line 149: error #20: identifier "WORD_SIZE" is undefined
"../mcasp_in.c", line 404: error #20: identifier "MCASP_XSER_RX_SDOUT2" is undefined

The definitions still exist in the source file. Cleanining the project does not solve the problem.
Also, starting CCSv6.01 with the -clean parameter does not help.
But replacing the file leads to a compilation without errors.

What is Ctrl-Shift-F expected to do? According to the help menu it means "Format".
Is there a "CCS6 Users Guide" downloadable? So far I only found one for CCS5 and a Getting Started document for CCS6.

Thank you.

Regards,
Martin H.

  • Martin,

    You are correct that Ctrl-Shift-F is bound to "Format" which is a function of the C/C++ Editor.  The feature just corrects indentation and other style issues.  You can control the settings by going to window->preferences.  Expand C/C++->Code Style->Formatter.

    As far as a traditional users guide, we do not have one.  There is a getting started guide, online help, wiki and training but no users guide.

    Are AUDIO_BUF_SIZE... defined in the mcasp_in.c file or in a header file that is included?  Did the formatter change the style of the include statement?  i.e. maybe change from #include "file.h" to #include <file.h>   I am really curious why the formatter would impact compiling.

    BTW you can change key bindings in the preferences dialog as well.  Just type in keys in the filter at the top right and it will take you there.

    Regards,

    John

  • Hi John,
    thank you for replying.

    There is only 1 include statement
    #include "configEnetEcho.h"
    in mcasp_in.c which contains all the other include statements needed.
    After Ctrl-Shift-F it has not been changed.

    Yes, AUDIO_BUF_SIZE and WORD_SIZE are defined in mcasp_in.c. MCASP_XSER_RX_SDOUT2 is defined in an include
    file.

    Some more testing:
    Before Ctrl-Shift-F (when compilation is still ok) the definition
    #define AUDIO_BUF_SIZE (NUM_SAMPLES_PER_AUDIO_BUF * BYTES_PER_SAMPLE) // in BYTES ....
    is in line 85.

    After performing Ctrl-Shift-F and and searching with Ctrl-F it appears at line 70 (!!!!!!).
    When I then click at the definition to select it, it disappears.
    The single word AUDIO_BUF_SIZE then appears 2 lines up, without "#define" and without the previous comments at
    the end of the line. Clicking AUDIO_BUF_SIZE makes the line disappear.
    Another search (with Ctrl-F) from the beginning of the file again finds it at line 70.


    Ctrl-Shift-F also indents comments with preceding white-spaces like
                                 // test comment
    to the left side:
    // test comment
    That is a feature I don't want (if I should ever use Ctrl-Shift-F intantionally), but I could not find which
    setting is responsible for that. Do you know?

    To change key bindings I had a look at the preferences. The filter at the top LEFT corner did not accept the
    key strokes Ctrl-Shift-F. But the word "Format" led to the place where the settings could be changed. Still I
    could not find how to bind Ctrl-Shift-F to another feature (Search for instance).

    Thank you.

    Regards,
    Martin H.

  • Martin,

    You can change the comment formatting by going to the formatter section in Windows -> Preferences.  Then click on the edit button.

    Next select the comments tab and you can change the settings.

    However I don't think I am seeing the same behavior as you.  For me the comments are not getting whitespaces inserted in front of them.  Maybe my settings are different?

    As far as the keybindings.  It may be a matter of getting the context right.  If I bind Ctrl-Shift-F to the File Search dialog with All Windows set as the context it doesn't work when I am in the editor but when I click in another View it works.  If I set the context to C/C++ Editor then it works.

    Regards,

    John

  • John,

    sorry, my description has not been correct, I am afraid.


    What I meant is that some of my comments have whitespaces in front of them (no code on the same line). When
    Ctrl-Shift-F has been keyed-in these whitespaces are removed and the comments start at the first column, i.e.
    on the very left side. That can look very confusing. The Comment tab of the Formatter only refers to code AND
    comments on one line. No other settings. I have checked this feature and selected "1" for "Minimum distance
    between...", exactly as it can be seen on your screen shot.

    Would it make sense if I send the files mcasp_in.c for investigation to find the reason for the compilation
    errrors? One file before and one after Ctrl+Shift+F has been keyed-in?

    Thank you.

    Regards,
    Martin H.

  • Martin,

    Yes if you could send the .c and any associated .h files that would be great.  I would really like to understand how the formatter causes a build error.

    Regards,

    John

  • Hi John,

    attached please find the file mcasp.123. It is a zip file. Please rename it to macasp.zip before you unpack it.
    It contains
    mcasp_inOK.c, mcasp_inOK.h
    and
    mcasp_inERROR.c, mcasp_inERROR.h
    I changed the name a little bit to make sure they don't get mixed up.

    The whole project is based on the enetEcho example, while mcasp_in.c is derived from the mcasp example
    (AM335X_StarterWare_02_00_01_01).

    Despite of what I said before, WORD_SIZE, MCASP_XSER_RX_SDOUT2 and AUDIO_BUF_SIZE are defined in mcasp_in.c,
    not in an include file.

    I am really curious what you will find out.

    Thank you for your trouble.

    Regards,
    Martin H.

    mcasp.123
  • Martin,

    Can you send me configEnetEcho.h

    When I try to build I get an error looking for that.  I want to get it building cleanly before I start with the formatter.

    I searched the starterware folder but couldn't find it there.

    Thanks,

    John

  • Once I get the file I can dig more.  For now I used the compare files tool in CCS and while the files look similar I do see some differences.  The one on the left is after running the formatter and the one on the right is the original.  I can see that tabs were replaced by spaces and I see that the end of line character is different.  

    Hopefully once I have it building I can just undo each change and see which one is causing the problem.

  • Hi John,
    here comes the required file.
    Wish you success with the problem.

    Regards,
    Martin H.

    configEnetEcho.h
  • Martin,

    I now need type_in.h.  Would it be possible to export your whole project?  If you like you can send it to me via a private message by clicking on my name and starting a conversation.  That would keep the code private.

    Regards,

    John

  • Hi John,

    could you make any progress yet?

    Martin

  • Martin,

    I was not able to make any progress since my last post.  Every time I get past one error I hit another missing file.  Are you able to package up the project and send it to me.  It is possible to send private messages to protect your code.

    Regards,

    John

  • John,

    I just sent a private message containing 2 zip-files. Please let me know if you need further information.

    Thank you.

    Regards,

    Martin

  • Martin,

    I was also able to reproduce this in our early builds of CCSv6.1.0 which uses a newer version of Eclipse and CDT.  I have filed SDSCM00051224 to track this issue.  We will end up filing a bug with Eclipse as well but you can use the tracking number I provided to track its resolution in CCS.

    Regards,

    John

     

  • John,

    thanks for providing feedback.

    Could you still give me a hint where I can track that issue? Is it somewhere at http://processors.wiki.ti.com/...?

    Thank you.

    Regards,

    Martin

  • Sure.  I used to have a link in my signature but dropped it at some point.  There is a "Bug tracking" link on the left hand side when in the CCS forum.

    John