Running FreeBASIC on virtual or real Raspberry Pi.

For other topics related to the FreeBASIC project or its community.
D.J.Peters
Posts: 7828
Joined: May 28, 2005 3:28

Running FreeBASIC on virtual or real Raspberry Pi.

Postby D.J.Peters » Aug 26, 2014 2:49

(Sorry about my bad english)
If you like to port your fine game/demo or library to ARM or learning ARM assembler
or you will try fbc for ARM without a ARM computer you can use a Raspberry Pi image for QEMU.

How to run Raspberry Pi on your Windows* box.
(* of course you can use the PI and kernel image from the zip file with your linux qemu also)

note:
user: pi
password: raspberry

1) get qemu with the RPI image. qemu.zip

2) extract the archive

3) click on qemu/qemu/run.bat

4) you can setup your virtual or real PI

In my case I changed:

keyboard layout (german)
locale (de_DE@Euro)
timezone (Europe/Berlin)
set a new password for user: pi (the default is: raspberry)
boot in to graphical environment NO

select finish

Do you like to reboot YES

5) login user: pi
enter your new password
Image
after you logged in you are in your HOME folder

6) Now it's time to update your PI (your host OS in this case your windows need's a working internet connection)

Code: Select all

>sudo apt-get update
>sudo apt-get dist-upgrade

7) start the X server (graphical desktop)

Code: Select all

>startx

Image
If you logout from the desktop manager you will return to the text prompt.
to shutdown linux type

Code: Select all

>sudo halt
!!! Never close the QEMU window while linux is running !!!

Try to install your first app for example geany your prefered IDE for FreeBASIC.
(geany a smal IDE good for FreeBASIC, C/C++ and many more)

Code: Select all

>sudo apt-get install geany
...
Setup FreeBASIC on your virtual or real PI.
Download, extract and install: fbc_linux_armv6_rpi_0204_2016-03-27.zip in your HOME 'pi' folder.

Code: Select all

>wget http://users.freebasic-portal.de/stw/builds/linux-armv6-rpi/fbc_linux_armv6_rpi_0331_2019-07-28.zip
>unzip fbc_linux_armv6_rpi_0331_2019-07-28.zip
>cd fbc_linux_armv6_rpi
>chmod -x ./install.sh
>sudo sh ./install.sh -i
FreeBASIC compiler successfully installed in /usr
>cd ..
>fbc -version

You have a working FreeBASIC for ARM now. :-)
Time to run geany for our first test. (you will find it in the app menu)

Code: Select all

>startx

Image
You can see compiling graphics code will fail we have to install some missing libs.
Type in the terminal window

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
Image

That's all, have fun with FreeBASIC on ARM.

Joshy
Image
Last edited by D.J.Peters on Aug 03, 2019 23:28, edited 6 times in total.
St_W
Posts: 1476
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Running FreeBASIC on virtual or real Raspberry Pi.

Postby St_W » Aug 26, 2014 15:51

I did that for testing automated RasperryPi builds on my Jenkins "server". Unfortunately Rapian inside qemu ran veeeerrry slow at that computer. I both tried several ready-to-use packages (like the one you suggest) and installing directly from the official raspian image.

I tried cross-compiling on Debian too, but there isn't really a good and complete toolchain available. I haven't tried other linux distros yet, but e.g. ubuntu may provide a better toolchain.

However, interest in (git-)builds for other platforms than windows seems to be very small anyway. Nevertheless, thank you for your instructions - I'll probably try again one day and on that day it will be nice to have some documentation.
MrSwiss
Posts: 3266
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Running FreeBASIC on virtual or real Raspberry Pi.

Postby MrSwiss » Aug 26, 2014 21:06

