EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Re: Crossworks relocatable assembler question

Started by Paul Curtis February 7, 2006
Mark, 

> At the risk of giving Al a heart attack, I'm
finally getting 
> around to 
> some assembly language for the msp430. Specifically, I'm trying to 
> convert the single chip thermocouple app not code from TI, which was 
> created in IAR, to Crossworks.
> 
> Here's a link to the original code:
> http://focus.ti.com/general/docs/lit/getliterature.tsp?literat
> ureNumber=slaa216&fileType=zip
> 
> 
> After some slight label change defs in the two modules, I am 
> now at the 
> point where the modules assemble, but the linker chokes, telling me 
> "undefined symbol _main."
> 
> Can someone give me a clue as to what I need to do? I've 
> tried to find 
> an example of a Crossworks MSP430 project using two linked 
> assy files, 
> but I was unsuccessful.
> 
> I'd be glad to post code, but I thought this is probably something 
> really simple.

You probably have "crt0.asm" in your System Files project folder as C
startup code when you created a new project (I believe we have C and
Assembly Language project templates).  Remove that and see how you get
on--it should link, I think.

Rgds,

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

Beginning Microcontrollers with the MSP430

Hi, List,

At the risk of giving Al a heart attack, I'm finally getting around to 
some assembly language for the msp430. Specifically, I'm trying to 
convert the single chip thermocouple app not code from TI, which was 
created in IAR, to Crossworks.

Here's a link to the original code:
http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=slaa216&fileType=zip


After some slight label change defs in the two modules, I am now at the 
point where the modules assemble, but the linker chokes, telling me 
"undefined symbol _main."

Can someone give me a clue as to what I need to do? I've tried to find 
an example of a Crossworks MSP430 project using two linked assy files, 
but I was unsuccessful.

I'd be glad to post code, but I thought this is probably something 
really simple.

Thanks,
Mark



Sure is, make sure you have the 'A' version, and not the
'C' version of 
the *.xcl file defined in Projects->Options.

Have FUn, I'll keep the nitro handy!

Cheers

Al

Mark E. Skeels wrote:

>Hi, List,
>
>At the risk of giving Al a heart attack, I'm finally getting around to 
>some assembly language for the msp430. Specifically, I'm trying to 
>convert the single chip thermocouple app not code from TI, which was 
>created in IAR, to Crossworks.
>
>Here's a link to the original code:
>http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=slaa216&fileType=zip
>
>
>After some slight label change defs in the two modules, I am now at the 
>point where the modules assemble, but the linker chokes, telling me 
>"undefined symbol _main."
>
>Can someone give me a clue as to what I need to do? I've tried to find 
>an example of a Crossworks MSP430 project using two linked assy files, 
>but I was unsuccessful.
>
>I'd be glad to post code, but I thought this is probably something 
>really simple.
>
>Thanks,
>Mark
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>
>
>
>  
>


You mean xml, right?

Mark


Onestone wrote:

> Sure is, make sure you have the 'A'
version, and not the 'C' version of
> the *.xcl file defined in Projects->Options.
>
> Have FUn, I'll keep the nitro handy!
>
> Cheers
>
> Al
>
> Mark E. Skeels wrote:
>
> >Hi, List,
> >
> >At the risk of giving Al a heart attack, I'm finally getting
around to
> >some assembly language for the msp430. Specifically, I'm trying to
> >convert the single chip thermocouple app not code from TI, which was
> >created in IAR, to Crossworks.
> >
> >Here's a link to the original code:
>
>http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=slaa216&fileType=zip

>
<http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=slaa216&fileType=zip>
> >
> >
> >After some slight label change defs in the two modules, I am now at the
> >point where the modules assemble, but the linker chokes, telling me
> >"undefined symbol _main."
> >
> >Can someone give me a clue as to what I need to do? I've tried to
find
> >an example of a Crossworks MSP430 project using two linked assy files,
> >but I was unsuccessful.
> >
> >I'd be glad to post code, but I thought this is probably something
> >really simple.
> >
> >Thanks,
> >Mark
> >
> >
> >
> >
> >.
> >
> >
> >>.
>
>
> 
>


On Wed, 08 Feb 2006 05:25:15 +1030, Al wrote:

>Sure is, make sure you have the 'A'
version, and not the 'C' version of 
>the *.xcl file defined in Projects->Options.

