[En-Nut-Discussion] How to incorporate additional linker flags into nutconf's

Henrik Maier hmnews at proconx.com
Thu Feb 5 01:07:51 CET 2009


Hi Uwe,

Back then the challenge was to add a -Tdata=0x801100 flag to the build of
applications. The way I resolved this was to make a change to
Makedefs.avr-gcc and an entry to os.nut so this linker option can be set by
Nutconf. However this works only for the -Tdata linker option.

In your case you want to define a new section called "aram" and it would be
nice if one could simply add LDFLAGS+=-Wl,--section-start=.aram=0x801100 to
either UserConf.mk or NutConf.mk. However I found that LDFLAGS is later
overridden again, so you could use the HWDEF variable instead:

HWDEF+=-Wl,--section-start=.aram=0x801100

If we would change in Makedefs.avr-gcc:

CPFLAGS   = ...
LDFLAGS   = ...

To 
 
CPFLAGS   += ...
LDFLAGS   += ...

then the UserConf.mk and NutConf.mk would become more useful as they can be
used to add custom options to the build process (Harald, what do you
think?).


Henrik
http://www.proconx.com


> -----Original Message-----
> From: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-
> bounces at egnite.de] On Behalf Of Uwe Bonnes
> Sent: Thursday, 5 February 2009 4:33 AM
> To: en-nut-discussion at egnite.de
> Subject: [En-Nut-Discussion] How to incorporate additional linker flags
> into nutconf's
> 
> Hello,
> 
> has the proposed way to incorporate additional linker flags changed since
> the discussion in 2005:
> 
> "How to incorporate the linker flag -Wl,-Tdata=0x801100 into nutconf"
> 
> Harald explained:
> : >* How to incorporate the linker flag -Wl,-Tdata=0x801100 into
> : > nutconf's build model. All apps compiled for the AT90CAN128
> : > require relocation of
> : >.data/.bss into the external RAM.
> 
> : Well, hum... complicated stuff. For several times I tried to
> : implement a more consistent configuration for compiler/linker
> : options, but every time I got stuck somewhere. If you want to
> : do it in short time
> :
> : a) Create new Make*.avr-xgcc files and update nutsetup.
> : (nutconf will detect them automatically)
> :
> : b) or implement a new Makefile macro for additional
> : linker options. In this case, nutsetup and the Lua scripts
> : have to be modified.
> :
> : I assume that option a) can be done easily. Option b) is much
> : better and has the potential to expand to fully configurable
> : compile options. But that's where I got stuck in the past.
> 
> My programm should run on boards with and without external RAM. Some
> hardware detection is done, and external RAM is only accessed when
> it is really there.
> I define the variables in external RAM like:
> volatile unsigned long int nco_r[4]  __attribute__ ((section (".aram")));
> and give the additional linker flag
>  -Wl,--section-start=.aram=0x801100
> and I also have adapted the linker script.
> 
> By placing the variables like:
> volatile unsigned char * alu_ctl= (unsigned char *)      0xe000;
> I think, I need additional RAM on the heap from builtin ram to hold the
> pointer and need more memory access.
> 
> Bye
> --
> Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de
> 
> Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
> --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list