views:

84

answers:

2

I am working on a large project and now I am stack on this "Near data segment is bigger than 64k" error.

If I comment the "FrmSetEventHandler(frm, DadosConstrutivos1HandleEvent);" on PrvAppHandleEvent in PilotMain the program compiles it nice. If I try to use de call, I got the error message.

I am already using multi-segment and "Expanded Mode".

How do I resolve this?

Thanks Rodrigo Leite Gomide

A: 

Hi Rodrigo,

I don't use CodeWarrior, but I use PocketStudio instead and the "same problem" happens to me a lot.

Each unit is a "segment of code", so when your compiled unit grows larger than 64k of code, the compiler warns you and don't link your code.

Try to move some code from that unit to other one.

Or You can use #pragma:

#pragma segment Seg1

... code ...

#pragma segment Seg2

... code ...

Regards,

Christian.

Christian Almeida
A: 

There's no good way to solve this problem. 68K code in Palm OS can only access a small amount of static program data, as the 68K instruction set only provides a +-32K offset for addressing data. It would require a major change to the compiler to support going further, as the compiler would need to generated code to do complex pointer arithmetic, and neither CodeWarrior or prc-tools support this.

Here's some tips:

  • If you have large data tables, try moving them into their own resources where you will load and lock their location at runtime. That will move them out of the data section.
  • Turn on the linker map feature and look at how your data section is being allocated and see if there are large data objects or arrays that you don't need.
  • Instead of declaring global variables, use global pointers to memory you allocate using MemGluePtrNew.
Ben Combee