I went through my program for the 8051 and split every one of the headers into a header.h with declarations and a source.c with all the code. I had to add 'extern' in many of the files. Now the memory map has sections from a through g, and all of the gaps are filled up.
I'll certainly remember this lesson in proper style! Thank you for taking the time to correct my misunderstanding about headers and source.
--- On Mon, 10/29/12, Maarten Brock <sourceforge.brock@...> wrote:
> From: Maarten Brock <sourceforge.brock@...>
> Subject: Re: [Sdcc-user] About "memory gap" between register file and bit-variables (MSC-51).
> To: sdcc-user@...
> Date: Monday, October 29, 2012, 12:19 PM
> Hi Rich,
> > Placing the variable definition in a source.c file
> instead of in a
> > header.h file works very nicely to fill in the memory
> > Placing the variable definition in a header.h file does
> not fill in the
> > 'memory gap'.
> Of course it doesn't. Only .c files are compiled into an
> object and it's
> actually per object file that the linker places the memory
> >> From what I've read on the internet about the topic
> of how and when to
> >> use header files and source files, it would seem
> that placing a global
> >> variable in a header or in a source file should not
> make much difference.
> Placing variable definitions in a header file is a very bad
> style and should be avoided at all times. Only place
> declarations in
> header files.
> >> I would assume that SDCC is fully ANSI C
> compliant in this area.
> SDCC will give an error when you try to compile a header
> file with:
> sdcc -c header.h
> > In this case, with SDCC compiling for an 8051, it makes
> a big difference.
> > Being able to use that block of 24 bytes of ram, will
> really help. I'm
> > guessing that allocating bytes of ram based on source.c
> files is not even
> > mentioned in ANSI C! I couldn't find anything in
> the SDCC manual on this
> > topic.
> > Thanks, Rich.
> The Windows 8 Center - In partnership with Sourceforge
> Your idea - your app - 30 days.
> Get started!
> Sdcc-user mailing list