Assembling with GNU and ADS

Hi,

I want to be able to build my project with both the ARM ADS and GNU tools. This is relatively easy for the C files, however, it is proving very difficult (actually impossible) to do this for assembly files. Anyone know of a clever trick (pre-processor?) that allows me to maintain a single assembly source file and assemble it with either GNU GAS or ADS ?

TIA, HG

Reply to
HG
Loading thread data ...

For our kernel I use a combination of C-Preprocessor and perl. I.e. I have one source that I pre-process to get ADS,IAR and GNU assembly.

This works fine (I do this for various CPUs).

--
42Bastian
Do not email to bastian42@yahoo.com, it's a spam-only account :-)
Use @epost.de instead !
Reply to
42Bastian Schick

Any chance of an example of what you mean ?

TIA, HG

Reply to
HG

snipped-for-privacy@hotmail.com (HG) wrote in news: snipped-for-privacy@posting.google.com:

This is a total hack and probably most offensive to perl experts, but worked for me where I had to take a GAS file and assemble it using ADS:

while () { s/@/ ;@/; s/^(\w+):/$1/; s/\.section.*/ AREA |x|,code,readonly/; s/\.equ ([^\s]+),\s+([^\s]+)/$1 equ $2/; s/\.global\s+([^\s]+)/ EXPORT $1/; print ; } print "\n END\n";

Obviously you'll have to extend it to cover GAS keywords that weren't in the code I was assembling. Just pipe the GAS file through the perl to get ADS compatible code...

Peter.

Reply to
CodeSprite

In my source I have: #define ARM 1 #define GNU 2

#if COMPILER == ARM

MACRO SC_FUNC32 $name CODE32 EXPORT $name $name MEND

#define LONG DCD #endif #if COMPILER == GNU .macro SC_FUNC32 name .code 32 .type \name,function \name: .endm

#define LONG .long #endif

Inside the source I only use macros for things that are specific to an assembler.

Two produce the actual files I'll pre-process the original source gcc -E -DCOMPILER=1 source.S >source_ads.s or gcc -E -DCOMPILER=2 source.S >source_gnu.S

Net effect: Comments are stripped if written as C comments.

After the above state you might use a simple C program or perl script to remove empty lines.

--
42Bastian
Do not email to bastian42@yahoo.com, it's a spam-only account :-)
Use @epost.de instead !
Reply to
42Bastian Schick

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.