Raspberry PI and Beaglebone Black.

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Analog Input on the BeagleBoard Black

Post by TJF »

Hi Joshy!

When you consider to use the analog input (AIN0 to AIN6), be careful!

On my board with kernel 3.8.13 I get (open lines AIN0 - 6, AIN7 connected to 3.3V * 1/2)
# cat /sys/devices/ocp.2/helper.14/AIN*
1799
1393
963
585
1794
1669
1530
1676
which first made me think these are digit values and the maximum input voltage may be higher than described (1.8 V).

But instead these are values computed by the kernel driver. It converts the raw data to mV values, rounded as !!! integers !!! (not floats). (This also means 2.2 bits get lost!)

You can receive the raw data by
# cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw
4093
3197
2194
1324
4082
3736
3381
3816
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: [offtopic] I got my brand new toys.

Post by D.J.Peters »

I got the first step on arm linux :-)

next huge step are "emit_ARM.bas"

Joshy
Beaglebone black wrote:sh-4.2# pwd
/home/root/fbc-master/src/compiler/c
sh-4.2# ls -lh /usr/lib/freebasic
total 1.5M
-rwxr--r-- 1 root root 396 fbextra.x
-rw-r--r-- 1 root root 1.4K fbrt0.o
-rw-r--r-- 1 root root 710K libfb.a
-rw-r--r-- 1 root root 725K libfbmt.a
sh-4.2# ls -lh /usr/bin/fbc
-rwxr-xr-x 1 root root 1.9M /usr/bin/fbc
sh-4.2# fbc -version
FreeBASIC Compiler - Version 0.91.0 (07-04-2013) for linux
Copyright (C) 2004-2013 The FreeBASIC development team.
sh-4.2# cat test01.bas
' file test01.bas
print "hello world from ARM7 !"

sh-4.2# fbc -v -arch arm7 -gen gcc test01.bas
FreeBASIC Compiler - Version 0.91.0 (07-04-2013) for linux
Copyright (C) 2004-2013 The FreeBASIC development team.
compiling: test01.bas -o test01.c (main module)
compiling C: /usr/bin/../bin/gcc -S -nostdlib -nostdinc -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-main -O0 -frounding-math -fno-math-errno -march=armv7-a -mtune=cortex-a8 "test01.c" -o "test01.asm"
assembling: /usr/bin/../bin/as "test01.asm" -o "test01.o"
linking: /usr/bin/../bin/ld -o "test01" -dynamic-linker /lib/ld-linux.so.3 "/usr/bin/../lib/freebasic/fbextra.x" -m armelf_linux_eabi -s -L "/usr/bin/../lib/freebasic" -L "." -L "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../arm-angstrom-linux-gnueabi/4.7.3" "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../crt1.o" "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../crti.o" "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../arm-angstrom-linux-gnueabi/4.7.3/crtbegin.o" "/usr/bin/../lib/freebasic/fbrt0.o" "test01.o" "-(" -lfb -ltinfo -lm -ldl -lpthread -lgcc -lgcc_eh -lc "-)" "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../arm-angstrom-linux-gnueabi/4.7.3/crtend.o" "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../crtn.o"
sh-4.2# ./test01
hello world from ARM7 !
sh-4.2#
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by TJF »

Congratulations!
  • How did you fix this fbc bug?
  • D.J.Peters wrote:-L "/usr/bin/../lib/freebasic"
    Why don't you use the standard path for the fb libraries (/usr/local/lib/freebasic)?
  • D.J.Peters wrote:next huge step are "emit_ARM.bas"
    Generating assembler code for ARM? Why do you need it when -gen gcc works?
  • Do you consider to work on gfxlib2 for BBB?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by D.J.Peters »

TJF wrote:Congratulations!

