Commit 66805479 authored by Marcus Greiff's avatar Marcus Greiff

Warning - potentially breaking changes on some BBs (see commit message)

May need to revert to previous commit, as the current script fails to
pre-compile on the newly flashed BBs. Currently, opening a julia prompt on the
BB and running

    include("/home/debian/juliapackages/LabConnections/src/BeagleBone/startup/startup.jl")

runs. However, if running this from the julia.server sript upon booting the BB,
the package 'LabConnections' cannot be found. If disbling the service,
pushing the path in julia allows commands such as

    using LabConnections

run, but the tests (which ran on my previous BB installation) no longer pass.
These have not been changed since the most recent commit.
parent 397b4159
......@@ -153,27 +153,28 @@ function run_server(port=2001; debug=false)
try
@async while __waiting_first_connection__ && !debug
#Blink SysLED 2 when waiting for first connection to signal availability
led = initdev("sysled",2)
write!(led, true)
led = initdev("sysled",Int32(2))
write!(led, "1")
sleep(0.4)
write!(led, false)
write!(led, "0")
sleep(0.2)
write!(led, true)
write!(led, "1")
sleep(0.4)
write!(led, false)
write!(led, "0")
sleep(0.8)
closedev("sysled", Int32(2))
end
sock = accept(server)
__waiting_first_connection__ = false
@async while isopen(sock)
try
l = deserialize(sock);
#println("deserialize: $l")
bbparse(l, sock)
catch err
if !isopen(sock) && isa(err, Base.EOFError)
if !isopen(sock) && (isa(err, Base.EOFError) || isa(err, Base.UVError))
println("Connection to server closed")
else
println("error: $(typeof(err))")
throw(err)
end
end
......
......@@ -7,21 +7,23 @@ function precompile_bb()
#Precompile serialize
initdev("debug", Int32(1))
serialize(clientside, (true, Int32(2), ("debug", Int32(1), true), ("debug", Int32(1), (1,2.0,"asd"))))
serialize(clientside, (true, Int32(2), ("debug", Int32(1), Int32(1)),
("debug", Int32(1), 1.0)))
serialize(clientside, (false, Int32(2), ("debug", Int32(1)),
("debug", Int32(1))))
serialize(clientside, (true, Int32(2), ("debug", Int32(1), Int32(1)), ("debug", Int32(1), 1.0)))
serialize(clientside, (false, Int32(2), ("debug", Int32(1)), ("debug", Int32(1))))
serialize(clientside, (true, Int32(1), ("debug", Int32(1), true)))
serialize(clientside, (false, Int32(1), ("debug", Int32(1))))
serialize(clientside, (true, Int32(4), ("debug", Int32(1), true), ("debug", Int32(2), false),
("debug", Int32(3), true), ("debug", Int32(4), false)))
serialize(clientside, (true, Int32(4), ("debug", Int32(1), true), ("debug", Int32(2), false), ("debug", Int32(3), true), ("debug", Int32(4), false)))
# Close the client side
close(clientside)
#Close server
close(server)
debug = true
#Precompile SysLED
led = initdev("sysled",Int32(1))
write!(led, "1", debug)
......@@ -32,6 +34,7 @@ function precompile_bb()
# Precompile GPIO
gpio = initdev("gpio",Int32(1))
write!(gpio, (Int32(1), "1"), debug)
#read(gpio, ind, args, debug)
......@@ -49,7 +52,6 @@ function precompile_bb()
file = open(testfile, "r")
l = readline(file)
close(file)
println("Read from file: $l")
try getdev("nonexistent") catch end
try bbparse("Invalid input") catch end
......
To setup automatic start of julia server on the beagle bone
1. Make sure that julia is installed in `/home/debian/julia-903644385b/bin/julia` on the BeagleBone or edit `juliaserver.service` accordingly
1. Make sure that julia is installed in `/home/debian/julia/bin/julia` on the BeagleBone or edit `juliaserver.service` accordingly
2. Create the folder `/home/debian/juliapackages/` on the BeagleBone
3. On the computer, go to `LabConnections/util` and run `./copyfoldertobb.sh`
- If this failes, make sure that there is not already a folder `/home/debian/juliapackages/LabConnections`
1. Copy `LabConnections/src/BeagleBone/startup/juliaserver.service` to `/lib/systemd/system/juliaserver.service` on the BeagleBone.
2. Run: `sudo systemctl enable juliaserver` on BeagleBone
3. Run: `sudo systemctl start juliaserver` on BeagleBone
1. Run `install.sh` on the BB
After a while, the BeagleBone should start blinking on SysLED 2: on-off-on-sleep-repeat
......
#!/bin/bash
sudo cp LabConnections/src/BeagleBone/startup/juliaserver.service /lib/systemd/system/juliaserver.service
sudo systemctl enable juliaserver
sudo systemctl start juliaserver
......@@ -2,8 +2,7 @@
Description=JuliaServer service
[Service]
ExecStart=/home/debian/julia-903644385b/bin/julia -i -e 'include("/home/debian/juliapackages/LabConnections/src/BeagleBone/startup/startup.jl")' &
ExecStart=/home/debian/julia/bin/julia -i -e 'include("/home/debian/juliapackages/LabConnections/src/BeagleBone/startup/startup.jl")' &
[Install]
WantedBy=multi-user.target
......@@ -7,7 +7,7 @@ NC='\033[0m'
BASEDIR=../../$(dirname "$0")
# Dependencies
packages=(LabConnections YAML Codecs Compat)
packages=(LabConnections SPI_driver)
# Create an empty directory to bundle packages
if [ -d ${BASEDIR}/juliapackages ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment