Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rpi cross compile with simple_test programm #51

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
66 changes: 66 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,67 @@
.DS_Store

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

.idea

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml

# Sensitive or high-churn files:
.idea/dataSources/
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Ignore CMake stuff
CMakeCache.txt
CMakeFiles
CMakeScripts
Makefile
cmake_install.cmake
install_manifest.txt
CTestTestfile.cmake
CMakeLists.txt

#files being edited
*~

# make and build files
*.lst
*.o
*.eep
*.lss
*.map
*.sym
24 changes: 24 additions & 0 deletions Raspberry/README.CROSSCOMPILE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Crosscompiling Low-cost LoRa gateway for the Raspberry
====================================


> apt-get install git rsync cmake libc6-i386 lib32z1 lib32stdc++6

> mkdir -p ~/raspberrypi
> cd ~/raspberrypi
> git clone git://github.com/raspberrypi/tools.git


You wanted to use the following of the 3 ones, gcc-linaro-arm-linux-gnueabihf-raspbian

> echo 'export PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin' >> ~/.bashrc

> source ~/.bashrc

Now, verify that you can access the compiler:

> arm-linux-gnueabihf-gcc -v

Compiling:

> make CXX=arm-linux-gnueabihf-g++ LD=arm-linux-gnueabihf-ld
67 changes: 39 additions & 28 deletions Raspberry/makefile
Original file line number Diff line number Diff line change
@@ -1,91 +1,102 @@
include radio.makefile

###############################################################################
# Simple Temp example
###############################################################################
simple_temp_pi2: simple_temp_pi2.o arduPi_pi2.o SX1272_pi2.o
$(CXX) -lrt -lpthread simple_temp_pi2.o arduPi_pi2.o SX1272_pi2.o -o simple_temp_pi2

simple_temp_pi2.o: simple_temp.cpp
$(CXX) $(CFLAGS) -DRASPBERRY -DRASPBERRY2 -DIS_RCV_GATEWAY -c simple_temp.cpp -o simple_temp_pi2.o

###############################################################################

lora_gateway: lora_gateway.o arduPi.o SX1272.o
g++ -lrt -lpthread lora_gateway.o arduPi.o SX1272.o -o lora_gateway
$(CXX) -lrt -lpthread lora_gateway.o arduPi.o SX1272.o -o lora_gateway

lora_gateway_pi2: lora_gateway_pi2.o arduPi_pi2.o SX1272_pi2.o
g++ -lrt -lpthread lora_gateway_pi2.o arduPi_pi2.o SX1272_pi2.o -o lora_gateway_pi2
$(CXX) -lrt -lpthread lora_gateway_pi2.o arduPi_pi2.o SX1272_pi2.o -o lora_gateway_pi2
rm -f lora_gateway
ln -s lora_gateway_pi2 ./lora_gateway

lora_gateway_wnetkey: lora_gateway.o arduPi.o SX1272_wnetkey.o
g++ -lrt -lpthread lora_gateway.o arduPi.o SX1272_wnetkey.o -o lora_gateway_wnetkey
$(CXX) -lrt -lpthread lora_gateway.o arduPi.o SX1272_wnetkey.o -o lora_gateway_wnetkey

lora_gateway_pi2_wnetkey: lora_gateway_pi2.o arduPi_pi2.o SX1272_pi2_wnetkey.o
g++ -lrt -lpthread lora_gateway_pi2.o arduPi_pi2.o SX1272_pi2_wnetkey.o -o lora_gateway_pi2_wnetkey
$(CXX) -lrt -lpthread lora_gateway_pi2.o arduPi_pi2.o SX1272_pi2_wnetkey.o -o lora_gateway_pi2_wnetkey

lora_gateway_winput: lora_gateway_winput.o arduPi.o SX1272.o
g++ -lrt -lpthread lora_gateway_winput.o arduPi.o SX1272.o -o lora_gateway_winput
$(CXX) -lrt -lpthread lora_gateway_winput.o arduPi.o SX1272.o -o lora_gateway_winput

lora_gateway_pi2_winput: lora_gateway_pi2_winput.o arduPi_pi2.o SX1272_pi2.o
g++ -lrt -lpthread lora_gateway_pi2_winput.o arduPi_pi2.o SX1272_pi2.o -o lora_gateway_pi2_winput
$(CXX) -lrt -lpthread lora_gateway_pi2_winput.o arduPi_pi2.o SX1272_pi2.o -o lora_gateway_pi2_winput

