Segmentation fault

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

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,

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.
https://unix.stackexchange.com/questions/392826/auto-run-the-programs-when-the-system-turns-ondebian

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