[EMAIL PROTECTED] wrote:
> what is wrong with my code? is there anything i can do to fix it?

The error you're getting looks just like what happens when
you overflow the 64K limitation on segment size.  The solution
is to move to a multisegment (multisection) build.  This is
done differently in CodeWarrior and PODS.  I'll include something
I wrote up a while back to get you started.  This is for PODS,
not CodeWarrior:

==============================
Symptom: this error message:
/usr/m68k-palmos/bin/ld: region coderes is full ...
/usr/local/m68k-palmos/lib/<filename>.o(.text_0x<nn>):<filename>.c: relocation 
truncated to fit: DISP16 <function_name>
... ld returned 1 exit status
==============================

> I didn't find any info in PODS on how to do multisegmenting with managed
> make,...

This really should be written up decently somewhere and put on
a web page.  The only polished presentation of the subject I know
of is in Chapter 24 of the book Professional Palm OS Programming
(Wrox).  I've found that to be a decent resource, BTW.  It's more
up to date than Palm OS Programming Bible (IDG Books), previously
written by the same author.  The new book has some coverage of
PODS.  Check it out.

In case you need it, here is a copy of my notes on going multisegmented
(including some quoted comments from other list subscribers and things
I found on the net -- thanks guys, and sorry I didn't include credits).
My comments are in square brackets.

================== Multisection/Multisegmented Applications =======

1 - Create a "Managed Make 68 C/C++ Project" (only managed project works
with me)
2 - Create a file named "Sections.def" in the root of your project
3 - In the top of "AppMain.c" or equivalent, include the file "Section.h"
4 - Now, edit the file "Sections.def" and "Sections.h" to define what
sections your project will have.

Sample: "Sections.def"
=======================
application { "_temp_" TEMP }
multiple code { "code1" "code2" }
=======================
[You must have at least one segment in the 'multiple code' definition.
The names must match those in Sections.h. Try to minimize the number
of sections you define and use, while making sure none of them grow
too big. In place of "_temp_", use your application's name. In place
of "TEMP", use your Creator ID.]

Sample: "Sections.h"
=======================
#ifndef _SECTIONS_H
#define _SECTIONS_H
#define EXTRA_SECTION_ONE __attribute__ ((section
("code1")))
#define EXTRA_SECTION_TWO __attribute__ ((section
("code2")))
#endif
=======================
[The names (here code1 and code2) can be whatever you want, but must
match those in Sections.def. You can use whatever you want as the
symbol defined.  Here, it's EXTRA_SECTION_*, but could be anything.
You will use it again in #5, just below.]

5 - On the function definition specify what section will be used, the non
specified functions will be redirect to default section code.
[Try to group functions together to minimize the jumps between sections.
Be careful not to miss any, because they will default to your first
section, and possibly make it too big.]
Sample:
=======================
// [Here's where the compiler learns where to put the function:]
static void myfunc() EXTRA_SECTION_ONE;
// [Remember to add the macro every time you add a new function to your
// application!]

static void myfunc() {
// `the code`
}
=======================
If your project have a section defined and don't use it anywhere, you got a
error. So, you need use the sections defined one time at least, or don't
define it.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 For a managed project, in your project properties, you need to go to the
 build panel and choose the prc-tools-68k-compiler->Symbols section and
 add a line:

 MULTISECTION_BUILD=true

 to make the managed project look for your .def file. If you do everything else
 in the prior posting it should then work. (The stock Sections.h file said to 
use
 MULTIPLE_CODE_SECTIONS, but that didn't work. I found the definition above
 by looking at the generated objects.mk file.)
[I tried this and it worked; I didn't try MULTIPLE_CODE_SECTIONS - JT]

 NB It also seems to require that some function be in each section or it will
 complain about the section not existing at link time.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[Also, it might help after adding the files to the project, right click
on the project's name in the Navigation window and select Refresh,
before building the project.]

Jay Ts

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to