EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Mixing Assembly and C Files in Crossworks

Started by bits_2_byte April 10, 2007
Yes, this is a Newbie question. I'm trying to compile in Crossworks
the RTC library written for the IAR compiler in TI doc SLAA290.

http://focus.ti.com/lit/an/slaa290/slaa290.pdf

I've got a main.c file containing the code from page 2 of the
document with appropriate changes for Crossworks shown below.

#include
#include "RTC.h"
void main ( void )
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
setTime( 0x12, 0, 0, 0); // initialize time to 12:00:00 AM
P1DIR |= 0x01; // Set P1.0 to output direction
CCR0 = 32768-1;
TACTL = TASSEL_1+MC_1; // ACLK, upmode
CCTL0 |= CCIE; // enable CCRO interrupt
_EINT();
while( 1 )
{
LPM3; // enter LPM3, clock will be updated
P1OUT ^= 0x01; // do any other needed items in loop
_NOP(); // set breakpoint here to see 1 second int.
}
}
void Timer_A0(void)__interrupt[TIMERA0_VECTOR]
{
incrementSeconds();
LPM3_EXIT;
}
I've had to changed some of the assembly to the corrent format for
Crossworks, but I'm missing something because I keep getting the
error "undefined symbol '_incrementSeconds'" from Crossworks.

I changed this:

;Variables
MODULE RTC
PUBLIC TI_second
PUBLIC TI_minute
PUBLIC TI_hour
PUBLIC TI_PM
;Functions
PUBLIC incrementSeconds
PUBLIC incrementMinutes
PUBLIC incrementHours
PUBLIC get24Hour

RSEG DATA16_I
TI_second DS 1
TI_minute DS 1
TI_hour DS 1
TI_PM DS 1
RSEG DATA16_ID
DC8 0x00
DC8 0x00
DC8 0x12
DC8 0x00
to this:

;Variables
;MODULE RTC
PUBLIC TI_second
PUBLIC TI_minute
PUBLIC TI_hour
PUBLIC TI_PM
;Functions
PUBLIC incrementSeconds
PUBLIC incrementMinutes
PUBLIC incrementHours
PUBLIC get24Hour

RSEG DATA16_I
TI_second DS 1
TI_minute DS 1
TI_hour DS 1
TI_PM DS 1
RSEG DATA16_ID
DC.B 0x00
DC.B 0x00
DC.B 0x12
DC.B 0x00

RSEG CODE ; Code is relocatable
And was able to compile the .S43 file.

Can someone point out where to look for examples on mixing C and
assembly in Crossworks or tell me what I might be doing wrong or am
missing?

Thanks!

Beginning Microcontrollers with the MSP430

Hi,

> Yes, this is a Newbie question. I'm trying to compile in Crossworks
> the RTC library written for the IAR compiler in TI doc SLAA290.
>
> http://focus.ti.com/lit/an/slaa290/slaa290.pdf
>
> I've got a main.c file containing the code from page 2 of the
> document with appropriate changes for Crossworks shown below.

Perhaps you should ask at the CrossWorks Help Desk? As an evaluator or
licensed user you could ask there. Of course, that would mean you needed to
be one of those things. :-)

Your translation is incorrect in many ways.

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors

Memfault Beyond the Launch