Segmentation fault

22 views
Skip to first unread message

Neil Hancock

unread,
Jul 30, 2018, 9:13:58 PM7/30/18
to beagl...@googlegroups.com
Hi all
I'm compiling a fairly simple program that accesses the PRU0 shared ram
When I run it with sudo it has no problems. 
I'm guessing it access a privileged space but not sure the ways round the segmentation fault.
Any suggestions appreciated.

Neil

I want to run it from start up, which I think at its simplest means adding something to cloud9/auotrun -

I build the program with
sudo deploy.sh:
mkdir -p bin
gcc bbbio_api_mng.c -D MAIN_LOCAL -o  bin/bbbio_api_mng
chmod 755 bin/bbbio_api_mng
./bin/bbbio_api_mng

autorun.sh:  target program to add to cloud9/auotrun
#! /bin/bash
# This setupup the pins and auto starts the ppm-pru - works manually with sudo.
cd /var/lib/cloud9/git/bbb_pru_ppm

PIN_NUMBER1=P9_25
PIN_NUMBER2=P9_27
PIN_NUMBER3=P9_28
PIN_NUMBER4=P9_29
PIN_NUMBER5=P9_30
PIN_NUMBER6=P9_31
PIN_NUMBER7=P8_11
PIN_NUMBER8=P8_12
       config-pin -a $PIN_NUMBER1 pruout
config-pin -a $PIN_NUMBER2 pruout
config-pin -a $PIN_NUMBER3 pruout
config-pin -a $PIN_NUMBER4 pruout
config-pin -a $PIN_NUMBER5 pruout
config-pin -a $PIN_NUMBER6 pruout
config-pin -a $PIN_NUMBER7 pruout
config-pin -a $PIN_NUMBER8 pruout

./mng/bin/bbbio_api_mng
#end
------------------------------------------------------------------------
For reference:
$sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[31292bce1d4b35b497cc7a013d6d57e7e1f4f5c4]
eeprom:[A335BNLT000C1818BBBG0448]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-06-17]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.03-00002-gac9cce7c6a]:[location: dd MBR]
kernel:[4.14.49-ti-r54]
nodejs:[v6.14.3]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.4.20180720.0-0rcnee0~stretch+20180720]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[roboticscape]:[0.4.4-git20180608.0-0rcnee0~stretch+20180609]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet cape_universaln=enable]
dmesg | grep pinctrl-single
[    1.115665] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[    1.123075] gpio-of-helper ocp:cape-universal: ready
END

Robert Nelson

unread,
Jul 30, 2018, 9:18:25 PM7/30/18
to Beagle Board
On Mon, Jul 30, 2018 at 8:13 PM, Neil Hancock <neilh...@gmail.com> wrote:
> Hi all
> I'm compiling a fairly simple program that accesses the PRU0 shared ram
> When I run it with sudo it has no problems.
> I'm guessing it access a privileged space but not sure the ways round the
> segmentation fault.
> Any suggestions appreciated.

We haven't figured out the udev rules yet for the pru, so sadly still
root only..

>
> Neil
>
> I want to run it from start up, which I think at its simplest means adding
> something to cloud9/auotrun -

Drew has a good startup example here:

https://github.com/adafruit/adafruit-beaglebone-io-python/blob/master/test/notes/run_config-pin_during_startup.md

Regards,

--
Robert Nelson
https://rcn-ee.com/

Neil Hancock

unread,
Aug 1, 2018, 5:30:33 PM8/1/18
to beagl...@googlegroups.com
Hi Robert
 Thanks for the link for the config-pins which I have working.
Ouch  on the startup - I'm from the small uC embedded world - so I'm learning about these things.udev sounds like its some infrastructure.

I found this link for accessing IO. 
Since it sounds like you have  been thinking about it - and how it relates to the PRU - are the init.d running as root.? 

thanks


--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAOCHtYg8V56Yf%2BCUJNfGKO0krjXqu0HE4y%3DN0CXmsvS6W7nDBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages