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]

share constants between C and assembly ?


I'm going through my include files one more time to make sure they are
consistent.

My assembly language files mention
  INCLUDE hardware_h.s
while my C language files mention
  #include "hardware.h"

As I compare these files to make sure that whenever I change
          PWM0 EQU 0xFFFF1000
in hardware_h.s, I remember to change
  #define PWM0 0xFFFF1000
in hardware.h to match.

I keep thinking "There must be a Better Way". Couldn't I somehow
define these things in one place that can be accessed by both
C and assembly code ?

I already pass the locations of variables and functions that I share
between C and asm with
  EXPORT fast_fft
  IMPORT _main
  EXPORT atm_buffer
  IMPORT version_string
and
  extern void fast_fft( float * time, float * frequency );
  extern int atm_buffer[256];
  extern const char version_string[] = "SpiffyProg " __DATE__ __TIME__;
.

It would be really cool if I could just reference C language definitions
  INCLUDE hardware.h
in my assembly language file, or alternatively, reference assembly-
language equates
  #include "hardware_h.s"
in my C language file.

Then everything would be defined in one place, self-consistent with
itself, and I would save a lot of time manually consistency checking
(and getting weird errors when I miss an inconsistency).


Sent via Deja.com http://www.deja.com/
Before you buy.

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