public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* share constants between C and assembly ?
@ 2000-01-05 10:27 d_cary
  2000-04-01  0:00 ` d_cary
  0 siblings, 1 reply; 2+ messages in thread
From: d_cary @ 2000-01-05 10:27 UTC (permalink / raw)
  To: help-gcc

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* share constants between C and assembly ?
  2000-01-05 10:27 share constants between C and assembly ? d_cary
@ 2000-04-01  0:00 ` d_cary
  0 siblings, 0 replies; 2+ messages in thread
From: d_cary @ 2000-04-01  0:00 UTC (permalink / raw)
  To: help-gcc

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-05 10:27 share constants between C and assembly ? d_cary
2000-04-01  0:00 ` d_cary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).