Giter Club home page Giter Club logo

rc-switch's Introduction

rc-switch

Not really rc-switch but more like a test I made of the CGO wrapper on a cross-compiled C arm lib.

quick start

wget https://git.io/fjnXH && \
unzip send_sniffer_0.0.1.zip
./send 0 9999
./sniffer 2

TODO

  • more doc
  • more experiment
  • real auto tests

requirements

setup cross compile

get the toolchain

git clone https://github.com/raspberrypi/tools

add toolchain compilers to path

PATH=$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/

build wiring pi lib (command has to be ran on the target)

apt install git && \
cd /tmp && \
git clone https://github.com/WiringPi/WiringPi && \
cd WiringPi && \
./build

repatriate the compiled .so(s) to the compiler

scp <user@pi>:/usr/local/lib/libwiringPi* ~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/lib/

cross the hell compile to arm

make

send binary to target

scp build/send build/sniffer <user@pi>:/tmp

run (target)

./sniffer 2
./send 0 9999

tests

easy way to find out if compilation is well made and lib is loaded in the wrapper:

env GOOS=linux GOARCH=arm CC=arm-linux-gnueabihf-gcc CC_FOR_TARGET=arm-linux-gnueabihf-gcc CGO_ENABLED=1 go build -i -v -o build/test tests/testCompilation.go
./build/test 
2019/04/22 15:06:16 calling setup
2019/04/22 15:06:16 calling handler
compilation succeed, lib loaded

sources

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.