This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
share constants between C and assembly ?
- To: help-gcc at gnu dot org
- Subject: share constants between C and assembly ?
- From: d_cary at my-deja dot com
- Date: Wed, 05 Jan 2000 18:06:19 GMT
- Newsgroups: gnu.gcc.help
- Organization: Deja.com - Before you buy.
- Xref: wodc7nx0 gnu.gcc.help:2362
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.