How did you fix this fbc bug?
It isn't a bug for me, take a look to what Beaglebone black wrote :-) !!! dynamic linker !!!
TJF wrote:Why don't you use the standard path for the fb libraries (/usr/local/lib/freebasic)?
this isn't a standard path for me the lib path are relativ to fbc.
if you put fbc in /usr/bin the libpath will be /usr/lib/freebasic
if you put fbc in /usr/local/bin the libpath will be /usr/local/lib/freebasic
...
TJF wrote:Generating assembler code for ARM? Why do you need it when -gen gcc works?
why not doing it like a man :lol:
fun by side i buyed ARM CPU's primary for learning arm assembler. It's mutch more fun as x86 exept the missing idiv.
TJF wrote:Do you consider to work on gfxlib2 for BBB?[/list]
I created libgfxlib2.a last night also.

Joshy

Code: Select all

screenres 640,480
print "hello from gfxlib2 !"
for i as integer = 0 to 240 step 2
  circle (320,240),i
next
sleep 10000
Image
Last edited by D.J.Peters on Sep 25, 2017 20:29, edited 1 time in total.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by TJF »

D.J.Peters wrote:this isn't a standard path for me the lib path are relativ to fbc.
if you put fbc in /usr/bin the libpath will be /usr/lib/freebasic
if you put fbc in /usr/local/bin the libpath will be /usr/local/lib/freebasic
Yes, that's working. But when you use the fbc paths it's easier to transform improvements /patches from your project to the fbc source.
D.J.Peters wrote:
TJF wrote:How did you fix this fbc bug?
It isn't a bug for me, take a look to what Beaglebone black wrote :-) !!! dynamic linker !!!
Sorry, I don't understand. I've no problem using the dynamic linker.

The problem is: When fbc-0.90 gets compiled with option -gen gcc the executable segfaults before calling the linker. This happens on Ubuntu/X_86 and also on BBB/ARM.
D.J.Peters wrote:
TJF wrote:Do you consider to work on gfxlib2 for BBB?[/list]
I created libgfxlib2.a last night also.
Well done! I didn't try it yet. Any adaptions neccessary?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by D.J.Peters »

again my friend ;-)
Beaglebone black wrote:sh-4.2# fbc -v -arch arm7 -gen gcc test01.bas
FreeBASIC Compiler - Version 0.91.0 (07-04-2013) for linux
Copyright (C) 2004-2013 The FreeBASIC development team.
compiling: test01.bas -o test01.c (main module)
compiling C: /usr/bin/../bin/gcc -S -nostdlib -nostdinc -Wall -Wno-unused-label -Wno-unused-function -Wno-unused-variable -Wno-main -O0 -frounding-math -fno-math-errno -march=armv7-a -mtune=cortex-a8 "test01.c" -o "test01.asm"
assembling: /usr/bin/../bin/as "test01.asm" -o "test01.o"
linking: /usr/bin/../bin/ld -o "test01" -dynamic-linker /lib/ld-linux.so.3 "/usr/bin/../lib/freebasic/fbextra.x" -m armelf_linux_eabi -s -L "/usr/bin/../lib/freebasic" -L "." -L "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../arm-angstrom-linux-gnueabi/4.7.3" "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../crt1.o" "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../crti.o" "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../arm-angstrom-linux-gnueabi/4.7.3/crtbegin.o" "/usr/bin/../lib/freebasic/fbrt0.o" "test01.o" "-(" -lfb -ltinfo -lm -ldl -lpthread -lgcc -lgcc_eh -lc "-)" "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../arm-angstrom-linux-gnueabi/4.7.3/crtend.o" "/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../crtn.o"
all bold parts must be defined inside of fbc.bas enums in fbc.bi
NOTE:it isn't ld-linux.so.2 it must be ld-linux.so.3
you know it before ?

Joshy
Last edited by D.J.Peters on Jul 04, 2013 16:22, edited 3 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by D.J.Peters »

@dkl to get fbc working here it's currently a kind of hack.
what is the right place/file to add a new intrinsic define __FB_LINUX_ARM__ ?
the right FB_TARGET are not detected inside the makefile.

