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