Solved

How to call an external compiler for inline ASM in gcc

Posted on 2008-06-15
7
514 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
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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Device same like our heart 12 85
Crystal Report for VS2013 17 103
Path to Python 9 118
Tax Considerations for positive outcomes, outside the U.S. for IT Professionals 3 42
This article will show, step by step, how to integrate R code into a R Sweave document
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

770 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