Recent

Author Topic: Free Pascal console programs on Android are easy  (Read 38335 times)

Paul Breneman

  • Sr. Member
  • ****
  • Posts: 290
    • Control Pascal
Re: Free Pascal console programs on Android are easy
« Reply #15 on: April 24, 2017, 05:11:06 am »
With GNURoot Debian it now comes up as Debian version 8.1 but I upgraded to 8.7 using the instructions near the bottom of this page:
  http://turbocontrol.com/gnuroot.htm

The 2.6.0 ppcarm itself fails to run with: Illegal instruction

I'm using a Nexus 7 tablet (same device as three years ago) with Android 6.0.1 (that has been upgraded).  GNURoot (also upgraded) provides a chroot with Debian?

It has been three years since I did this before and things worked then so I don't know what might have changed so FPC 2.6.0 ppcarm doesn't even run now.
 Android?
 GNURoot?

I'm trying the *most simple* thing, so no x11 or VNC needed. Thanks in advance for *any* suggestions on why ppcarm now fails to run.  As soon as I get this working I hope to create a new wiki page so it is easier for others to share.
Regards,
Paul Breneman
www.ControlPascal.com

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Free Pascal console programs on Android are easy
« Reply #16 on: April 24, 2017, 04:26:53 pm »
Stock 2.6.0 did not build hardware float targets, so that is not a standard 2.6.0 FPC.

Paul Breneman

  • Sr. Member
  • ****
  • Posts: 290
    • Control Pascal
Re: Free Pascal console programs on Android are easy
« Reply #17 on: April 24, 2017, 05:23:18 pm »
Stock 2.6.0 did not build hardware float targets, so that is not a standard 2.6.0 FPC.

I'm sorry but I don't really understand what you wrote.  The file is the FPC ppcarm, not something that I compiled.

I also posted a new zip (not yet on web page) and tried that: HelloWorld-fpc-3.0.2.arm-linux-041917.zip  The 3.0.2 ppcarm itself fails with: Segmentation fault.
Regards,
Paul Breneman
www.ControlPascal.com

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Free Pascal console programs on Android are easy
« Reply #18 on: April 24, 2017, 07:34:38 pm »
Stock 2.6.0 did not build hardware float targets, so that is not a standard 2.6.0 FPC.

I'm sorry but I don't really understand what you wrote.  The file is the FPC ppcarm, not something that I compiled.

Exactly my point. The original 2.6.0 ppcarm is OABI (for ARMV5) without hardfloat, and thus doesn't run on Raspbian or anything that has the newer EABI distributions.

And afaik android is EABI

Paul Breneman

  • Sr. Member
  • ****
  • Posts: 290
    • Control Pascal
Re: Free Pascal console programs on Android are easy
« Reply #19 on: April 24, 2017, 09:15:14 pm »
And afaik android is EABI

It worked three years ago so did Android or GNUroot/Debian (or both) change in that time?

Is "Illegal instruction" shown by the FPC 2.6.0 ppcarm program or is it shown by the OS?

Is "Segmentation fault" shown by the FPC 3.0.2 ppcarm program or is it shown by the OS?

Is there somewhere to look up what these two errors mean (and what displayed them)?

Thanks for helping me!
Regards,
Paul Breneman
www.ControlPascal.com

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Free Pascal console programs on Android are easy
« Reply #20 on: April 24, 2017, 09:52:32 pm »
It worked three years ago so did Android or GNUroot/Debian (or both) change in that time?

Debian did change from OABI to EABI. But worse, there are many 2.6.0 versions patched fo EABI,
not in the least the Raspbian version.

Quote
Is "Illegal instruction" shown by the FPC 2.6.0 ppcarm program or is it shown by the OS?

It is shown by FPC but in response to a hardware interrrupt. The corresponding *nix designation is SIGILL

Quote
Is "Segmentation fault" shown by the FPC 3.0.2 ppcarm program or is it shown by  the OS?

Segmentation fault is a catch all error, all access to unmapped addresses fall under this. Like SIGILL a hardware exception caught and reported by the FPC  runtime. Also known as GPF and SIGSEGV

Note that BSD likes often report SIGILL in cases where Linux would report SIGSEGV

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: Free Pascal console programs on Android are easy
« Reply #21 on: April 24, 2017, 10:01:04 pm »
Quote
But worse, there are many 2.6.0 versions patched fo EABI,
not in the least the Raspbian version.
Why is it worse ?
Isn't it good, that it can be patched ?
And can 3.0.2 be patched too ?
Maybe a ppcarm-e for EABI and a ppcarm-o for OABI can be released ?
the names are RFC of cause
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Free Pascal console programs on Android are easy
« Reply #22 on: April 24, 2017, 10:03:35 pm »
Quote
But worse, there are many 2.6.0 versions patched fo EABI,
not in the least the Raspbian version.
Why is it worse ?
Isn't it good that it can be patched ?

Well, at the time it was a good thing, providing support to people on a target that didn't have an official FPC version.

However now old "holy" versions of uncertain origins only confuse the situation.  2.6.0 is over 5 years old now......

Paul Breneman

  • Sr. Member
  • ****
  • Posts: 290
    • Control Pascal
Re: Free Pascal console programs on Android are easy
« Reply #23 on: April 25, 2017, 12:25:54 am »
Debian did change from OABI to EABI. But worse, there are many 2.6.0 versions patched fo EABI,
not in the least the Raspbian version.

The FPC 2.6.0 ppcarm that I'm using came from here:
https://sourceforge.net/projects/freepascal/files/Linux/2.6.0/

That is an official (not patched) version, right?

Stock 2.6.0 did not build hardware float targets, so that is not a standard 2.6.0 FPC.

