gcc & assembly coding conventions ??

Richard Sewards richard.sewards@navtelcom.com
Thu Sep 11 18:58:00 GMT 2003

Arguably, you should not be editing an assembler source file at all.  It
is possible to do everything using C and inline assembler, including CPU
startup code (I have done it for an 8240 boot ROM monitor).  Then you
can use #define, const, etc. and write most of your code in C.  I have
always found C + inline assembler to be easier to deal with than pure

Richard Sewards

-----Original Message-----
From: garret.spears [mailto:garret.spears@comcast.net] 
Sent: Wednesday, September 10, 2003 4:07 PM
To: gcc-help@gcc.gnu.org
Subject: gcc & assembly coding conventions ??

Sorry to bother you with the following.  I have looked thru the gcc &
manuals and I am coming up without any answers.
I haven't done this for many years, many years.  I am trying to write
assembly code for a coldfire processor.  Essentially when I did this
ago I dedicated a section to defines or equates, a section to data
and a section to code - assembly language.
I may be confused on naming or identifying these sections now.
I am creating a file called foo.S and placing my sections into it.  So
far I
get errors saying the line "mbar equ 0x10000000" is not an instruction.
Is there a place that I should be going that will lead me thru the
structure and declarations that I need to use?
Thanks  for your patience & help,

gcc-2.95.3 -m5200 -x assembler led.S

Led.S consists of the following first 20-30 lines

#DEFINE INIT_SECTION_ASM_OP  // is this a requird line or should ther be

// Base addr of internal resources & SIM resources
MBAR    EQU    0x10000000                // alt I have seen ".set
MBAR=0x10000000" but the manual shows an EQU syntax
// Exception base addr to vector table
VBR     EQU     0x00000000
// Starting location of internal RAM & types of access
RAMBAR  EQU     0x30000000
//DRAM base address & permissions, $00000000
DRAM0   EQU     $0000

// System integration Module config register
SIMR       EQU      MBAR+$0003            // same problem here because
is undefined
// Pin assignment register
PAR        EQU      MBAR+$00CB

Should I be using a dot h file for some of this and a dot s file for my
actual assembly coding?

More information about the Gcc-help mailing list