The problem I've had at least three times is I don't get link errors. Once
my segment was just a little over the size limit and twice I had syntatic
errors that weren't detected by the compiler. In the latter two cases I had
some fairly complicated code that looked ok to me. With my failing memory I
was able to remember all the changes I made and go back and do the more
complicated ones differently. Both times after redoing the code - mostly to
break up all the stuff that was on one line - it Hotsynced correctly.
Thanks for your reply.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Eric
VERGNAUD
Sent: Wednesday, June 25, 2003 8:50 AM
To: Palm Developer Forum
Subject: Re: Bad executable generation
le 25/06/03 14:22, Roger Stringer � [EMAIL PROTECTED] a �crit�:
>
>> Subject: Bad executable generation
>> From: "Dave Mottorn" <[EMAIL PROTECTED]>
>>
>> I'm using Codewarrior 8.32 to develop a program that now has
three
>> segments. I don't think there are any later updates to version 8. Last
>> night I made a few changes and compiled and linked the program. I didn't
>> get any error messages but when I tried to install the new version on my
PDA
>> it not only didn't install the new version, it removed the application.
I
>> had the same problem once before but that was because one of the segments
>> was a little too large and the linker didn't detect it. This time I'm
sure
>> the segments are all in bounds. It must be a programming error that
>> CodeWarrior doesn't detect but I haven't been able to find it. Any
Ideas?
>
> If you are using multiple segments, then you should set your compiler to
be
> "Small" as this will maximize performance and minimize program size.
This
> also means your segments should not be greater than 32K and nowhere nearer
> the HotSync-driven 64KB limit.
> ** Actually the segments can creep a little over 32KB, but you'll get link
> errors once they get too big.
>
Sorry to have to mention this, but you can - and should as much as possible
- grow your segments to the 64k limit.
This is because calling one function from one segment to another is much
more time and space consuming than calling it within the same segment. So if
you can have 2 segments instead of 4, your code will be smaller and more
efficient.
It is true that you may get some link errors when doing this with code model
set to "Small". This is because when set to "Small", a jump address within a
segment uses only 2 bytes (the relative offset) so it is limited to +- 32k.
This can be solved by reordering your code in the 'segment' panel, and
ensuring that calls within a segment are inside this limit. You do this by
changing the files order inside a segment, or the methods order inside a
file.
Sometimes, due to the code itself, this cannot be achieved. In that case, if
you have only 1 or 2 link errors, you can create what is known as an
'island':
For example:
MethodAtBeginningOfSegment()
{
}
MethodAtEndOfSegment()
{
MethodAtBeginningOfSegment();
}
may lead to an unsolvable link error if your segment size is > 32k. The
'island' technique leads to the following:
MethodAtBeginningOfSegment()
{
}
IslandInMiddleOfSegment()
{
MethodAtBeginningOfSegment();
}
MethodAtEndOfSegment()
{
IslandInMiddleOfSegment();
}
Which will solve the link error.
Please note that this technique is only useful when there are only very few
unsolvable link errors, otherwise it leads to lots of space consumption and
overhead, which is exactly what you're fighting against.
-------------------------------
Eric VERGNAUD - JLynx Software
Cutting-edge technologies and
services for software companies
web: http://www.jlynx.com
-------------------------------
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/