I don't have 'a' versions and 'c' versions and I get by
just using the
standard .xcl file (though I also suck that one over into a project
directory, edit it, and then use it in a project I'm working on; so it
isn't always the 'vanilla' version that I use.)  In any case, in
that
same Projects->Options choice, if one selects the XLINK category and
then examines the Include tab, there is a "ignore CSTARTUP in library"
checkbox, which I check.  I also click the "override default library
name" and make sure that the text box below it is empty.  I think that
would work.

But I probably have an older version of IAR's tools running right now:
------------------------------
IAR Build
3.0B (3.0.2.6)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\iarbuild.exe
10/8/03 9:17:20 AM, 28672 bytes

IAR Embedded Workbench IDE
3.0B (3.0.2.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\IarIdePM.exe
10/8/03 9:11:40 AM, 606208 bytes

IAR Library Builder
1.03H (1.3.8.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\xar.exe
11/10/03 1:55:00 PM, 98304 bytes

IAR XLIB
3.29F/386 (3.29.0.6)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\xlib.exe
11/10/03 1:58:18 PM, 471040 bytes

IAR XLINK
4.56E (4.56.5.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\xlink.exe
11/10/03 2:01:48 PM, 1224704 bytes

IAR Assembler for MSP430
V2.21B/W32 (2.21.2.7)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\a430.exe
11/21/03 3:06:36 PM, 524288 bytes

IAR C Compiler for MSP430
V2.21B-P1/W32 [Kickstart] (2.21.2.2)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\icc430.exe
12/11/03 11:30:02 AM, 5144576 bytes

IAR Find In Files
3.0A (3.0.1.6)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\FindInFiles.dll
10/8/03 9:16:56 AM, 40960 bytes

IAR IDE Framework
3.4C (3.4.3.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\IdeFramework.dll
10/7/03 4:16:00 PM, 245760 bytes

IAR Log Window
3.0C (3.0.3.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\LogWindow.dll
10/8/03 9:16:12 AM, 122880 bytes

(6.0.8665.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\mfc42.dll
10/18/00 4:33:38 PM, 995383 bytes

IAR Project Manager Engine
3.0D (3.0.4.1)
C:\Program Files\IAR
Systems\EmbWrk32\common\bin\ProjectManagerEngine.dll
10/8/03 9:09:48 AM, 688128 bytes

IAR Project Manager Gui
3.1 (3.1.0.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\ProjectManagerGui.dll
10/8/03 9:14:46 AM, 380928 bytes

IAR Text Editor
3.5 (3.5.0.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\TextEditor.dll
10/8/03 8:48:06 AM, 401408 bytes

Shared Library for Xerces-C Version 1.5.1
1, 5, 1 (1.5.1.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\xerces-c_1_5_1.dll
10/7/03 3:38:42 PM, 1339392 bytes

IAR Code Coverage Plug-in
3.0F (3.0.6.4)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\CodeCoverage.dll
10/7/03 4:45:00 PM, 159744 bytes

IAR C-SPY Debugger GUI
3.3G (3.3.7.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\DebuggerGui.dll
10/7/03 4:50:58 PM, 831488 bytes

IAR C-SPY Debugger Kernel
3.2K (3.2.11.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\Kernel.dll
11/7/03 11:39:52 AM, 1044480 bytes

IAR Profiling Plug-in
3.0G (3.0.7.4)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\Profiling.dll
10/8/03 8:45:08 AM, 131072 bytes

IAR Trace Plug-in
3.0E (3.0.5.0)
C:\Program Files\IAR Systems\EmbWrk32\common\bin\Trace.dll
10/8/03 8:49:18 AM, 233472 bytes

IAR Project File Converter for MSP430
V2.10A/W32 (2.10.1.7)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\cwtd430.dll
10/10/03 9:49:12 AM, 270336 bytes

IAR Workbench Target Descriptor for MSP430
V2.21D-P1/W32 (2.21.4.7)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\nwtd430.dll
2/16/04 10:57:16 AM, 372736 bytes

IAR C-SPY Emulator Driver for MSP430
V2.21B/W32 (2.21.2.7)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\430fet.dll
11/21/03 3:15:04 PM, 475136 bytes

IAR C-SPY Library Support Plug-in for MSP430
V2.21B/W32 (2.21.2.7)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\430LibSupport.dll
11/21/03 12:36:40 PM, 176128 bytes

HIL
1, 0, 1, 2 (1.0.1.2)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\HIL.dll
1/29/04 1:29:40 AM, 28672 bytes

IAR C-SPY Processor Descriptor for MSP430
V2.21B/W32 (2.21.2.7)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\430proc.dll
11/21/03 12:55:58 PM, 303175 bytes

MSP430
1, 1, 5, 7 (1.1.5.7)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\MSP430.dll
3/12/04 11:14:34 AM, 53248 bytes

Stack Plugin
2.21C (2.2.1.3)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\Stack.dll
10/8/03 7:17:34 AM, 147456 bytes

IAR C-SPY Simulator Driver for MSP430
V2.21B/W32 [Kickstart] (2.21.2.3)
C:\Program Files\IAR Systems\EmbWrk32\430\bin\430sim.dll
11/21/03 3:23:18 PM, 471114 bytes
------------------------------


>
>Have FUn, I'll keep the nitro handy!
>
>Cheers
>
>Al

Maybe I didn't make myself well understood.

I'm not using IAR, I'm using Crossworks and converting code written
for 
IAR to assemble in Crossworks.

In any case, I didn't have any C startup code in my project. Actually, I 
got it to assemble;

The IAR source had this:

;------ 

            RSEG INTVEC
;------ 

           ORG     RESET_VECTOR            ; MSP430 RESET Vector
           DW      RESET                   ;
           ORG     SD16_VECTOR             ; SD16 Vector
           DW      SD16_ISR                ;
           ORG     PORT1_VECTOR            ; P1.x Vector
           DW      P1_ISR
           ORG     BASICTIMER_VECTOR       ; Basic Timer Vector
           DW      BT_ISR                  ;
           END

I changed it to this after examining the main.asm file standard with the 
Crossworks asm project startup.


>   .vectors
>   .keep
>
> ;------ 
>
> ;            RSEG INTVEC
> ;------ 
>
>            ORG     RESET_VECTOR            ; MSP430 RESET Vector
>            DW      RESET                   ;
>            ORG     SD16_VECTOR             ; SD16 Vector
>            DW      SD16_ISR                ;
>            ORG     PORT1_VECTOR            ; P1.x Vector
>            DW      P1_ISR
>            ORG     BASICTIMER_VECTOR       ; Basic Timer Vector
>            DW      BT_ISR                  ;
>            END

It assembled, I'll see if it works........

Mark



On Tue, 07 Feb 2006 14:46:50 -0600, Mark wrote:

>Maybe I didn't make myself well understood.
>
>I'm not using IAR, I'm using Crossworks and converting code
written for 
>IAR to assemble in Crossworks.

Sorry about that, Mark.  I'm sure that's my fault.

>In any case, I didn't have any C startup code
in my project. Actually, I 
>got it to assemble;

Assembly is one thing.  Linking is another.  I don't have Crossworks
on my system and have never even tried to use it.  I would guess that
there is a similar feature in Crossworks.  But anything Paul says on
the subject is what you should focus on.

Jon

> Assembly is one thing.  Linking is another.  I
don't have Crossworks
> on my system and have never even tried to use it.  I would guess that
> there is a similar feature in Crossworks.  But anything Paul says on
> the subject is what you should focus on.
>
> Jon
>
Thanks, Jon,

Of course, you are correct. It linked successfully.

I'm just stepping through it to see what I got.....

Mark



Mark E. Skeels wrote:
> Hi, List,
> 
> At the risk of giving Al a heart attack, I'm finally getting around to

> some assembly language for the msp430. Specifically, I'm trying to 
> convert the single chip thermocouple app not code from TI, which was 
> created in IAR, to Crossworks.
> 
> Here's a link to the original code:
>
http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=slaa216&fileType=zip
> 
> 
> After some slight label change defs in the two modules, I am now at the 
> point where the modules assemble, but the linker chokes, telling me 
> "undefined symbol _main."
> 
> Can someone give me a clue as to what I need to do? I've tried to find

> an example of a Crossworks MSP430 project using two linked assy files, 
> but I was unsuccessful.
> 
> I'd be glad to post code, but I thought this is probably something 
> really simple.

It is.

The IAR way is to "translate" C identifiers to assembler labels by
doing 
absolutely nothing. That means that the C function "main" corrsponds
to 
the assembler label "main".

In Crossworks, on the other hand, the translation includes adding an 
underscrore, so the assembler label should be "_main".

Why am I talking about the C function "main" when you're writing
an 
assembler program? Well it's because the run-time environment assumes 
that there is a starting point, and it should be named "main", or in
the 
crosswork case "_main".

So, make sure you have an exported label "_main" as the starting point

in your application.

     -- Anders Lindgren, IAR Systems

Ps. Am I starting to lose my mind -- helping people with Crosswork problems?

-- 
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.

Thanks, Anders, for the response. Be careful of the Darkside, 
Luke........ :-X

Mark

Anders Lindgren wrote:

> Mark E. Skeels wrote:
> > Hi, List,
> >
> > At the risk of giving Al a heart attack, I'm finally getting
around to
> > some assembly language for the msp430. Specifically, I'm trying
to
> > convert the single chip thermocouple app not code from TI, which was
> > created in IAR, to Crossworks.
> >
> > Here's a link to the original code:
> > 
>
http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=slaa216&fileType=zip

>
<http://focus.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=slaa216&fileType=zip>
> >
> >
> > After some slight label change defs in the two modules, I am now at
the
> > point where the modules assemble, but the linker chokes, telling me
> > "undefined symbol _main."
> >
> > Can someone give me a clue as to what I need to do? I've tried to
find
> > an example of a Crossworks MSP430 project using two linked assy files,
> > but I was unsuccessful.
> >
> > I'd be glad to post code, but I thought this is probably
something
> > really simple.
>
> It is.
>
> The IAR way is to "translate" C identifiers to assembler labels
by doing
> absolutely nothing. That means that the C function "main"
corrsponds to
> the assembler label "main".
>
> In Crossworks, on the other hand, the translation includes adding an
> underscrore, so the assembler label should be "_main".
>
> Why am I talking about the C function "main" when you're
writing an
> assembler program? Well it's because the run-time environment assumes
> that there is a starting point, and it should be named "main", or
in the
> crosswork case "_main".
>
> So, make sure you have an exported label "_main" as the starting
point
> in your application.
>
>      -- Anders Lindgren, IAR Systems
>
> Ps. Am I starting to lose my mind -- helping people with Crosswork 
> problems?
>
> -- 
> Disclaimer: Opinions expressed in this posting are strictly my own and
> not necessarily those of my employer.
>
>
> .
>
>
>
>
>
> SPONSORED LINKS
> Computer internet security 
>
<http://groups.yahoo.com/gads?t=ms&k=Computer+internet+security&w1=Computer+internet+security&w2=Computer+internet+business&w3=Computer+internet+access&w4=Computer+internet+privacy+securities&w5=Computer+internet+help&w6=Texas+instruments&c=6&s7&.signZ9Q_Is69flQPlZteuKw>

> 	Computer internet business 
>
<http://groups.yahoo.com/gads?t=ms&k=Computer+internet+business&w1=Computer+internet+security&w2=Computer+internet+business&w3=Computer+internet+access&w4=Computer+internet+privacy+securities&w5=Computer+internet+help&w6=Texas+instruments&c=6&s7&.sigfdp5NCwqBwePK_awOIw>

> 	Computer internet access 
>
<http://groups.yahoo.com/gads?t=ms&k=Computer+internet+access&w1=Computer+internet+security&w2=Computer+internet+business&w3=Computer+internet+access&w4=Computer+internet+privacy+securities&w5=Computer+internet+help&w6=Texas+instruments&c=6&s7&.sig=t6iyjywM5f5bjjKjklY_ww>

>
> Computer internet privacy securities 
>
<http://groups.yahoo.com/gads?t=ms&k=Computer+internet+privacy+securities&w1=Computer+internet+security&w2=Computer+internet+business&w3=Computer+internet+access&w4=Computer+internet+privacy+securities&w5=Computer+internet+help&w6=Texas+instruments&c=6&s7&.sig=xb9tvshl1Ao9LtZ0o8L1YA>

> 	Computer internet help 
>
<http://groups.yahoo.com/gads?t=ms&k=Computer+internet+help&w1=Computer+internet+security&w2=Computer+internet+business&w3=Computer+internet+access&w4=Computer+internet+privacy+securities&w5=Computer+internet+help&w6=Texas+instruments&c=6&s7&.sigPICQLeaOhPQoHIN4-hKZA>

> 	Texas instruments 
>
<http://groups.yahoo.com/gads?t=ms&k=Texas+instruments&w1=Computer+internet+security&w2=Computer+internet+business&w3=Computer+internet+access&w4=Computer+internet+privacy+securities&w5=Computer+internet+help&w6=Texas+instruments&c=6&s7&.sigw78vr_uEHnPw8wLyZbA>

>
>
>
> 
> >.
>
>
> 
>



Memfault Beyond the Launch