FreeBASIC and the Raspberry Pi ?

General discussion for topics related to the FreeBASIC project or its community.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

Just acquired a Raspberry Pi. Has anyone been able to install FreeBASIC on it?
At the moment it is still in the box until I have time to set it up.
I will be new to Linux so I am not sure how long it will take to learn.
Accessing the i/o pins is required for my intended project.
dasyar
Posts: 372
Joined: Dec 04, 2008 15:31

Re: FreeBASIC and the Raspberry Pi ?

Post by dasyar »

I used to be able to go too page 5 in the Linux forum, where TJF had a thread - Debian Package fbc-1.01-Debian7_amf. That thread has now been cleaned out, so I am not sure what the latest procedure is for installing fbc on a Raspberry Pi is.

I did do an Internet search, and found a thread called "Running FreeBasic on Raspberry Pi - we saw a chicken". This might be a way to proceed, not sure though, you might have to read the whole blog.

It is to bad that TJF cleared out, he had a very useful way of installing fbc on the Raspberry Pi. I guess he is another former forum member that bailed out.
srvaldez
Posts: 3373
Joined: Sep 25, 2005 21:54

Re: FreeBASIC and the Raspberry Pi ?

Post by srvaldez »

@BasicCoder2
you can download FB for the pi from http://users.freebasic-portal.de/stw/builds/ either the armv6-rpi or armv7a-hf-debian will work.
have not played with accessing the i/o pins, you will probably need to use the Wiring Pi lib http://wiringpi.com, if you search this forum for wiring pi you will get some hits.
if you are new to linux then you may not know that you will need to install a number of libraries to successfully compile programs with FB
if you are using Raspbian then I suggest the following
first update from the terminal

Code: Select all

sudo apt-get update
sudo apt-get upgrade
then add the following libs

Code: Select all

sudo apt-get install libX11-dev
sudo apt-get install libXext-dev
sudo apt-get install libXpm-dev
sudo apt-get install libXrandr-dev
sudo apt-get install libncurses5-dev
you may also need other libraries depending on your program, but this will get you started.
almost forgot, I suggest the geany IDE https://www.geany.org it works with FB out of the box, though you may want to add compiler flags to your liking.
geany may already be installed, if not you can install geany using apt-get
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

@srvaldez,
Thanks for the input.
Found some forum posts,
viewtopic.php?f=17&t=24181&hilit=wiring+pi
This is the kit I purchased.
https://www.jaycar.com.au/raspberry-pi- ... t/p/XC9010
Haven't unpacked my toy yet. Also have to get cable to connect it to a display.
Pitto
Posts: 122
Joined: Nov 19, 2012 19:58

Re: FreeBASIC and the Raspberry Pi ?

Post by Pitto »

Hi all and thank you,
the above instructions also worked on my raspberry.
I compiled without problems the last project I'm working on.
And also it runs pretty fast :)
Image
sancho3
Posts: 358
Joined: Sep 30, 2017 3:22

Re: FreeBASIC and the Raspberry Pi ?

Post by sancho3 »

dasyar wrote:It is to bad that TJF cleared out, he had a very useful way of installing fbc on the Raspberry Pi. I guess he is another former forum member that bailed out.
I wouldn't be so quick to say that. His last post is Feb 13, 2018.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

Thank you all for your responses which I can refer to when I start trying to get it all going.
Still have to buy a monitor and HDMI cable.
.
jevans4949
Posts: 1186
Joined: May 08, 2006 21:58
Location: Crewe, England

Re: FreeBASIC and the Raspberry Pi ?

Post by jevans4949 »

BasicCoder2 wrote:Thank you all for your responses which I can refer to when I start trying to get it all going.
Still have to buy a monitor and HDMI cable.
.
You may find it easier / cheaper to buy a second-hand TV with an HDMI socket. You also get a spare TV set. If in the UK, rush to your local Maplin store for the cable - they are having a closing-down sale
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

jevans4949 wrote:You may find it easier / cheaper to buy a second-hand TV with an HDMI socket. [
Have just hooked the Raspberry Pi to our second tv set and it appears to be working fine.
Now I am officially a Linux user :)
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: FreeBASIC and the Raspberry Pi ?

Post by D.J.Peters »

For our new ARM Linux user :-)

Tip: using GNU ARM assembler with FreeBASIC

Special ARM GNU as directives

file: "function.s"

Code: Select all

.arm                       @ 32 bit mode
.global fb_add             @ make 'fb_add' visible for FreeBASIC
.type   fb_add, %function  @ it's a function

.text                      @ begin of the code segment
.align 2                   @ word boundary

fb_add:                    @ function fb_add(r0, r1) as integer
  add   r0, r0, r1         @ r0 = r0 + r1
  bx    lr                 @ return from function with result in r0

.end                       @ end of assembler listing
file: "test.bas"

Code: Select all

declare function fb_add cdecl alias "fb_add" (byval r0 as integer,byval r1 as integer) as integer

print " 3 + 7 = " & fb_add(3,7)

sleep
#> fbc test.bas -Wa function.s

Joshy
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

@Joshy,
Thanks for the information.

The Raspbery Pi 3B seems to have a 64 bit processor?

I am not sure why QEMU, which a google says is an emulator, is required to run FreeBASIC on the Raspberry PI which I understand runs the Linux OS?
Last edited by BasicCoder2 on Mar 21, 2018 10:56, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: FreeBASIC and the Raspberry Pi ?

Post by D.J.Peters »

You have a ARCH64 ARM device but Raspbian is an 32-bit Linux same the armv7 version of FreeBASIC is 32-bit also

Do you have installed FreeBASIC on your running Raspbian OS know ?

Joshy
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: FreeBASIC and the Raspberry Pi ?

Post by BasicCoder2 »

It seems I may have been following the wrong post.
No I haven't installed FreeBASIC yet as I was confused with the other post.
Will tackle it again tomorrow.
Last edited by BasicCoder2 on Mar 22, 2018 12:15, edited 1 time in total.
Post Reply