@joshy,
tested your installation-instructions on Win8.1 pro 64.
Had a small connection problem by downloading the libXext-dev, the first time.
Therafter everything went according to plan, rrrm ... your instructions ;-).
It works as per your description, very good effort ... had almost never such a
complete documentation (which didn't miss anything), CONGRATULATION!!!

Thanks a lot for sharing!

@St_W,
it is a bit slow, but isn't that true for every emulator?

regards MrSwiss
D.J.Peters
Posts: 7828
Joined: May 28, 2005 3:28

Re: Running FreeBASIC on virtual or real Raspberry Pi.

Postby D.J.Peters » Aug 13, 2019 23:11

I published a new 2019 version.

I created a ~4GB sd-card image and upgraded Debian wheezy.
Of course at first I installed the latest version of FreeBASIC and all the dev libs on the fresh running wheezy.
I added geany, mc the midnight commander, gimp, gftp etc ...

download: qemu_pi.zip

extract the archive on a drive or folder where you have write access.

windows:
c: or d:\qemu_pi\

linux:
$HOME/qemu_pi/

I compressed the sd-card image from ~4GB down to 1.5GB with FreeBASIC.

compress.bas and decompress.bas are included.
(It's fun to see compress working I used one 8-bit FBimage 64x64 = 4096 bytes same as an SD card sector so it's a visual task also)

How ever before you can run the virtual pi run decompress at first:
decompress creates from "wheezy-sd-card-2019.pkg" the file "wheezy-sd-card-2019.img" that are loaded/mounted from virtual pi

Windows:
execute decompress.exe
(of course don't trust any downloaded *.exe and compile decompress.bas self)

Linux:
cd qemu_pi
fbc decompress.bas
./decompress

runing the virtual pi

Windows:
execute virtualpi.exe
(of course don't trust any downloaded *.exe and compile virtualpi.bas self)

Linux:
edit the path to your qemu-system-arm in virtualpi.bas
change
const qemu = ".\qemu-system-arm.exe"
to (or with complete path in front)
const qemu = "qemu-system-arm"

fbc virtual_pi.bas
./virtual_pi

Now the virtual pi should boot

user: pi
password: raspbian

After you logged in the FreeBASIC message are shown
(it's the message of the day the content can be edit in file in /etc/mod

read it and have fun !

Joshy

edit: some hints

Don't delete the compressed sd-card image "wheezy-sd-card-2019.pkg" !
A virtual running pi is slow but perfect to learn deeper root linux stuff
like creating or changing partitions or filesystems
setting up web/name or other kinds of servers
and many other critical tasks.

How ever if something goes wrong you can't destroy your virtual hardware :-)
but your virtual sd-card image "wheezy-sd-card-2019.img" can be damaged as root (faster as you think) !
don't worry if your deeper changes won't work after an "sudo reboot" run decompress and all will be fine.

press: [ctrl] & [alt] & [f] toggles to full screen and back at any time in console or desktop mode !

with one exception if you are in full screen console mode
press: [ctrl] & [alt] & [f] to go back in window mode before you run "startx" !

to change your key map, set your locale, set your timezone and optional change your password use:
>sudo raspi-config

shot down Linux:
log out from desktop manager (if you typed startx before) and type
>sudo halt
now you can close the the virtual pi window.

Why and how ?

I tried qemu pi from 2014 see first post !

I used my own step by step instructions on a Windows 10 64-bit box (2014 I used XP 32-bit)

but after a log in nothing worked as accepted
>sudo apt-get update
or
>sudo apt-get upgrade
or
>sudo apt-get install geany ...

I found out Debian wheezy isn't supported anymore (it was replaced by Debian jessie)

How ever I don't give up :-)

I learned how to use wget to clone a complete server !
and I made a copy of all the latest Debian wheezy repository stuff ~15GB on my own server.

Than I deleted or commented out the old repository servers in: /etc/apt/sources.list
after that I deleted all inside the folder /etc/apt/sources.list.d/
and create a new file /etc/apt/sources.list.d/raspi.list
with one line that pointed to my own server

Bingo all the sudo apt-get stuff worked as it should :-)

Two days later I found an official backup of the latest wheezy repository
and replaced my own server in /etc/apt/sources.list.d/raspi.list with the back up server.

So you can use apt-get to install more software or source codes of all programs or Linux commands

But I learned much more in one night:
"how to resize a partition on a running Linux where the file system are mounted on this partition !!!"
"how to resize the filesystem to the new size of the partition"
"how to write stuff on the forum that no once will read :-)"
srvaldez
Posts: 2111
Joined: Sep 25, 2005 21:54

Re: Running FreeBASIC on virtual or real Raspberry Pi.

Postby srvaldez » Aug 22, 2019 14:17

Hi D.J.Peters :-)
is there a way to increase the screen size of the emulator?
I find the screen resolution too small
I run the emulator on macOS and I discovered that the @ and " keys are swapped, is there a keyboard option for the emulator?
Knatterton
Posts: 164
Joined: Apr 19, 2019 19:03

Re: Running FreeBASIC on virtual or real Raspberry Pi.

Postby Knatterton » Aug 22, 2019 15:01

D.J.Peters wrote:"how to write stuff on the forum that no once will read :-)"

That's impossible. There will be always fools like me. :-)
srvaldez
Posts: 2111
Joined: Sep 25, 2005 21:54

Re: Running FreeBASIC on virtual or real Raspberry Pi.

Postby srvaldez » Aug 22, 2019 15:14

D.J.Peters wrote:"how to write stuff on the forum that no once will read :-)"

I sympathize with that, one reason I restrain myself from posting, on the other hand, how about connecting a real PI to my desktop using no machine? https://www.nomachine.com https://www.nomachine.com/tips-on-how-t ... -nomachine
caseih
Posts: 1381
Joined: Feb 26, 2007 5:32

Re: Running FreeBASIC on virtual or real Raspberry Pi.

Postby caseih » Aug 22, 2019 19:53

Another good remote desktop solution you can use with the pi is X2Go. It's based on some of the same technologies as NoMachine is, but is in the Rasbian default software respository so it's an easy install.

https://wiki.x2go.org/doku.php/wiki:repositories:start
srvaldez
Posts: 2111
Joined: Sep 25, 2005 21:54

Re: Running FreeBASIC on virtual or real Raspberry Pi.

Postby srvaldez » Aug 22, 2019 20:07

thanks for the tip caseih :-)

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 52 guests