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.

the type of TMS470 Compiler

During these days ,I am learning the information of  "inline assembly" in the CCS4.1.2 with the compiler of TMS470.In the document of the Cortex-M3,I meet the problem just like this:

//*****************************************************************************
//
//! Provides a small delay.
//!
//! \param ulCount is the number of delay loop iterations to perform.
//!
//! This function provides a means of generating a constant length delay.  It
//! is written in assembly to keep the delay consistent across tool chains,
//! avoiding the need to tune the delay based on the tool chain in use.
//!
//! The loop takes 3 cycles/loop.
//!
//! \return None.
//
//*****************************************************************************
#if defined(ewarm) || defined(DOXYGEN)
void
SysCtlDelay(unsigned long ulCount)
{
    __asm("    subs    r0, #1\n"
          "    bne.n   SysCtlDelay\n"
          "    bx      lr");
}
#endif
#if defined(codered) || defined(gcc) || defined(sourcerygxx)
void __attribute__((naked))
SysCtlDelay(unsigned long ulCount)
{
 __asm(
       "    subs    r0, #1\n"
          "    bne     SysCtlDelay\n"
          "    bx      lr");
}
#endif
#if defined(rvmdk) || defined(__ARMCC_VERSION)
__asm void
SysCtlDelay(unsigned long ulCount)
{
    subs    r0, #1;
    bne     SysCtlDelay;
    bx      lr;
}
#endif

while compiling this code ,the error is that :

undefined   first referenced               
  symbol         in file                    
 ---------   ----------------               
 SysCtlDelay ./DriverLib/driverlib/sysctl.obj

error: unresolved symbols remain

if I change the code ,and just use the code

//#if defined(codered) || defined(gcc) || defined(sourcerygxx)
void __attribute__((naked))
SysCtlDelay(unsigned long ulCount)
{
 __asm(
       "    subs    r0, #1\n"
          "    bne     SysCtlDelay\n"
          "    bx      lr");
}
//#endif

And there is no error while compiling the code ,I want to know the type of TMS470 Compiler is the GCC or  other's.

.According the explanation of  the function ,when you run the funtion, the value of  r0 is equal to "unsigned long ulCount".But I watch the core register, it is not like just mentioned,the value of r0 is not equal to ulCount.

In the TMS470 Compiler ,how the inline assembly transmits the Parameters of a function ?Dose the TMS470 Compiler support the ATPCE(ARM-THUMB procedure call standard)?

Thank you for your reply!

Best regards,

XU

 

 

  • It appears that you are looking at the source file sysct.c in Stellarisware driver library. In the version of the file you are looking at, is there a #if defined(ccs)? It looks like there isn't which means you are likely using a very old version of it. In recent versions you will also find the following code:

    // For CCS implement this function in pure assembly.  This prevents the TI
    // compiler from doing funny things with the optimizer.
    //
    #if defined(ccs)
        __asm("    .sect \".text:SysCtlDelay\"\n"
              "    .clink\n"
              "    .thumbfunc SysCtlDelay\n"
              "    .thumb\n"
              "    .global SysCtlDelay\n"
              "SysCtlDelay:\n"
              "    subs r0, #1\n"
              "    bne.n SysCtlDelay\n"
              "    bx lr\n");
    #endif

    Please download and use the latest version of Stellarisware. It is available here. You may also want to consider updating your version of CCS. 4.1.2 is now quite old and there have been quite a few updates/bug fixes since then. You can either update via the CCS Update Manager (menu Help->Software Updates->Find and Install) or download and install the full latest version 4.2.4 from http://processors.wiki.ti.com/index.php/Download_CCS#Code_Composer_Studio_Version_4_Downloads

  • Thank you for your reply,now I have resolved the probiem