Author Topic: declaring definitions valid only for .S files  (Read 3083 times)

Offline zainka

  • Multiple posting newcomer
  • *
  • Posts: 14
declaring definitions valid only for .S files
« on: October 13, 2009, 04:06:45 pm »
Hi

This may be a simple problem, maybe even stupid, but I have a project which includes among a long list of .c and .h files also a few .S files (aka assembly). Problem is that this project is working perfectly by using external Makefile (well, thats not a problem) and is based on a tutorial from atmel found here, http://www.atmel.com/dyn/resources/prod_documents/at91sam7s-ek.zip, if interested. (basic pwm project for GNU).

By some reason, call it curiosity, we want to move the entire project into CB without using the existing Makefile but by setting it up through CB build options. Now, the problem is that both the .S file and a few .c files includes a common file, aka AT91SAM7S64.h . This .h file can be conditional compiled by setting the definition __ASSEMBLY__ . However, the original makefile knew when compiling .S files and when dealing with .c files and thus declared __ASSEMBLY__ only when compiling the .S file.

I might reveal my self as a nobe now, but I do have problems seeing how I can declare the definition of __ASSEMBLY__ making it available only when compiling .S files and not for ordinary c source. I have added the Makefile (and also added .txt extension to make it uploadable) used externally for you to see how it is written in hope to gain some tip of how to move its functionality into CB.

Do not hesitate to ask for more info if needed.


Breg
Vidar


[attachment deleted by admin]

Offline zainka

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: declaring definitions valid only for .S files
« Reply #1 on: October 13, 2009, 04:17:51 pm »
Hmmm....

I have always wondered how many topics has been written where the author himself have been revealing the solution before anyone else has been able to react. As never beeing one of them my self before I can no happily add my self to the list. I guess the length of this list must have somthing to do with the effect it has to describe the problem literally, clarifying the brain.

But ofcourse..
-Wa,<option>   is the solution, passing options to the compiler which should be valid for the assembler only