Solved

How to call an external compiler for inline ASM in gcc

Posted on 2008-06-15
7
521 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 100 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 400 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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ejb entity bean example 2 57
Using Third Party DLL with Access VBA 14 65
$_GET call between URL 3 69
Bitwise and to sum elements 2 54
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

751 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