lora_gateway.o: lora_gateway.cpp
g++ $(CFLAGS) -DRASPBERRY -DIS_RCV_GATEWAY -c lora_gateway.cpp -o lora_gateway.o
$(CXX) $(CFLAGS) -DRASPBERRY -DIS_RCV_GATEWAY -c lora_gateway.cpp -o lora_gateway.o

lora_gateway_pi2.o: lora_gateway.cpp
g++ $(CFLAGS) -DRASPBERRY -DRASPBERRY2 -DIS_RCV_GATEWAY -c lora_gateway.cpp -o lora_gateway_pi2.o
$(CXX) $(CFLAGS) -DRASPBERRY -DRASPBERRY2 -DIS_RCV_GATEWAY -c lora_gateway.cpp -o lora_gateway_pi2.o

lora_gateway_winput.o: lora_gateway.cpp
g++ $(CFLAGS) -DRASPBERRY -DIS_RCV_GATEWAY -DWINPUT -c lora_gateway.cpp -o lora_gateway_winput.o
$(CXX) $(CFLAGS) -DRASPBERRY -DIS_RCV_GATEWAY -DWINPUT -c lora_gateway.cpp -o lora_gateway_winput.o

lora_gateway_pi2_winput.o: lora_gateway.cpp
g++ $(CFLAGS) -DRASPBERRY -DRASPBERRY2 -DIS_RCV_GATEWAY -DWINPUT -c lora_gateway.cpp -o lora_gateway_pi2_winput.o
$(CXX) $(CFLAGS) -DRASPBERRY -DRASPBERRY2 -DIS_RCV_GATEWAY -DWINPUT -c lora_gateway.cpp -o lora_gateway_pi2_winput.o

arduPi.o: arduPi.cpp arduPi.h
g++ -c arduPi.cpp -o arduPi.o
$(CXX) -c arduPi.cpp -o arduPi.o

arduPi_pi2.o: arduPi_pi2.cpp arduPi_pi2.h
g++ -c arduPi_pi2.cpp -o arduPi_pi2.o
$(CXX) -c arduPi_pi2.cpp -o arduPi_pi2.o

SX1272.o: SX1272.cpp SX1272.h
g++ -c SX1272.cpp -o SX1272.o
$(CXX) -c SX1272.cpp -o SX1272.o

SX1272_pi2.o: SX1272.cpp SX1272.h
g++ -DRASPBERRY2 -c SX1272.cpp -o SX1272_pi2.o
$(CXX) -DRASPBERRY2 -c SX1272.cpp -o SX1272_pi2.o

SX1272_wnetkey.o: SX1272.cpp
g++ -DW_NET_KEY -c SX1272.cpp -o SX1272_wnetkey.o
$(CXX) -DW_NET_KEY -c SX1272.cpp -o SX1272_wnetkey.o

SX1272_pi2_wnetkey.o: SX1272.cpp
g++ -DRASPBERRY2 -DW_NET_KEY -c SX1272.cpp -o SX1272_pi2_wnetkey.o
$(CXX) -DRASPBERRY2 -DW_NET_KEY -c SX1272.cpp -o SX1272_pi2_wnetkey.o

lora_las_gateway: lora_las_gateway.o LoRaActivitySharing.o arduPi.o SX1272.o
g++ -lrt -lpthread lora_las_gateway.o LoRaActivitySharing.o arduPi.o SX1272.o -o lora_las_gateway
$(CXX) -lrt -lpthread lora_las_gateway.o LoRaActivitySharing.o arduPi.o SX1272.o -o lora_las_gateway

lora_las_gateway_pi2: lora_las_gateway_pi2.o LoRaActivitySharing.o arduPi_pi2.o SX1272_pi2.o
g++ -lrt -lpthread lora_las_gateway_pi2.o LoRaActivitySharing.o arduPi_pi2.o SX1272_pi2.o -o lora_las_gateway_pi2
$(CXX) -lrt -lpthread lora_las_gateway_pi2.o LoRaActivitySharing.o arduPi_pi2.o SX1272_pi2.o -o lora_las_gateway_pi2