I added new preproc things:
-DDISABLE_PORTIO (no asm !!!hw port I/O!!! access, returns Illegal function call)
-DDISABLE_FBDEV (no framebuffer !!!hw port I/O!!! access)
-DDISABLE_OPENGL (optional Angstrom Linux makes trouble)

Joshy
Beaglebone black: Angstrom Linux uname -a wrote:Linux beaglebone 3.8.13 #1 SMP Tue Jun 25 08:17:15 EDT 2013 armv7l GNU/Linux
Raspberry pi: Raspian Linux uname -a wrote:Linux pi 3.6.11+ #474 PREEMPT Thu Jun 13 17:14:42 BST 2013 arm6l GNU/Linux
Last edited by D.J.Peters on Jul 24, 2013 3:31, edited 4 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by D.J.Peters »

@TJF do you created a simple libX11 or GTK+ window in C/C++ on your angstrom gnome desktop or what ever it is ?
The fbgfx window doesn't have any window decoration no titlebar nor a border at all and i don't know why.

Joshy
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by dkl »

symb-define.bas, but I think it'd be better to use __FB_ARM__ (and perhaps also __FB_X86__) i.e. separate #defines for architecture and system.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by TJF »

D.J.Peters wrote:@TJF do you created a simple libX11 or GTK+ window in C/C++ on your angstrom gnome desktop or what ever it is ?
The fbgfx window doesn't have any window decoration no titlebar nor a border at all and i don't know why.
I didn't run the board in grafic mode yet (no display).

But also in text mode there're some issues here. Ie INKEY doesn't work under Angström. A lot of work to do ...
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by D.J.Peters »

TJF wrote:A lot of work to do ...
yes i know for example sleep 1000,1 works only with the key flag and the X11 gfx driver need some changes.
Before i get more in details I will research how SDL and GTK create a window and catch the events on Angstrom.

By the way i compile my own stuff on an USB stick
but I installed many dev packages in the past on the internal 2GB memory
it looks i have not enough free space any more.

I found a nice page to setup two systemd services on the BBB to use a time server after every system start.
It's importend to have the right date and time for the filesystem. (make, and version control systems like git,github etc. need it)
http://derekmolloy.ie/automatically-set ... using-ntp/

Joshy
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by TJF »

Got the new display right now.

I tested examples/Gtk/FB_Calc/src/FB_Calc.bas and it compiles. But executing makes the system hang. (Window is without border /decoration -- an fbc issue since other apps run.)
D.J.Peters wrote:Before i get more in details I will research how SDL and GTK create a window and catch the events on Angstrom.
Don't know about SDL. But for GTK+ you can find the device handling (screen / mouse / keyboard / ...) in GDK-X11 source.
D.J.Peters wrote:it looks i have not enough free space any more.
When you right-click on File System in the file browser (nautilus) it shows the free space. (About 500 MB on a fresh image.)
D.J.Peters wrote:It's importend to have the right date and time for the filesystem.
Thx. Meanwhile I switched to Ubuntu on SD. It feels more comfortable and the packages seem to be more complete. (Ie GL out-of-the-box without compiling mesa. Or libsup++ is pre-installed.) It seems that fbc compiled on Ubuntu is working better (ie INKEY is OK).

Anyway, a lot of things to test ... Keep me informed about your results, pls.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Some tests

Post by TJF »

I managed to compile some FB examples, ie
Image

It isn't a productive system ATM, but I see some faint light at the end of the tunnel.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by D.J.Peters »

Good job TJF ubuntu, debian is Ok
Angstrom seems to be a real challenge.

Joshy
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: I got my brand new toys. (ARM Linux new target for fbc)

Post by TJF »

D.J.Peters wrote:... ubuntu, debian is Ok
Angstrom seems to be a real challenge.
Yes, but also with Ubuntu 13.04 I wasted a lot of time. It seems to have some issues in the packages. I couldn't install the LXDE desktop. (Works well on 12.10.)

Ubuntu-binaries don't execute on Angström. Did you test Debian yet? If so: a) which desktop? b) can you test some binaries on Debian for me?
Post Reply