This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: gcc & assembly coding conventions ??


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

Regards,
--
Richard Sewards
richard.sewards@navtelcom.com

-----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 &
gas
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
years
ago I dedicated a section to defines or equates, a section to data
space,
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
correct
structure and declarations that I need to use?
Thanks  for your patience & help,
Garret


Refernce:
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
another?

// 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
MBAR
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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]