Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to call an external compiler for inline ASM in gcc

Posted on 2008-06-15
7
Medium Priority
?
524 Views
Last Modified: 2013-11-13
I have a c program that I compile with gcc (gcc with hc12 patches).  The new CPU I'm working with has a co-processor and isn't supported in gcc-68hc12.  There is a open-source assembler for the co-processor that I would like to use(http://home.arcor.de/hotwolf/).  I'm looking for an example showing me how to instruct gcc to use this external assembler where specified in my code.

0
Comment
Question by:sean-keys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 24

Assisted Solution

by:fridom
fridom earned 400 total points
ID: 21791153
Hm, that's a bit unusual. I just wonder if that really is needed. Can't you just write some assembler file and then you use the Assembler to generate the object files and then you use gcc as linker for this object file also.

Regards
Friedrich
0
 
LVL 40

Expert Comment

by:evilrix
ID: 21791208
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 21791416
The assembler is part of gcc, and I know of no way to tell gcc to use a different assembler (especially not if it's just for parts of the code).
make however can be told to use the external assembler (on a separate file like fridom said) - just add it to the build commands before linking.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sean-keys
ID: 21794679
"use the Assembler to generate the object files and then you use gcc as linker for this object file also"

Could this be done in the make.conf file ?

0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 1600 total points
ID: 21795977
Sure. You could just make a general rule that assembles files with a certain extension using your external assembler. Those object files can then be linked to the rest of the code with gcc.

Or, you could handle it on a case-by-case basis if you prefer.
0
 

Author Comment

by:sean-keys
ID: 21796159
Sounds like the solution I'm looking for.  This is a community project(http://sourceforge.net/project/showfiles.php?group_id=214452) and I would like people to be able to simply run "make" and get a usable s19 file, just as you can now.  Any chance you know of examples I can reference. I'm a bit of a noob with low level programming.

Thanks,
Sean



0
 
LVL 53

Expert Comment

by:Infinity08
ID: 21796323
Depending on how the makefile is set up, it could look something like this (assuming that the external assembler is called hsw12) :

mod.o : mod.asm
      cmd_that_compiles_mos.asm_into_mod.o_here

code.o : code.c
      gcc -c code.c

executable : code.o mod.o
      gcc code.o mod.o -o executable
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question