Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Real-Time Software Components (RTSC) » Object & Target Specific Build Options?
Object & Target Specific Build Options? [message #484935] Wed, 09 September 2009 18:58 Go to next message
Eclipse UserFriend
Originally posted by: a-seely.ti.com

I am trying to compile BIOS V6 as from CCSV4 with a bare-metal arm-gcc
toolchain (4.4.1) and binutils (2.19).

BIOS has a few assembly language files that include "C" header files with a
line in the assembly source containing a directive ".CDECLS ... header.h"

This is a feature of the TI assembler that will allow the use of macro
definitions from C header files.

I don't see any equivalent *directive* in GAS. You can use a
include directive but that's not for "C" it's for assembly.

However, you can invoke gcc with the following options:
-P -imacros=headerfile -x assembler-with-cpp
And it has the same effect as the TI .CDECLS directive.
The C header is preprocessed but only macro definitions are set,
there is no other output (not even comments -P) then the assembler is run.

That much is ok. I've tried this from the command line and it works fine.

My problem now is to get the same effect through the XDC build script.

For about six assembly files, there is a *specific* include that is needed.
For example the file Cache_asm.s needs to include
package/internal/Cache.xdc.h
Whereas the file HwiCommon_asm.s needs to incldue
package/internal/HwiCommon.xdc.h.

In other words, for each of these five assembly files, I need to run gcc
with a specific '-imacros <filename>'.

I'm imagining there may be a way to set a target specific 'copts' attribute
- and in fact there are examples of how to do this in the RTSC help in the
Library.addObjects() function.

BUT there are a couple catches.

First catch - is I need to do this only for targets where I've changed the
extension from .s470 (TI 470 assembler) to .sBMArmR4 (gcc bare-metal ARM
R4 target).

Right now I've followed other examples in the BIOS tree and only used the
file basename in the 'objects' list. The local gcc bare-metal ARM R4
target
matches files with extension .sBMArmR4 and only *those* files are the ones
I need to add the -imacro header.h file name to.

Second catch, the build environment for BIOS includes a common build script
that adds all the objects in object list to the library.
So it will already have been added to the library with Library.addObject()
and *after the fact* I'd need to add a specific header file to the gcc
command line for each of the individual assembly files.

I'm looking for some suggestions on how this might be accomplished; or
maybe
an idea on a different way to tackle the issue.
Re: Object & Target Specific Build Options? [message #485127 is a reply to message #484935] Thu, 10 September 2009 15:01 Go to previous messageGo to next message
Dave Russo is currently offline Dave RussoFriend
Messages: 172
Registered: July 2009
Senior Member
comments embedded below

Anthony Seely wrote:
> I am trying to compile BIOS V6 as from CCSV4 with a bare-metal arm-gcc
> toolchain (4.4.1) and binutils (2.19).

This question isprobably best answered by the BIOS team, but I'll give
it a shot below (and forward this question to them).

[snip]

> For about six assembly files, there is a *specific* include that is needed.
> For example the file Cache_asm.s needs to include
> package/internal/Cache.xdc.h
> Whereas the file HwiCommon_asm.s needs to incldue
> package/internal/HwiCommon.xdc.h.
>
> In other words, for each of these five assembly files, I need to run gcc
> with a specific '-imacros <filename>'.
> I'm imagining there may be a way to set a target specific 'copts' attribute
> - and in fact there are examples of how to do this in the RTSC help in the
> Library.addObjects() function.
> BUT there are a couple catches.
> First catch - is I need to do this only for targets where I've changed the
> extension from .s470 (TI 470 assembler) to .sBMArmR4 (gcc bare-metal ARM
> R4 target).
> Right now I've followed other examples in the BIOS tree and only used the
> file basename in the 'objects' list. The local gcc bare-metal ARM R4
> target
> matches files with extension .sBMArmR4 and only *those* files are the ones
> I need to add the -imacro header.h file name to.
>
> Second catch, the build environment for BIOS includes a common build script
> that adds all the objects in object list to the library.
> So it will already have been added to the library with Library.addObject()
> and *after the fact* I'd need to add a specific header file to the gcc
> command line for each of the individual assembly files.
>
> I'm looking for some suggestions on how this might be accomplished; or
> maybe
> an idea on a different way to tackle the issue.

It might be easier to include this option for all objects and structure
the header to only conditionally define macros for the specific target
you've created.

If your target follows the pattern of other targets there are a number
of target-specific macros that are defined for any file including std.h;
http://rtsc.eclipse.org/cdoc-tip/xdc/package.html#xdoc-sect- 5

In particular, if your target is ti.targets.arm.BMArmR4 you can create a
header like the following:
#ifdef ti_targets_arm_BMArmR4
:
#endif

You can also include #ifdef that reference symbols defined by your
compiler. In this way the header can safely be included by _all_ files
and you do not need to apply the -macros option selectively.

But, again, the BIOS team might have a better answer for their build setup.
Re: Object & Target Specific Build Options? [message #485183 is a reply to message #484935] Thu, 10 September 2009 18:09 Go to previous message
Sasha Slijepcevic is currently offline Sasha SlijepcevicFriend
Messages: 115
Registered: July 2009
Senior Member
Anthony,
you probably created your target from some of the existing targets. Most
of the targets have the configuration parameter 'asmOpts'. You could add
following to your target in config.bld ONLY when you build BIOS 6.

targ.asmOpts.suffix = "-P -imacros=package/internal/$(subst
_asm,,$(basename $(notdir $@))).xdc.h -x assembler-with-cpp";

I haven't really tested if the make function calls I used are just right,
so you might need to make some edits but you can tell where I am going
with it.

This is a hack that relies on knowing what's inside our generated
makefiles, so if you decide to try it, you probably want to use it only
until the BIOS 6 build system adds some options to let you specify per
file command line options.
Previous Topic:Finding out the size of the structure in xs file
Next Topic:whole_program compilation failure - invalid intermediate file (ti.targets.rts6000.a64P)
Goto Forum:
  


Current Time: Fri Oct 11 03:09:08 GMT 2024

Powered by FUDForum. Page generated in 0.03838 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top