There are a couple of gotchas that I always have to remember the hard way: 1. The runtime library that you are using (use PalmOSRuntime_2i_A5.lib) must be in the first segment. 2. Your PalmMain function must also be in the first segment. 3. If you aren't worried about code size too much, set your code model to "Smart".
Also, on your runtime library, make sure that your Codewarrior settings match the runtime library. For 2i_A5, make sure that you are using Standard Mode (A5-relative data) in the 68k Target settings, and in the 68k Processor settings, make sure that "4-byte 'int'" is NOT checked. Hope this helps. Cutting your teeth on segments is difficult. -Jon -------------------------------------------- Jonathan Hays Palm OS Certified Developer http://hazelware.luggle.com -------------------------------------------- -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Rick Shory Sent: Thursday, April 22, 2004 12:28 PM To: Palm Developer Forum Subject: multi segment app in CW9.3 This must have been done a million times, but I am stumped. I need to add a new form, which will take my code over the 64k limit. So I need to convert my app to multi segments. I have studied everything I can find for the past two days, and I think I need just a few more clues. I am using CodeWarrior 9.3 for Palm OS, Prof Ed. (?build v.5.2.1283). I have created a new target, copied from my existing Debug target (in which I have temporarily commented out enough code so it still compiles into one segment). In the new target, I have moved my new form's code to its own segment. In attempting compile, I've tried two different linkers, "Palm OS 68k" and (modeled on the CW multi-seg example) the "Macintosh 68k". The first gives a Link Error: PalmOS_Startup.cpp: '__Startup__' 16-bit code reference to 'PilotMain' is out of range. The second gives a Link Error: <appname>.rcp: Illegal object data in '<appname>.rcp'. Banging at the first one, I've tried the Small, Smart, and Large code models. I know this is a common error with the Small model when you go beyond the 32k jump. I have been using the Smart model for months; and remember, it still compiles fine as one segment! I've tried making extern functions of both my new form's HandleEvent function, and PilotMain. I've tried project types of 68k application; Standard, Expanded, and Expanded with A5 jumptable. I've tried "Merge Compiler Glue into Segment 1" both on and off. I of course have "Link Single Segment" unchecked. Working on the second one, I've looked through my <.rcp> file, and everything seems clean and needed. A Palm Whitepaper insists I need to change the runtime library from "StartupCode.lib" to "MSL Runtime Palm OS (xx).lib", but another web hit says this is obsolete after CW v6 and to use "PalmOSRuntime_2i_A5.lib". This library is already in place in both my original project, and the CW multi-seg example. CW Help says single- and multi-seg apps used different libraries, but then lists "PalmOSRuntime_2i_A5.lib" for each. One web hit (for a different dev platform) suggests replacing the Prefix file (currently "PalmOS_Headers_Debug") with a new one that contains: #define UL_ENABLE_SEGMENTS #include "PalmOS_Headers_Debug" No change. I also tried it with no prefix file, after the multi-seg example. Another web hit offers the idea of putting pragma statements throughout the code, to force compilation into different segments, but that seems to defeat the whole CW segmentation scheme. I am out of ideas, and would welcome any advice! -- Natural Resource Ecology Laboratory A225 1231 East Drive, Colorado State University (shipping: 1499 Campus Delivery Fort Collins CO 80523-1499) phone 970-491-5835, fax 970-491-1965 -- 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/
