HELP on compiling BASIC C Source Code
|
05-03-2014, 07:26 PM
Post: #1
|
|||
|
|||
HELP on compiling BASIC C Source Code
Hi,
I found the "C" Source Code of "My-BASIC" (https://code.google.com/p/my-basic/) and I am trying to compile it with HPGCC 2.0 Win. The HPGCC compiler is giving following errors: > "dmake" main.hp arm-elf-gcc -mtune=arm920t -mcpu=arm920t -mlittle-endian -fomit-frame-pointer -msoft-float -Wall -Os -pipe -mthumb-interwork -mthumb -IH:\HPGCC-2.0-native-win32-SP2/include -I.. -c main.c -o main.o main.c:36:27: error: unistd.h: No such file or directory main.c:38:20: error: assert.h: No such file or directory main.c: In function '_destroy_code': main.c:78: warning: implicit declaration of function 'assert' main.c: In function '_load_file': main.c:151: warning: implicit declaration of function 'ftell' main.c: In function '_clear_screen': main.c:227: warning: implicit declaration of function 'system' main.c: In function '_list_program': main.c:240: warning: passing argument 1 of 'atoi' discards qualifiers from pointer target type main.c:241: warning: passing argument 1 of 'atoi' discards qualifiers from pointer target type main.c: In function '_edit_program': main.c:272: warning: passing argument 1 of 'atoi' discards qualifiers from pointer target type main.c: In function '_kill_program': main.c:316: warning: implicit declaration of function 'unlink' main.c: In function '_do_line': main.c:362: warning: implicit declaration of function 'strcasecmp' make: *** [main.o] Error 1 > Process Exit Code: 2 > Time Taken: 00:00 Can someone be so kind to tell me what should I do so that I get it compiled properly. Thank You Alvaro |
|||
05-03-2014, 08:23 PM
Post: #2
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code | |||
05-03-2014, 08:32 PM
Post: #3
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
(05-03-2014 08:23 PM)Egan Ford Wrote:(05-03-2014 07:26 PM)Alvaro Wrote: -IH:\HPGCC-2.0-native-win32-SP2/include Well, I have no ideia, but it seems to be OK, because all the *.h files are beeing found and there is no "complain" about them. On the INCLUDE directory there are missing unistd.h and assert.h. Where do I find these headers? |
|||
05-03-2014, 09:22 PM
Post: #4
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
Finding the header is useless if the C library does not implement its functions. And the main.c is designed to run either on Windows or Unix systems as a command line interpreter.
So maybe you do not want to compile it at all if you target an HP calculator. |
|||
05-03-2014, 09:47 PM
Post: #5
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
(05-03-2014 09:22 PM)pascal_meheut Wrote: Finding the header is useless if the C library does not implement its functions. And the main.c is designed to run either on Windows or Unix systems as a command line interpreter. That is a normal BASIC interpreter, even has a LOAD comand that is loading in memory all the programm. It runs under Windows as DOS box, looking very like a normal BASIC interpreter. |
|||
05-04-2014, 04:42 AM
(This post was last modified: 05-04-2014 04:53 AM by Egan Ford.)
Post: #6
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
(05-03-2014 09:47 PM)Alvaro Wrote:(05-03-2014 09:22 PM)pascal_meheut Wrote: Finding the header is useless if the C library does not implement its functions. And the main.c is designed to run either on Windows or Unix systems as a command line interpreter. Sorry, I didn't read your original post completely. C is very portable, but the libs that C use can be platform specific, especially I/O. Porting anything with HPGCC will require some effort if it is interactive and/or based on Windows or another platform. Example HPGCC program (http://sense.net/~egan/hpgcc/#Hello, World): Code:
The clear_screen() and WAIT_CANCEL are unique to HPGCC. |
|||
05-04-2014, 06:14 AM
Post: #7
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
(05-03-2014 09:47 PM)Alvaro Wrote: That is a normal BASIC interpreter, even has a LOAD comand that is loading in memory all the programm. If you do not understand my answer, you should avoid explaining to me what I already know. Good luck. |
|||
05-04-2014, 06:15 AM
Post: #8
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
Quote:“When in doubt, run Process Monitor.” Google, download and run Process Monitor. Try to compile your source. Set a filter with the first file not found. You will know exactly where the compiler is looking for the files. Rinse, repeat. My website: ried.cl |
|||
05-05-2014, 07:42 PM
Post: #9
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
(05-03-2014 07:26 PM)Alvaro Wrote: Hi,unistd.h declares a bunch of unix functions. assert.h declares the assert() function. What really matters are the implicitly declared functions that follow. You might want to google "<function> man page" to get a description of what each function does. Then you can reimplement, replace it or ignore it as you see fit. Quote:main.c: In function '_destroy_code':the assert() function is used to assert something that is always true. if the argument to assert() is false then it aborts the program. You can probably reimplement this. Quote:main.c: In function '_load_file':ftell() returns the current position within an open file. You can use the return value as an argument to fseek() to go back to that place in the file. Quote:main.c: In function '_clear_screen':system() takes a string and more-or-less execute the string as though it had been typed on the keyboard. Since this is inside _clear_screen(), I suspect that you can just reimplement clear_screen() using the hpgcc graphics functions. Quote:main.c: In function '_list_program':These can probably be ignored. Check the type of the argument to atoi(). It is supposed to be a char*. Quote:main.c: In function '_kill_program':unlink() removes a file. Quote:main.c: In function '_do_line':strcasecmp() compares two strings without regard to upper/lower case. I'm surprised that this isn't in the hpgcc libs already. Maybe you just need to find the right header file to include to get this. Hope this helps, Dave |
|||
05-05-2014, 08:53 PM
Post: #10
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
(05-05-2014 07:42 PM)David Hayden Wrote: Hope this helps, Hi Dave, Thank you very much for your answer and your effort. I really do apreciate. Surely it is very helpfull but unfortunatelly I have no knowledge of C and I have no time not the interest to read such a huge amount of DOC´s that there is implicit to learn C. It is not something for just spring in. I am a "end-user", not a developer and as I see there is still a need to do "some extra expert work" from of what there is available around. I lost every interest in doing something with the 50g, there is no point at all, simply was a wrong "buy" choice. Thank you again Dave Regards Alvaro |
|||
04-16-2023, 10:04 PM
Post: #11
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
(05-05-2014 07:42 PM)David Hayden Wrote:(05-03-2014 07:26 PM)Alvaro Wrote: Hi,unistd.h declares a bunch of unix functions. assert.h declares the assert() function. What really matters are the implicitly declared functions that follow. You might want to google "<function> man page" to get a description of what each function does. Then you can reimplement, replace it or ignore it as you see fit. Okay this thread is ancient but it seemed like you knew what you are talking about! So, if you have a moment I have a question that should be simple but for the life of me I cant get to work. I am using the 49g+/50g C compiler and have created a program that does compile without any issues as it uses all of the libraries and header files included with the HPGCC 2.0 Win install and the included Programmers Notepad 2 environment/IDE. I used the example make file and can create the .hp output binary. However how do I run this on the HP49g+ (or 50g)? I put it on the SD card, then I move it to the port:0 (internal ram) then try to select it from the soft menu from the library view it but I just end up getting the full program as a "string" displayed on the first line of the stack. Its like it does not know its a binary but I dont know how to tell it to execute as a binary. Thank you in advance for your insight here. Seems like this is a dead subject but this is of interest to me as are most of my HP collection. ------------------------------------------------ Prime, 50g,49g+,48gII,48sx,48g, 48gx,71b,75c,28s,28c |
|||
04-18-2023, 10:41 AM
Post: #12
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
You need to install the ARM Toolbox which includes a library that is used by HP GCC 2 programs.
The ARM Toolbox also includes a program to make your program standalone so it can be run on any 50G without requiring the toolbox install. See here for installation details. It works and I have run programs and made them standalone without a problem. Good luck :-) (04-16-2023 10:04 PM)dkostan Wrote: Okay this thread is ancient but it seemed like you knew what you are talking about! So, if you have a moment I have a question that should be simple but for the life of me I cant get to work. I am using the 49g+/50g C compiler and have created a program that does compile without any issues as it uses all of the libraries and header files included with the HPGCC 2.0 Win install and the included Programmers Notepad 2 environment/IDE. I used the example make file and can create the .hp output binary. However how do I run this on the HP49g+ (or 50g)? I put it on the SD card, then I move it to the port:0 (internal ram) then try to select it from the soft menu from the library view it but I just end up getting the full program as a "string" displayed on the first line of the stack. Its like it does not know its a binary but I dont know how to tell it to execute as a binary. Thank you in advance for your insight here. Seems like this is a dead subject but this is of interest to me as are most of my HP collection. Calculator Clique on YouTube |
|||
04-18-2023, 09:10 PM
Post: #13
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
If you're using HPGCC 2, you might be interested in my hpobjects library. It lets you access and create most RPL object types from within your C code.
Dave |
|||
04-19-2023, 01:57 PM
Post: #14
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
If you get "implicit declaration of...."
Code:
for any function f, that means that the header file xxx.h is missing and the compiler assumes that f looks like "int f()", a function with no parameters that returns an integer. This is only a warning, but normally fatal if you want to port code. Quote:Surely it is very helpfull but unfortunatelly I have no knowledge of C and I have no time not the interest to read such a huge amount of DOC´s that there is implicit to learn C. You have minimal chances to do your project successful. Thats like speaking chinese if you do not know the language. |
|||
04-19-2023, 02:22 PM
Post: #15
|
|||
|
|||
RE: HELP on compiling BASIC C Source Code
(04-19-2023 01:57 PM)ThomasK Wrote:Quote:Surely it is very helpfull but unfortunatelly I have no knowledge of C and I have no time not the interest to read such a huge amount of DOC´s that there is implicit to learn C. You may not realize it, but you are replying to someone that last visited this site 9 years ago, so he has probably moved-on to other (seemingly non-C based) projects. --Bob Prosperi |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)