Extend your 50g with C DRAFT/WIP



#8

http://sense.net/~egan/hpgcc/

I started on this 6 months ago. What I thought was a weekend project turned in to multiple weekends. I have been dragging my feet on completing this because of the uncertainty of the 3.0 release date and lack of time.

This document is split up into two parts. The first part is to help new users get started with HPGCC. The 2nd part has examples of porting existing C code to the 50g (examples 3 and 4 have some animations, Ex4 is WIP). Three new HPGCC libraries get created in the process:

  1. c9x-complex (Complex number library)
  2. CSparse (Sparse matrix library)
  3. LibTomMath (Large integer library)
This document was written for Windows, but requires Cygwin/X if you want to use HPAPINE. HPAPINE is prebuilt for you. Linux and Mac users should have no problem following along since Cygwin/X was used.

In any case, I am looking for feedback. Feel free to email me with comments and suggestions.

Thanks.


#9

Hi Egan and Happy New Year to everyone.

This is an awesome tutorial on getting started with hpgcc! For anyone interested in C development on the 50g, I urge you to download Egan’s tar and work through the examples. This is the clearest introduction yet and everything you need is in the one download. Excellent work!

I really like the idea of packaging functions into libs that become extensions to the base system. There’s great scope here for a user community extension library that would contain a whole bunch of handy advanced and useful new functions. The concept of UserRPL wrappers means there’s a natural trade off between RPL and C. The RPL can add flexibility and the C performance. Such a library could thus contain either/or at various levels of C vs RPL encoding.

I wanted to work through the whole article before posting, but there’s quite a lot of stuff here and some very interesting articles in their own right, eg, pie shootout! But I must post anyway.

I had a few problems, firstly the hpgcc toolchain didn’t work under vista. XP is fine. Also, you need all the X11 cygwin bits to link the _local versions. Also, the X server won’t start unless you’ve installed cygwin in unix line endings mode (not sure why this is).

I’m currently battling another mystery problem where the compiler bails. “make agm_local” not inside an xterm gives me, “fatal error – couldn’t allocate heap, win32 error 487 ...”. This works inside an xterm, incidentally. So, i continue in an xterm to get, “make –f Makefile.hpgcc” inside complex/c9x-complex. This gives “This application has requested the Runtime to terminate in an unusual way.” Some googling thinks this is something to do with bogus version 7, msvcrt.dll around. Haven’t resolved this yet, so im stuck.

One question; Is there a cut-and-paste way to install the wrappers. Eg. Something like create a text file on the SD card with the UserRPL and then do something to load it? Also, what is this mystery text; %%HP: T(3)A(R)F(.); I know im missing something obvious here.

Great stuff!


#10

Quote:
This is an awesome tutorial on getting started with hpgcc! For anyone interested in C development on the 50g, I urge you to download Egan’s tar and work through the examples. This is the clearest introduction yet and everything you need is in the one download. Excellent work!

Thanks!
Quote:
I had a few problems, firstly the hpgcc toolchain didn’t work under vista. XP is fine. Also, you need all the X11 cygwin bits to link the _local versions. Also, the X server won’t start unless you’ve installed cygwin in unix line endings mode (not sure why this is).

I'll make a mental note to improve the Cygwin/X install notes. I think I just took all the defaults and it worked just fine.
Quote:
I’m currently battling another mystery problem where the compiler bails. “make agm_local” not inside an xterm gives me, “fatal error – couldn’t allocate heap, win32 error 487 ...”. This works inside an xterm, incidentally. So, i continue in an xterm to get, “make –f Makefile.hpgcc” inside complex/c9x-complex. This gives “This application has requested the Runtime to terminate in an unusual way.” Some googling thinks this is something to do with bogus version 7, msvcrt.dll around. Haven’t resolved this yet, so im stuck.

The first problem may be that HPAPINE was build for Cygwin/X and HPGCC was not. I only tested in an Xterm.

The 2nd problem I have not been able to duplicate. I'll try a different machine.

Quote:
One question; Is there a cut-and-paste way to install the wrappers. Eg. Something like create a text file on the SD card with the UserRPL and then do something to load it? Also, what is this mystery text; %%HP: T(3)A(R)F(.); I know im missing something obvious here.

I cut and pasted the wrappers from the Connectivity Kit. You should be able to cut/paste back (with funny header). To save you time I uploaded my HOME/HPGCC 50g directory and SD card EXTEND.

http://sense.net/~egan/hpgcc/EXTEND.ZIP

Download an extract into root of SD.

http://sense.net/~egan/hpgcc/HPGCC.hp

Download an drop on 50g HOME with the Connectivity Kit.

#11

Hi Egan,

Nice work. Thank you for sharing it. I'm a newbe of 50g. I have a 2GB SD Card, and I know C & C++. So, I wanted to test your work on my calculator/computer.

All files are downloaded and istalled as you suggested. However, I cannot find the file "C:\cygwin\usr\X11R6\bin\startxwin.bat". Under the "C:\....\X11R6\bin\" directory, there is only a "Run.exe" file.

There is another "Run.exe" in "C:\cygwin\bin" DIR. They look identical (49KB, same icon).

BTW, I never used Linux, but I have little Unix knowledge.

What am I missing? Do I need to reboot the PC?

Thanks and happy HP'ing,

Al


#12

The Cygwin/X instructions incorrectly state, "take the defaults". You should select all packages.

#13

Oh! I forgot one detail: I installed it under my "D:" Drive. Therefore, all drive letters should have been replaced by "D:\.....".

Would that matter?

Al


#14

Drive D should be fine.


Possibly Related Threads...
Thread Author Replies Views Last Post
  [WP-34s] CAT documentation, manual printing DRAFT Alexander Oestert 10 326 04-05-2012, 02:48 PM
Last Post: Les Wright
  Draft WP34s Assembler/Disassembler document online Neil Hamilton (Ottawa) 1 118 07-01-2011, 01:26 AM
Last Post: Walter B
  Extend your 50g with C (HPGCC 2.0 SP2) Jan Kromhout 1 134 09-03-2009, 09:46 AM
Last Post: Egan Ford
  WIP: hp12c iphone skin. Pal G. 1 103 07-03-2009, 08:21 AM
Last Post: Gene Wright
  Suggestion to extend tests for Free42 Namir 1 96 11-12-2004, 06:52 PM
Last Post: Thomas Okken
  Extend Your HP-41 Randy Smith 0 86 08-10-2000, 07:10 AM
Last Post: Randy Smith

Forum Jump: