Topic
31 replies Latest Post - ‏2013-04-05T19:39:26Z by richard.france
SystemAdmin
SystemAdmin
2260 Posts
ACCEPTED ANSWER

Pinned topic What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

‏2005-07-21T09:07:16Z |
I have made a custom TDP and in one of my files there are statements like
t_uint8 internal_uplink_buffer0 0x800 __attribute__ ( ( aligned ( 4 ) ) ) ;

Now RTRT's C compiler attolcc1 doesn't recognize __attribute__ ( ( aligned (4)));

I have tried several pragmas such as:

#pragma attol reduce "__attribute__" = null (This works but when I run the code on my target , target returns misaligned access error.)

#pragma attol reduce "__attribute__"
#pragma attol accept "__attribute__",etc.

Can anybody tell me the exact pragma?
Updated on 2013-04-05T19:39:26Z at 2013-04-05T19:39:26Z by richard.france
  • SystemAdmin
    SystemAdmin
    2260 Posts
    ACCEPTED ANSWER

    Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

    ‏2012-10-12T15:05:49Z  in response to SystemAdmin
    Hi,

    Did you get any solution for __attribute__ problem. I am facing the same problem now and don't have much information to solve it. It is a customized TDP for p24F128GA106. I wanted to perform a run-time analysis on the source files and wanted to get code coverage by running the software on target. Hence, I cannot use #pragma attol reduce "__attribute__" = null.

    Thanks in advance
    Jaiganesh
    • richard.france
      richard.france
      811 Posts
      ACCEPTED ANSWER

      Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

      ‏2012-10-12T16:15:53Z  in response to SystemAdmin
      clarify:
      TestRT version ?
      do you have the key USE_ATTOLCC1 into TDP > basic settings for C ?
      what is the instrumentation command (build log) attolccp or attolcc1 ?
      What is the instrumentation error you get ?
      regarding this error, we may need to locate the line into the .i file to see how is written this __attribute__ line
      • SystemAdmin
        SystemAdmin
        2260 Posts
        ACCEPTED ANSWER

        Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

        ‏2012-10-13T13:55:48Z  in response to richard.france
        Hi
        TestRT version is 7.5.0.0
        Not used the Key USE_ATTOLCC1 into TDP > basic settings for C
        attolccp is the instrumentation command

        TestRT attolccp: "C:\My_Projects\SOURCE CODE\Source\I2C_Func.c",line 75: error #79:
        expected a type specifier
        void __attribute__((interrupt,no_auto_psv)) _SI2C1Interrupt(void);

        Attached the copy of I2C_Func.i file.

        Thanks in Advance
        Jaiganesh

        Attachments

  • richard.france
    richard.france
    811 Posts
    ACCEPTED ANSWER

    Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

    ‏2012-10-12T16:26:21Z  in response to SystemAdmin
    #pragma attol reduce "__attribute__" null
    is the right syntax

    #pragma attol reduce "__attribute__" = null
    is not
    • SystemAdmin
      SystemAdmin
      2260 Posts
      ACCEPTED ANSWER

      Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

      ‏2012-10-13T14:02:04Z  in response to richard.france
      I used the syntax #pragma attol reduce "__attribute__" null as mentioned in section "Attolcc1 adaptation for C". The intention is not to use null for this attribute and want to get rid of this error without suppressing it to null. Also kindly suggest any link or material from IBM for developing TDP.

      Thanks in advance,
      Jaiganesh
      • SystemAdmin
        SystemAdmin
        2260 Posts
        ACCEPTED ANSWER

        Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

        ‏2012-10-17T12:39:51Z  in response to SystemAdmin
        Richard,

        Any solution for this __attribute__ problem?

        Thanks,
        Jaiganesh
        • SystemAdmin
          SystemAdmin
          2260 Posts
          ACCEPTED ANSWER

          Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

          ‏2012-10-26T13:21:07Z  in response to SystemAdmin
          I used USE_ATTOLCC1 in TDP settings. This will use attolcc1 to instrument the code and it doesn't have any problem in instrumenting __attribute__.
          • richard.france
            richard.france
            811 Posts
            ACCEPTED ANSWER

            Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

            ‏2012-10-26T14:35:00Z  in response to SystemAdmin
            setting the key USE_ATTOLCC1 in TDP basic settings for C. will force to use attolcc1 instaed of attolccp.
            attolcc1 uses atct.def and attolccp uses atus_c.def
            these 2 file comes from the TDP
            Attolcc1 adaptation for C (atct.def), and
            Header adaptation for C (atus_c.def)

            All modifications to Attolcc1 adaptation for C (atct.def) have NO EFFECT on attolccp.
            note: I instrument properly the attached I2C_func.i file using the cpcgnu TDP without any error or warning.
            So you should be able to instrument your file with attolccp as well if you modify your TDP based on the cpcgnu.xdp example.

            I cannot help further while you do not provide the build error log you get showing the error.
            • SystemAdmin
              SystemAdmin
              2260 Posts
              ACCEPTED ANSWER

              Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

              ‏2012-12-05T09:51:40Z  in response to richard.france
              Richard,

              I've created two versions of TDP for p24F128GA106 to perform component testing for C. The first TDP runs on MPLAB SIM. It works well and the results/code coverage are generated correctly. I've tweaked the second TDP to perform component testing using MPLAB ICD3 debugger. I used serial communication to generate the ".spt" file from target. The problem is here. I am getting the test results coverage but not the code coverage. Could you please help to resolve this issue. I have attached the screen shot of simulator and debugger outputs. In debugger trace, there is no call to function under test. However, i am getting the test results passed.

              Thanks in advance,
              Jaiganesh
              • richard.france
                richard.france
                811 Posts
                ACCEPTED ANSWER

                Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                ‏2012-12-06T08:07:59Z  in response to SystemAdmin
                To help you I need your TDP and the PTU and the .spt or .spt.bak file for both cases.
                the .spt.bak can be kept if you set the berbose mode in menu edit> preference> project > verbose output
                • SystemAdmin
                  SystemAdmin
                  2260 Posts
                  ACCEPTED ANSWER

                  Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                  ‏2012-12-07T10:44:21Z  in response to richard.france
                  Hi

                  Thanks for the quick response. I attached the zip file that contains all the details about the simulator and debugger results. The respective TDPs are placed in their corresponding folders. For the simulator, both test results and code coverage are obtained. For the target, only the test results are obtained but not the code coverage results.

                  I got the following message during post processing of *.spt file generated from debugger.

                  "TestRT attolcov - INFO: Parts of traces do not match any listed FDC files; such parts are ignored"

                  Following is the sequence of operation to generate results from target:
                  1. Once the executable *.cof is generated, I will flash it in the target using MPLAB ICD3. (In the configuration setting, i disabled the internal watchdog)

                  2. Open hyper-terminal and choose the option "Capture Text" to capture the data as *.spt file.

                  3. Run the code and that dumps the data serially through hyper-terminal.

                  4. Close the hyper-terminal and then close the debugger.

                  5. *.spt file is getting split to generate test and code coverage. (as mentioned, only test results are obtained not the code coverage).

                  Are the above steps correct and enough to get the dumper data?

                  Please help to solve the problem.

                  Thanks,
                  Jaiganesh
                • SystemAdmin
                  SystemAdmin
                  2260 Posts
                  ACCEPTED ANSWER

                  Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                  ‏2012-12-10T09:31:47Z  in response to richard.france
                  Hi Richard,

                  Could you please help us to resolve this issue.

                  Thanks,
                  Jaiganesh
                  • richard.france
                    richard.france
                    811 Posts
                    ACCEPTED ANSWER

                    Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                    ‏2012-12-10T10:35:54Z  in response to SystemAdmin
                    change TDP Library Settings > Data types > RTRT_U_INT32 to unsigned long
                    and RTRT_U_INT32 to long

                    try again

                    Note I did not see any difference between 2 TDP into the execution function
                    So you could use same TDP with a define at compilation to use the UART or NOT
                    In addition you could take a look at the delivered PIC TDP that automate the execution.
                    • SystemAdmin
                      SystemAdmin
                      2260 Posts
                      ACCEPTED ANSWER

                      Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                      ‏2012-12-10T11:09:43Z  in response to richard.france
                      Hi

                      It worked by changing the data type to long.

                      In Target TDP, I have called Sys_Init() in usr_init section and UART_TX_Message() in usr_writeln section.

                      Thank you
                      Jaiganesh
                      • richard.france
                        richard.france
                        811 Posts
                        ACCEPTED ANSWER

                        Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                        ‏2012-12-10T12:39:07Z  in response to SystemAdmin
                        Yes, I saw.
                        This is what I said:
                        You could call those function inside a
                        
                        #ifdef RTRT_USE_UART Sys_Init() #endif
                        

                        So you only have to add a macro define RTRT_USE_UART in setting to change the TDP behaviour, and use only one TDP.
                        That's should avoid to have issues like you faced before.
                    • SystemAdmin
                      SystemAdmin
                      2260 Posts
                      ACCEPTED ANSWER

                      Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                      ‏2012-12-10T14:49:06Z  in response to richard.france
                      Hi Richard,

                      Initially the test report and code coverage were generated correctly. Now I am getting the following error

                      TestRT attolcov - FATAL ERROR: Bad hexadecimal number while reading file *.tio

                      I am just saving the *.spt file from target through hyper terminal. I am not doing any formatting with the *.spt file. The file that was saved from hyper terminal is directly used to generate the results.

                      Also sometimes, the *.spt file is received completely through hyper-terminal and sometime not. What modification is required in TDP to resolve this problem.

                      From the execution, it looks like *tio file is looking corrupted.

                      Please help.

                      Thanks,
                      Jaiganesh
                    • SystemAdmin
                      SystemAdmin
                      2260 Posts
                      ACCEPTED ANSWER

                      Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                      ‏2012-12-10T14:51:05Z  in response to richard.france
                      Hi Richard,

                      Initially the test report and code coverage were generated correctly. Now I am getting the following error

                      TestRT attolcov - FATAL ERROR: Bad hexadecimal number while reading file *.tio

                      At present, I am just saving the *.spt file from target through hyper terminal. I am not doing any formatting with the *.spt file. The file that was saved from hyper terminal is directly used to generate the results.

                      Also sometimes, the *.spt file is received completely through hyper-terminal and sometime not. What modification is required in TDP to resolve this problem.

                      From the execution, it looks like *tio file is getting corrupted.

                      Please help.

                      Attached the files for your reference.

                      Thanks,
                      Jaiganesh
                      • richard.france
                        richard.france
                        811 Posts
                        ACCEPTED ANSWER

                        Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                        ‏2012-12-10T15:25:39Z  in response to SystemAdmin
                        All .spt file must have
                        tdp end line near the end of file
                        If you have not this line then it means the dump is not complete.

                        Looking at your .spt file it seems your code is executed 4 times and I guess when it restart it re-initialize the UART that stop the dump of the buffer filled by the previous execution. So you have not the end of the buffer and no tdp end
                        to avoid this happend I think you should modify your TDP to execute a big while loop in order to wait the end of the buffer dump into the usr_close.

                        You could also take example of the provided cpic18fMPLABsim.xdp that put a break point on priv_close to stop the execution and quit the debugger automatically.
                        • SystemAdmin
                          SystemAdmin
                          2260 Posts
                          ACCEPTED ANSWER

                          Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                          ‏2012-12-13T07:16:21Z  in response to richard.france
                          I was not able to find scriptit.exe from the internet. I tried with vb script and Autoit.exe. However, before going for automation, I wanted to try by manually adding the breakpoint at priv_close() and run the script. But the breakpoint was not hit and the execution is completed.
                          In MPLAB simulator using register trace, i am getting
                          "NO "1 (Max Calling Level reached)"
                          CI 0
                          tdp" but not the string "end".

                          In debugger it just halts at ""NO "1 (Max Calling...). I didn't close the hyperterminal nor MPLAB IDE.
                          Could you please explain why the breakpoint at priv_close was not getting hit and way to resolve this problem.
                          • SystemAdmin
                            SystemAdmin
                            2260 Posts
                            ACCEPTED ANSWER

                            Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                            ‏2012-12-13T12:29:10Z  in response to SystemAdmin
                            Richard,

                            Could you please explain why the breakpoint is not getting hit at priv_close(). What I found is that with Target board, setting a breakpoint is not possible as the "Breakpoints" window is not working with TAB options using VBScript. Hence, I need to set the breakpoint manually.

                            Thanks
                            Jaiganesh
                            • richard.france
                              richard.france
                              811 Posts
                              ACCEPTED ANSWER

                              Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                              ‏2012-12-13T15:53:26Z  in response to SystemAdmin
                              In debug, make sure the application reach the priv_close thanks to a break point.
                              sometime the method has been removed by the compiler itself because of the optimizer
                              So in this case remove the optimization flags at least when compiling the TP.c
                              and make sure the linker doe not remove it as well (check themap file for that.

                              Note that delivered TDP cpic18fMPLABsim.xdp
                              Uses USART serial line for data retrieval
                              the simulator redirect UART IO to file:
                              The result file is written in c:\temp directory
                              This TDP require autoIT v3 installed on the host machine
                              I am pretty sure you will find this software on the web.

                              You can peekup idea from this TDP to make yours
                              • richard.france
                                richard.france
                                811 Posts
                                ACCEPTED ANSWER

                                Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                                ‏2012-12-13T15:58:45Z  in response to richard.france
                                priv_close may not be executed:
                                if you have atexit function available in the TDP => turn it off
                                you use trace in C++ => add #define RTRT_NEED_CLOSE_CALL into Library Settings > Include files or code visible only to the Target Deployment Port

                                RTRT_FILENAME_UNUSED
                                This setting allows to remove the function providing the name of the file to be openned in order to optimize the runtime code. Tick this setting if your usr_open and usr_init functions does not use the computed file name. As it is when using the breakpoint mode or socket transfer.
                                #define RTRT_NEED_CLOSE_CALL
                                Using observation tools for C++ application running on RTOS which has no atexit function, the usr_close is not called at the end of the application to get all destructor traces. If defined when RTRT_IO=RTRT_USR, this macro force the runtime to execute the usr_close after the trace dump, when the application execute the main return or the exit function.
                                • SystemAdmin
                                  SystemAdmin
                                  2260 Posts
                                  ACCEPTED ANSWER

                                  Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                                  ‏2012-12-17T10:56:05Z  in response to richard.france
                                  Hi,

                                  1. atexit functionality in TDP is set to RTRT_NONE.

                                  2. Used RTRT_FILENAME_UNUSED and RTRT_NEED_CLOSE_CALL in the "Include files or code visible only to TDP"

                                  3. No C++ code in our project.

                                  4. usr_close function is not empty and it contains a simple delay function using for loop.

                                  I can see priv_close in the disassembly window of debugger. But when I set the breakpoint, it never hits. Please help out to resolve this issue.

                                  Also, I used "cpic18fMPLABsim.xdp" as reference and used AutoIt.exe to automate the process. My understanding of "WaitSptEof.exe" is that the script will be suspended till the specified spt file reached end-of-file (tdp end) and the input to this exe is the spt file name. Is it correct? When I tried this, the text window is not updated with the spt file name. However, it goes to "Wait end of test..Abort" window and the window is minimized. Not sure the exe has taken the file name correctly or not. It never closes and I need to manually halt the process though the spt file has reached its "tdp end. Note: I tried this option using simulator mode and the spt file contains the string "tdp end".
                                  • richard.france
                                    richard.france
                                    811 Posts
                                    ACCEPTED ANSWER

                                    Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                                    ‏2012-12-18T12:23:00Z  in response to SystemAdmin
                                    Apparently you did all things to get priv_close executed when there are no fatal error during execution.
                                    sometimes priv_close is not hit because priv_exit is reached before, due to execution error while intitialization of the runtime.

                                    WaitSptEof.exe read permanently the file given as parameter to look for "tdp end" line, then exit and close the windows when found.
                                    This behaviour allows the autoIt script to wait for the WaitSptEof window disapear, meaning the execution ends on the target, then kill/exit the debugger/simulator
                                    WaitSptEof usage: -timeout xx -hide -nodialog defaultFileName.
                                    Pay attention that works only if the debugger/executable write the .spt file directly in ascii format.
                                    If your debugger write the file using an other format (like hexa) to be translated into ascii after execution, then this mechanism cannot works because the .spt is kept empty until the end of execution.
                                    • SystemAdmin
                                      SystemAdmin
                                      2260 Posts
                                      ACCEPTED ANSWER

                                      Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                                      ‏2013-01-10T11:29:13Z  in response to richard.france
                                      Hi Richard,

                                      I was able to solve the TDP end issue by changing the return value of usr_open function to 1. Developed customized application similar to WaitSptEof for the script to wait for "TDP end" string in trace file.
                                      However I have another problem. Test selection is not working for component testing for C. No matter the test case selection is, it always executes the whole test script. I need to manually comment the test cases in test script so that it won't be compiled and run. I am using RTRT 7.5.0.4V. Please help.

                                      Thank you,
                                      Jaiganesh
                                      • richard.france
                                        richard.france
                                        811 Posts
                                        ACCEPTED ANSWER

                                        Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                                        ‏2013-01-10T15:03:44Z  in response to SystemAdmin
                                        Hi
                                        if your studio does not provide the test selection to the TestScrip compiler you can workAround this by using studio settings > Component testing for C > Test compiler > Additional options
                                        set it to -SERVICE=myserv1,myserv2,... and -TEST=myTestx,myTesty,...
                                        to select services and test yourself.
                                        Do not forget to set to YES the studio settings > Component testing for C > Test compiler > Enable Additional options

                                        About WaitSptEof.exe
                                        It would be nice to detail why the delivered binary does not work for your environment, So that we could modify it to fit your request.
                                        • SystemAdmin
                                          SystemAdmin
                                          2260 Posts
                                          ACCEPTED ANSWER

                                          Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                                          ‏2013-01-10T17:10:05Z  in response to richard.france
                                          Hi

                                          I set "-SERVICE=BIT_Mon_Temp,-TEST=Test_1" in Additional options section. Also ensured 'Yes' is chosen for Enable Additional options. My intention is to run only test case 1 (TEST_1) in service BIT_MON_Temp. But RTRT executes all the test cases. Is my understanding of setting correct?

                                          I checked WaitSptEof. It is working fine. Possibly the issue i had with "tdp end" string was causing this utility not to work properly. Since the "tdp end" issue is resolved, it is working correctly now.
                                          • SystemAdmin
                                            SystemAdmin
                                            2260 Posts
                                            ACCEPTED ANSWER

                                            Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                                            ‏2013-01-11T12:56:13Z  in response to SystemAdmin
                                            Hi

                                            RTRT throws the following warning for "VAR IPC4bits.SI2C1P, init = 0, ev = 3"

                                            TestRT-W-CHAMPINCO, C:\My_Projects\Test.ptu:203 Unknown field SI2C1P

                                            __extension__ typedef struct tagIPC4BITS {
                                            union {
                                            struct {
                                            unsigned SI2C1P0:1;
                                            unsigned SI2C1P1:1;
                                            unsigned SI2C1P2:1;
                                            unsigned :1;
                                            unsigned MI2C1P0:1;
                                            unsigned MI2C1P1:1;
                                            unsigned MI2C1P2:1;
                                            unsigned :1;
                                            unsigned CMIP0:1;
                                            unsigned CMIP1:1;
                                            unsigned CMIP2:1;
                                            unsigned :1;
                                            unsigned CNIP0:1;
                                            unsigned CNIP1:1;
                                            unsigned CNIP2:1;
                                            };
                                            struct {
                                            unsigned SI2C1P:3;
                                            unsigned :1;
                                            unsigned MI2C1P:3;
                                            unsigned :1;
                                            unsigned CMIP:3;
                                            unsigned :1;
                                            unsigned CNIP:3;
                                            };
                                            };
                                            } IPC4BITS;
                                            extern volatile IPC4BITS IPC4bits __attribute__((__sfr__));

                                            If I delete the union and keep only the lower structure as shown below, there is no warning. Is there any parsing issue with "union".

                                            __extension__ typedef struct tagIPC4BITS {
                                            unsigned SI2C1P:3;
                                            unsigned :1;
                                            unsigned MI2C1P:3;
                                            unsigned :1;
                                            unsigned CMIP:3;
                                            unsigned :1;
                                            unsigned CNIP:3;
                                            } IPC4BITS;
                                            extern volatile IPC4BITS IPC4bits __attribute__((__sfr__));

                                            Also the test selection is not working. Please look into my previous reply.

                                            Please help on these issues.

                                            Thank you,
                                            Jaiganesh
                                            • richard.france
                                              richard.france
                                              811 Posts
                                              ACCEPTED ANSWER

                                              Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                                              ‏2013-04-05T19:34:53Z  in response to SystemAdmin
                                              we had issues with unnamed unions that have been fixed in later releases.
                                              try to put a name to your union.
                                              but in that case you have to use this name also into the variable (Var.unionName.field instead of Var.field)
                                        • SystemAdmin
                                          SystemAdmin
                                          2260 Posts
                                          ACCEPTED ANSWER

                                          Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                                          ‏2013-03-18T07:06:33Z  in response to richard.france
                                          Hi

                                          I am doing tool qualification for the TDP that I developed for PIC24F128GA106 using RTRT 7.5.0.4. In ATC, there are 2 failures. CC1/OUT/002. The comparison of FILE2.fdc and FILE2.fdc.ref is failing. I have attached FILE2.fdc generated for my target. Could you please help me why this is failing and what changes to be made on TDP to make it pass.

                                          Thank you,
                                          Jaiganesh
                                          • richard.france
                                            richard.france
                                            811 Posts
                                            ACCEPTED ANSWER

                                            Re: What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?

                                            ‏2013-04-05T19:39:26Z  in response to SystemAdmin
                                            is there any relation to What pragma to use so that RTRT recognises __attribute__ ((aligned(4)))?
                                            if not
                                            please open a new thread fro the new subject.

                                            Note for the qualification issue:
                                            more detail like the error you got is required