Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Common definitions for Assembler and C-source

Common definitions for Assembler and C-source

2005-07-27 by Aalt Lokhorst

Hello all,

I am using Rowley CrossWorks for ARM 1.5 software but I think my 
question is a general GCC question.

I have a startup.s file which contains the vectors, PLL and VPBDIV init 
etc.

The init of UART and Timer is done in 'C'. For a correct init of 
baudrate and timerperiods the C-routines also need to have the PLL and 
VPBDIV settings.

I would like to hava a common config.h for the assembler and the C-files 
with the defines for the PLL, VPBDIV etc. I think this should be 
possible but I don't know exactly how to do this, or if there are better 
options.

Any suggestions? (Or probably some comments why I shouldn't do this)

Thanks in Advance,

Aalt

-- 
==============================
Aalt Lokhorst
Schut Geometrische Meettechniek bv
Duinkerkenstraat 21
9723 BN Groningen
P.O. Box 5225
9700 GE Groningen
The Netherlands
Tel: +31-50-5877877
Fax: +31-50-5877899
E-mail: Lokhorst@...
==============================

Re: [lpc2000] Common definitions for Assembler and C-source

2005-07-27 by Michael Anburaj

Aalt,

with Gcc You can include .h files in both .c & .S
files

#include "config.h"

You can add the above statement in both c & assembly
files & all or most C directive work in assembly too
(compile switches & stuff).

Cheers,
-Mike.

--- Aalt Lokhorst <lokhorst@...> wrote:

> Hello all,
> 
> I am using Rowley CrossWorks for ARM 1.5 software
> but I think my 
> question is a general GCC question.
> 
> I have a startup.s file which contains the vectors,
> PLL and VPBDIV init 
> etc.
> 
> The init of UART and Timer is done in 'C'. For a
> correct init of 
> baudrate and timerperiods the C-routines also need
> to have the PLL and 
> VPBDIV settings.
> 
> I would like to hava a common config.h for the
> assembler and the C-files 
> with the defines for the PLL, VPBDIV etc. I think
> this should be 
> possible but I don't know exactly how to do this, or
> if there are better 
> options.
> 
> Any suggestions? (Or probably some comments why I
> shouldn't do this)
> 
> Thanks in Advance,
> 
> Aalt
> 
> -- 
> ==============================
> Aalt Lokhorst
> Schut Geometrische Meettechniek bv
> Duinkerkenstraat 21
> 9723 BN Groningen
> P.O. Box 5225
> 9700 GE Groningen
> The Netherlands
> Tel: +31-50-5877877
> Fax: +31-50-5877899
> E-mail: Lokhorst@...
> ==============================
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

Re: [lpc2000] Common definitions for Assembler and C-source

2005-07-28 by 42Bastian Schick

Aalt Lokhorst <lokhorst@...> schrieb am Wed, 27 Jul 2005 17:48:53 
+0200:

> I have a startup.s file which contains the vectors, PLL and VPBDIV init
> etc.
>

If you use .S as extension, gcc will first pre-process your file before
handing it over to as.
This allows to use all CPP things.

I normaly use common (chip)header-files and simply put some
#ifdef __ASM_INCLUDED__
#endif
around C/C++ code like structure or typedefS.


-- 
42Bastian Schick

Re: [lpc2000] Common definitions for Assembler and C-source

2005-07-28 by Michael Johnson

Hi Aalt,

CrossWorks for ARM always C pre-processes assembly code files - case 
sensitive filenames on windows can be problematic.

Regards
Michael
Show quoted textHide quoted text
>Aalt,
>
>with Gcc You can include .h files in both .c & .S
>files
>
>#include "config.h"
>
>You can add the above statement in both c & assembly
>files & all or most C directive work in assembly too
>(compile switches & stuff).
>
>Cheers,
>-Mike.
>
>--- Aalt Lokhorst <lokhorst@...> wrote:
>
>  
>
>>Hello all,
>>
>>I am using Rowley CrossWorks for ARM 1.5 software
>>but I think my 
>>question is a general GCC question.
>>
>>I have a startup.s file which contains the vectors,
>>PLL and VPBDIV init 
>>etc.
>>
>>The init of UART and Timer is done in 'C'. For a
>>correct init of 
>>baudrate and timerperiods the C-routines also need
>>to have the PLL and 
>>VPBDIV settings.
>>
>>I would like to hava a common config.h for the
>>assembler and the C-files 
>>with the defines for the PLL, VPBDIV etc. I think
>>this should be 
>>possible but I don't know exactly how to do this, or
>>if there are better 
>>options.
>>
>>Any suggestions? (Or probably some comments why I
>>shouldn't do this)
>>
>>Thanks in Advance,
>>
>>Aalt
>>
>>-- 
>>==============================
>>Aalt Lokhorst
>>Schut Geometrische Meettechniek bv
>>Duinkerkenstraat 21
>>9723 BN Groningen
>>P.O. Box 5225
>>9700 GE Groningen
>>The Netherlands
>>Tel: +31-50-5877877
>>Fax: +31-50-5877899
>>E-mail: Lokhorst@...
>>==============================
>>
>>    
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>  
>

Common definitions for Assembler and C-source

2005-07-28 by Aalt Lokhorst

Thanks Mike and Bastian,

Works nice, this is indeed what I like.
There is only one concern, how about the case sensitivity? Am I just 
lucky that I don't encounter problems in the Windows environment?

Wait.... I am receiving mail of Michael.

Michael writes:
<<CrossWorks for ARM always C pre-processes assembly code files - case
sensitive filenames on windows can be problematic.>>

Wow, the response of Rowley support is impressive. In the past I have 
seen very fast response times of 15 minutes. But now it is -5 minutes. I 
have an answer before I asked the question. Very Good.

Thanks Mike, Bastian and Michael

-- 
==============================
Aalt Lokhorst
Schut Geometrische Meettechniek bv
Duinkerkenstraat 21
9723 BN Groningen
P.O. Box 5225
9700 GE Groningen
The Netherlands
Tel: +31-50-5877877
Fax: +31-50-5877899
E-mail: Lokhorst@...
==============================

RE: [lpc2000] Common definitions for Assembler and C-source

2005-07-28 by Paul Curtis

Aalt,

> Works nice, this is indeed what I like.
> There is only one concern, how about the case sensitivity? Am 
> I just lucky that I don't encounter problems in the Windows 
> environment?
> 
> Wait.... I am receiving mail of Michael.
> 
> Michael writes:
> <<CrossWorks for ARM always C pre-processes assembly code 
> files - case sensitive filenames on windows can be problematic.>>
> 
> Wow, the response of Rowley support is impressive. In the 
> past I have seen very fast response times of 15 minutes. But 
> now it is -5 minutes. I have an answer before I asked the 
> question. Very Good.

I believe there are two issues with case sensitivity.

In the Unix world, the compiler driver sends files with extension .S to
the assemble pre-processed by cpp, whereas files with a .s extension are
sent straight to the assembler--hence, pre-processing is controlled by
the case-sensitive extension, but Windows doesn't have that case
sensitivity (e.g. a plain FAT16 volume with no VFAT).  At a command line
on Windows, TYPE FOO.S is the same as TyPE Foo.S.  Same happens for
C/C++ files, where .C was generally a C++ file and .c a C file, but now
most compilation tools are converging to .c and .cpp.

The second thing, of course, is the #include <Config.h> vs #include
<config.h> if there are two "config.h" files.  In Windows, you have the
possibility of including the wrong file if there are two files with the
same names but different capitalisations.

In general things work--it's moving from Windows case-insensitive file
systems to Unix case-sensitive file systems that usually throw up
problems.

--
Paul Curtis, Rowley Associates Ltd  http://www.rowley.co.uk
CrossWorks for MSP430, ARM, AVR and now MAXQ processors

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.