1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Assembling with GNU and ADS

Discussion in 'Embedded' started by HG, Jun 30, 2004.

  1. HG

    HG Guest


    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
    HG, Jun 30, 2004
    1. Advertisements

  2. 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

    This works fine (I do this for various CPUs).
    42Bastian Schick, Jun 30, 2004
    1. Advertisements

  3. HG

    HG Guest

    Any chance of an example of what you mean ?

    TIA, HG
    HG, Jul 1, 2004
  4. HG

    CodeSprite Guest

    (HG) wrote in
    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/\.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...

    CodeSprite, Jul 1, 2004

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

    #if COMPILER == ARM

    SC_FUNC32 $name
    EXPORT $name

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

    #define LONG .long

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

    Two produce the actual files I'll pre-process the original source
    gcc -E -DCOMPILER=1 source.S >source_ads.s
    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 Schick, Jul 2, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.