Palm Development using 3.01 BETA2
Seems mostly OK, but I do have one issue.
I can build and run on the simulator OK (but slow). However, I have problems HotSyncing the PRC file to the device.
I am using a Tungsten E. I start with a fresh, hard reset device and a new HotSync user. A basic sync works OK. Then I drag the PRC to QuickInstall, and sync. The sync hangs at the "Cleaning up - please wait" stage.
If I soft reset, it hangs at the Palm splash screen. So I have to hard reset. Then I'm back where I started.
This also happens on Tungsten T3.
The thing is, I went back to what I'm pretty sure is a version of my PRC that worked properly. It simply won't sync to the device. Again it runs fine in the simulator, and used to run fine on the device.
Does anyone have any idea why this happens? I know HotSync hangs are fairly common, but usually they are solved by a soft reset. And why would a previous version stop working? What settings should I be checking for potential problems?
So right now it seems like a bit of touch and go whether I can get something to work on my actual device. I had problems before, then they went away for a while, now they are back. It's weird because I'm starting from a hard reset, new user, so everything should be fresh.
I spent several hours methodically tracking the problem down. (You're welcome.)
I still haven't solved it, but I currently believe the problem is related to starting from a copy of the sample project.
Therefore, I ask, were the samples created fresh or from copies? (I assume fresh.)
Secondly, I request DETAILED instructions on EXACTLY how to create a new GapiDraw BETA2 Palm project from scratch. I will try then this and see how it affects the problem.
This is a real issue for GapiDraw, since the problem is completely reproducible on my device (and also T3), and most real-world developers are going to do exactly what I did (not what VI does).
I forget where I read this (and it was quite recently too) but it seems HotSync and ActiveSync have a problem working in harmony. I've not started any real Palm development, but I plan on setting up a dedicated workstation for it.
Hi Marc,
Please let me get back to you on Monday on this!
//Johan
No problem.
So... has anyone tried using the STL with GapiDraw in CodeWarrior 9.3?
I get problems when it gets to another system header, declaring abs(int). Seems GapiDraw somewhere defined abs as a macro, so when vector is included, it chokes.
Check out include/palm/gapidrawdefines.h. I'm not sure if 3.01b2 is #ifndef abs() #define, or if it simply defines it anyway...
There's a few in there like abs, min, max which are all defined (no check first). I just undef'd it after including GapiDraw headers, and that seemed to compile further, but we should have a proper fix.
Are you testing with STL? Which implementation? I'm going to try just using the one including with CW9.3, but I'll also consider switching to STLport.
Johan, text drawing seems quite slow, on both the T3 and the E. Can you confirm this?
On the E, drawing a full screen image then a bunch of text over top of it (e.g. help screen) is less than 3 fps. On the T3 it's 12-14 fps. This is the slowest screen in the project I am working on.
I spent several hours methodically tracking the problem down. (You're welcome.)
I still haven't solved it, but I currently believe the problem is related to starting from a copy of the sample project.
How big are your resource files? I tried to add files that were exactly 6500 bytes (wich is the limit) when I wrote the resource editor, and HotSync froze on that one. So the solution in this case would be to make sure the resource files are < 6500 bytes (bitmaps and so on..), or to use GapiDraws resource editor when we release it next week.
Therefore, I ask, were the samples created fresh or from copies? (I assume fresh.)
Yes, the samples are created fresh.
Secondly, I request DETAILED instructions on EXACTLY how to create a new GapiDraw BETA2 Palm project from scratch. I will try then this and see how it affects the problem.
I'll write down the steps and post it tomorrow.
I'll write down the steps and post it tomorrow.
Sorry about the delay, but here it is.
Mikael, thanks for the detailed instructions. Allow me to explain my problem.
My environment is CodeWarrior 9.0 immediately updated to 9.2 via CDROM and then 9.3 via the web. I have unzipped PalmOS_5_SDK_68K_R3_noinstall into the CodeWarrior directory.
To make a project, I copy the BETA2 minimal sample directory, and change the .cpp and .rcp file to my own files. I move the .cpp into its own new segment. I add a system access path to the Palm OS Support directory of the aforementioned 5R3 SDK so I can compile, and build a release target.
This build still has the MiNi creator ID. It runs fine in the simulator. It's about 475KB.
It will not sync to my Palm Tungsten E. The device hangs at the "cleaning up" stage of HotSync, requiring a HARD reset. Even after a hard reset, the same result: it won't sync.
However, here is what I have determined. If I FIRST sync the Minimal sample release build, THEN sync my build (the same one that wouldn't sync before), it syncs and runs perfectly.
They are sharing a creator ID, with these results. I see both appear in my programs. I can run both of them. When I check delete programs, I only see my application, and it says it uses 0K of memory. If I then click on "handheld" in "delete from" it refreshes to show only Minimal using 589947K.
This explains why I said before that it seemed sometimes my app had major problems, and sometimes it worked fine. It all depends on whether I had previously synced the Minimal sample. I'm not sure why this is, but maybe it can help explain something.
When I try to change the creator ID, I am unable to sync the build to the device.
Now, I followed your instructions as written, except I only made a release target, and I added the system access path to the Palm OS Support directory of the aforementioned 5 SDK R3, and I used a unique creator ID. One more thing is I used the PalmOSGlue.lib from the 5R3 SDK. (Should I have more recent versions of the other libs?)
So, this build is completely severed from the Minimal sample, no connection. Again, I find it cannot sync to the device. Again, it works perfectly in the simulator. However, installing the Minimal sample first has no effect, it still hangs requiring hard reset when I try to install it on the device. I cannot get this build on my device.
So, I have a solution where I can test on the device for now (share creator ID with Minimal and install Minimal first), but obviously that's not acceptable for a release. What I'd like to know is what is going wrong, and what I need to do to fix it. So if you have any insights or suggestions, I'd be happy to try things out.
To make a project, I copy the BETA2 minimal sample directory, and change the .cpp and .rcp file to my own files. I move the .cpp into its own new segment. I add a system access path to the Palm OS Support directory of the aforementioned 5R3 SDK so I can compile, and build a release target.
This is where the error lies, all code that is run when an application is started must be in the first segment. So if you put the cpp containing the PilotMain function in the first segment it should work. The reason it hangs on HotSync is that PilotMain will be called with a special launch code to let the app know it has been installed.
Ah, that makes sense. When minimal is installed with the same creator ID, that code isn't run at install time. It's strange though that it runs after minimal is installed.
It's been awhile since I've programmed for Palm OS. Damn I hate segments!
You'd think the Palm OS would have some sort of error checking for this? Guess not.
In BETA2, we still seem to be missing a lot of _TCHAR related defines. E.g. _tcschr
Mikael wrote:
To make a project, I copy the BETA2 minimal sample directory, and change the .cpp and .rcp file to my own files. I move the .cpp into its own new segment. I add a system access path to the Palm OS Support directory of the aforementioned 5R3 SDK so I can compile, and build a release target.
This is where the error lies, all code that is run when an application is started must be in the first segment. So if you put the cpp containing the PilotMain function in the first segment it should work. The reason it hangs on HotSync is that PilotMain will be called with a special launch code to let the app know it has been installed.
When I create segment 1 just containing the program source file, it says it is code 26K and data 22K, yet still complains that it is over 64000 bytes in size. Any idea why?
I'm not sure, but it could be that the code goes over 64000 bytes when the linker is done with it. The simplest soulution would probably be to put PilotMain in it's own cpp file, that way all other code can be moved to another segment.
Mikael wrote:I'm not sure, but it could be that the code goes over 64000 bytes when the linker is done with it. The simplest soulution would probably be to put PilotMain in it's own cpp file, that way all other code can be moved to another segment.
Yes that was going to be my next move.
Mikael, I changed my application to have only PilotMain in segment 1, and to have it's own Creator ID.
It still will not sync to my device, hanging at cleanup.
Your explanation (PilotMain must be in first segment, and runs on first installation) explains why my app wouldn't install unless Minimal (same Creator ID) was installed first, but it does not explain why my application would run *after* Minimal was installed, and it does not explain why it won't install now that this is fixed.
Is there anything else it could be? Is there anything else I should try?
This was solved by moving the proper libraries to also be in segment 1 as they are required. All is working fine now.
I'm still a little concerned about how a GapiDraw game on Palm interacts with the rest of the system.
It must be compiled with 4-byte ints, because the GapiDraw library is compiled with 4-byte ints, correct?
Doesn't that mean, that any call to sprintf with format specifier "%d" will silently print incorrectly? That's what I have found to be the case, presumably because sprintf is expecting a 2-byte int, but we are marshalling a 4-byte int. The typical symptom is that "0" is printed.
Doesn't that mean, that any other lib we use must also have been compiled with 4-byte ints? What if we can't obtain such a version of that lib, and cannot recompile it ourself?
Even if we have the source code to a third party lib, we'd have to go through it and manually adjust all the "%d" specifiers, right?
Am I understanding these issues correctly? Is there an easier way to address them?
It must be compiled with 4-byte ints, because the GapiDraw library is compiled with 4-byte ints, correct?
That's what I thought when I wrote the samples, but after a quick test it turns out that this is not the case. At least the simple demo works just as well if you use 2-byte ints. Just remember to replace the runtime and C++ libs with the 2i versions. My guess is that it does not affect any other library whatever size you use on the ints. Please tell me if someone experience anything else.
On the %d formatting option for sprintf, this is a Palm thing, it will work with ints if you use the %ld option instead. You can find more information on this in the PalmOS documentation for the StrPrintF function.
Mikael wrote:
On the %d formatting option for sprintf, this is a Palm thing, it will work with ints if you use the %ld option instead. You can find more information on this in the PalmOS documentation for the StrPrintF function.
I still don't understand. The Palm documentation says that "%d" takes a signed integer, and "%ld" takes a signed long.
http://www.palmos.com/dev/support/docs/ ... ml#1065792
Is this because we're using 4-byte ints and therefore the int is as large as a long? If so, wouldn't this considered a bug in the 4i implementation of StrPrintF?