I've looked up SIGILL and see that if we get that then the device has no fpu.  But I'm using the standard 2.6.0 (ppcarm) which shouldn't generate hardware floats anyway.  Something is still confusing here.  Maybe we're not supposed to compile and run FPC console programs so easily on Android?  :)
« Last Edit: April 25, 2017, 01:37:01 am by Paul Breneman »
Regards,
Paul Breneman
www.ControlPascal.com

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Free Pascal console programs on Android are easy
« Reply #24 on: April 25, 2017, 10:17:18 am »
Maybe we're not supposed to compile and run FPC console programs so easily on Android?  :)

Not with versions that predate android support.

As for the rest, EABI and OABI also influence parameter passing. They are mostly not compatible.

Since official 2.6.0 is afaik OABI, it is mostly only useful for generating binaries for old armv5 NAS boxes that run old OABI  linux systems. Later 2.6.x versions afaik switch to EABI, which was good for the very first RPI boxes. (EABI, but not hardfloat)

Then later raspbian also switched to hardfloat (from armv5 to armv6 ABI), and for anything with hardware floating point in an officially released version you'll need at least 3.0.0
« Last Edit: April 25, 2017, 10:22:59 am by marcov »

Paul Breneman

  • Sr. Member
  • ****
  • Posts: 290
    • Control Pascal
Re: Free Pascal console programs on Android are easy
« Reply #25 on: April 25, 2017, 11:35:28 am »
Not with versions that predate android support.

But this is running a Debian chroot in Linux, and FPC does support that well!  I'll try to raise a github issue with GNURoot tomorrow.  Thanks for your help marcov!
Regards,
Paul Breneman
www.ControlPascal.com

BeniBela

  • Hero Member
  • *****
  • Posts: 905
    • homepage
Re: Free Pascal console programs on Android are easy
« Reply #26 on: April 25, 2017, 11:49:30 am »
Maybe we're not supposed to compile and run FPC console programs so easily on Android?  :)

Not with versions that predate android support.

As for the rest, EABI and OABI also influence parameter passing. They are mostly not compatible.

Since official 2.6.0 is afaik OABI, it is mostly only useful for generating binaries for old armv5 NAS boxes that run old OABI  linux systems. Later 2.6.x versions afaik switch to EABI, which was good for the very first RPI boxes. (EABI, but not hardfloat)

Then later raspbian also switched to hardfloat (from armv5 to armv6 ABI), and for anything with hardware floating point in an officially released version you'll need at least 3.0.0

That is the opposite of easy

Why is the thread titled "easy" when it is not easy?

Reminds of the time I tried it, too. It took like a year!
« Last Edit: April 25, 2017, 11:51:36 am by BeniBela »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11352
  • FPC developer.
Re: Free Pascal console programs on Android are easy
« Reply #27 on: April 25, 2017, 11:59:25 am »
Not with versions that predate android support.

But this is running a Debian chroot in Linux, and FPC does support that well! 

Still ABI and hwfloat or not must match. And if the debian is not age old, it probably won't for that version.

Paul Breneman

  • Sr. Member
  • ****
  • Posts: 290
    • Control Pascal
Re: Free Pascal console programs on Android are easy
« Reply #28 on: April 26, 2017, 01:09:36 pm »
That is the opposite of easy

Why is the thread titled "easy" when it is not easy?

Reminds of the time I tried it, too. It took like a year!

Three years ago it was easy!

Thanks for your comments as I hope to make things more clear (also hope to create a wiki page if get it working again like 3 years ago).

Many people probably have a device in their home or business that has a computer in the device and it "happily" does it's work by itself for weeks. But how easily can you change just a single setting in the device when you need to? This is what has come up to me repeatedly in the past few years.  If you are a full-time programmer and develop nice GUI apps for sale or for a product this topic doesn't apply to you (so please don't confuse us simple nerds  :) ).

http://www.ctrlterm.com/ is a very simple and easy way to use a 7 inch Windows tablet, and the touch screen works without any extra code.

https://atmosphere.anaren.com/products/bluetooth-smart-development-kit is also "fairly" simple and allows you to use a smart phone (or an inexpensive tablet).

If you know of other ways to use inexpensive devices that are easy (for a non-programmer) please share!  Another example of use: I know a company that manufactures (low volume) equipment for business use. Adding LEDs and switches on the (waterproof) equipment (to change settings) is expensive, but using serial, Ethernet, or Bluetooth and a separate inexpensive device to change settings is very attractive! Yes, with Free Pascal and desktop PCs this is easy.

Three years ago I hoped that Free Pascal (and Free Vision) on inexpensive Android tablets would be an option.  We'll see...
« Last Edit: April 26, 2017, 03:01:26 pm by Paul Breneman »
Regards,
Paul Breneman
www.ControlPascal.com

Paul Breneman

  • Sr. Member
  • ****
  • Posts: 290
    • Control Pascal
Re: Free Pascal console programs on Android are easy
« Reply #29 on: April 27, 2017, 12:18:58 am »
Stock 2.6.0 did not build hardware float targets, so that is not a standard 2.6.0 FPC.

I've looked up SIGILL and see that if we get that then the device has no fpu.  But I'm using the standard 2.6.0 (ppcarm) which shouldn't generate hardware floats anyway.  Something is still confusing here.  Maybe we're not supposed to compile and run FPC console programs so easily on Android?  :)

A good friend of mine (who uses Debian) looked things up and found this: https://lists.debian.org/debian-arm/2007/03/msg00097.html

Is that maybe why the standard 2.6.0 ppcarm is getting SIGILL?  If so, does 2.6.4 or 3.0.0 or 3.0.2 correct this problem?
« Last Edit: April 27, 2017, 12:35:58 am by Paul Breneman »
Regards,
Paul Breneman
www.ControlPascal.com

 

TinyPortal © 2005-2018