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

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

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

    ‏2012-10-12T15:05:49Z  
    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
    824 Posts

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

    ‏2012-10-12T16:15:53Z  
    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
    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
  • richard.france
    richard.france
    824 Posts

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

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

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

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

    ‏2012-10-13T13:55:48Z  
    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
    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

  • SystemAdmin
    SystemAdmin
    2260 Posts

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

    ‏2012-10-13T14:02:04Z  
    #pragma attol reduce "__attribute__" null
    is the right syntax

    #pragma attol reduce "__attribute__" = null
    is not
    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

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

    ‏2012-10-17T12:39:51Z  
    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
    Richard,

    Any solution for this __attribute__ problem?

    Thanks,
    Jaiganesh
  • SystemAdmin
    SystemAdmin
    2260 Posts

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

    ‏2012-10-26T13:21:07Z  
    Richard,

    Any solution for this __attribute__ problem?

    Thanks,
    Jaiganesh
    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
    824 Posts

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

    ‏2012-10-26T14:35:00Z  
    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__.
    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

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

    ‏2012-12-05T09:51:40Z  
    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.
    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
    824 Posts

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

    ‏2012-12-06T08:07:59Z  
    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
    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

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

    ‏2012-12-07T10:44:21Z  
    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
    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

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

    ‏2012-12-10T09:31:47Z  
    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
    Hi Richard,

    Could you please help us to resolve this issue.

    Thanks,
    Jaiganesh
  • richard.france
    richard.france
    824 Posts

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

    ‏2012-12-10T10:35:54Z  
    Hi Richard,

    Could you please help us to resolve this issue.

    Thanks,
    Jaiganesh
    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

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

    ‏2012-12-10T11:09:43Z  
    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.
    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
    824 Posts

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

    ‏2012-12-10T12:39:07Z  
    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
    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

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

    ‏2012-12-10T14:49:06Z  
    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.
    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

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

    ‏2012-12-10T14:51:05Z  
    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.
    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
    824 Posts

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

    ‏2012-12-10T15:25:39Z  
    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
    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

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

    ‏2012-12-13T07:16:21Z  
    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.
    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

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

    ‏2012-12-13T12:29:10Z  
    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.
    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
    824 Posts

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

    ‏2012-12-13T15:53:26Z  
    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
    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
    824 Posts

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

    ‏2012-12-13T15:58:45Z  
    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
    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

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

    ‏2012-12-17T10:56:05Z  
    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.
    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
    824 Posts

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

    ‏2012-12-18T12:23:00Z  
    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".
    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.