lora_las_gateway_wnetkey: lora_las_gateway.o LoRaActivitySharing.o arduPi.o SX1272_wnetkey.o
g++ -lrt -lpthread lora_las_gateway.o LoRaActivitySharing.o arduPi.o SX1272_wnetkey.o -o lora_las_gateway_wnetkey
$(CXX) -lrt -lpthread lora_las_gateway.o LoRaActivitySharing.o arduPi.o SX1272_wnetkey.o -o lora_las_gateway_wnetkey

lora_las_gateway_pi2_wnetkey: lora_las_gateway_pi2.o LoRaActivitySharing.o arduPi_pi2.o SX1272_pi2_wnetkey.o
g++ -lrt -lpthread lora_las_gateway.o LoRaActivitySharing.o arduPi_pi2.o SX1272_pi2_wnetkey.o -o lora_las_gateway_pi2_wnetkey
$(CXX) -lrt -lpthread lora_las_gateway.o LoRaActivitySharing.o arduPi_pi2.o SX1272_pi2_wnetkey.o -o lora_las_gateway_pi2_wnetkey

lora_las_gateway.o: lora_gateway.cpp
g++ $(CFLAGS) -DRASPBERRY -DIS_RCV_GATEWAY -DLORA_LAS -c lora_gateway.cpp -o lora_las_gateway.o
$(CXX) $(CFLAGS) -DRASPBERRY -DIS_RCV_GATEWAY -DLORA_LAS -c lora_gateway.cpp -o lora_las_gateway.o

lora_las_gateway_pi2.o: lora_gateway.cpp
g++ $(CFLAGS) -DRASPBERRY -DRASPBERRY2 -DIS_RCV_GATEWAY -DLORA_LAS -c lora_gateway.cpp -o lora_las_gateway_pi2.o
$(CXX) $(CFLAGS) -DRASPBERRY -DRASPBERRY2 -DIS_RCV_GATEWAY -DLORA_LAS -c lora_gateway.cpp -o lora_las_gateway_pi2.o

LoRaActivitySharing.o: LoRaActivitySharing.cpp LoRaActivitySharing.h
g++ -c LoRaActivitySharing.cpp -o LoRaActivitySharing.o
$(CXX) -c LoRaActivitySharing.cpp -o LoRaActivitySharing.o

#for testing as a very simple end-device
lora_device: lora_gateway_dev.o arduPi.o SX1272.o
g++ -lrt -lpthread lora_gateway_dev.o arduPi.o SX1272.o -o lora_device
$(CXX) -lrt -lpthread lora_gateway_dev.o arduPi.o SX1272.o -o lora_device

lora_device_pi2: lora_gateway_dev_pi2.o arduPi_pi2.o SX1272_pi2.o
g++ -lrt -lpthread lora_gateway_dev.o arduPi_pi2.o SX1272_pi2.o -o lora_device_pi2
$(CXX) -lrt -lpthread lora_gateway_dev.o arduPi_pi2.o SX1272_pi2.o -o lora_device_pi2

lora_gateway_dev.o: lora_gateway.cpp
g++ $(CFLAGS) -DRASPBERRY -DIS_SEND_GATEWAY -DWINPUT -c lora_gateway.cpp -o lora_gateway_dev.o
$(CXX) $(CFLAGS) -DRASPBERRY -DIS_SEND_GATEWAY -DWINPUT -c lora_gateway.cpp -o lora_gateway_dev.o

lora_gateway_dev_pi2.o: lora_gateway.cpp
g++ $(CFLAGS) -DRASPBERRY -DRASPBERRY2 -DIS_SEND_GATEWAY -DWINPUT -c lora_gateway.cpp -o lora_gateway_dev_pi2.o
$(CXX) $(CFLAGS) -DRASPBERRY -DRASPBERRY2 -DIS_SEND_GATEWAY -DWINPUT -c lora_gateway.cpp -o lora_gateway_dev_pi2.o
#end

lib: arduPi.o arduPi_pi2.o SX1272.o SX1272_pi2.o SX1272_wnetkey.o SX1272_pi2_wnetkey.o lora_gateway.o lora_las_gateway.o lora_gateway_pi2.o lora_las_gateway_pi2.o

clean:
-rm *.o lora_*gateway
-rm *.o lora_*gateway simple_*temp_pi2
Loading