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

lora: Support RISC-V build, update to latest libtock-c and move to examples #432

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[submodule "lvgl/lvgl"]
path = lvgl/lvgl
url = https://github.com/littlevgl/lvgl.git
[submodule "examples/lora/RadioLib"]
path = wip/lora/RadioLib
url = https://github.com/jgromes/RadioLib.git
[submodule "libopenthread/openthread"]
path = libopenthread/openthread
url = https://github.com/openthread/openthread.git
[submodule "libradio/RadioLib"]
path = libradio/RadioLib
url = https://github.com/jgromes/RadioLib.git
4 changes: 0 additions & 4 deletions TockLibrary.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ $(call check_defined, LIBNAME)
$(call check_defined, $(LIBNAME)_DIR)
$(call check_defined, $(LIBNAME)_SRCS)

ifeq ($(strip $($(LIBNAME)_SRCS)),)
$(error Library "$(LIBNAME)" has no SRCS?)
endif

Comment on lines -32 to -35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@alistair23 alistair23 Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically when running the formatter in the CI, the submodules aren't cloned. So no SRCs are found as there are no wildcards.

This avoids that error.

# directory for built output
$(LIBNAME)_BUILDDIR := $($(LIBNAME)_DIR)/build

Expand Down
11 changes: 11 additions & 0 deletions wip/lora/README.md → examples/lora/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ RadioLib.
Note that the Makefiles will do this automatically when
you run `make` in a subdirectory, but if you want to do
it manually you can run the `build-RadioLib.sh` script.

### Building

To bulid any example just enter the directory and type

```shell
make
```

This will build RadioLib and then the example application for
both ARM and RISC-V architectures.
14 changes: 14 additions & 0 deletions examples/lora/sensor-receive/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Makefile for user application

# Specify this directory relative to the current application.
TOCK_USERLAND_BASE_DIR = ../../../

# Which files to compile.
CXX_SRCS := $(wildcard *.cc)

# Use the libtock-c Make system
include $(TOCK_USERLAND_BASE_DIR)/libradio/Makefile

include $(TOCK_USERLAND_BASE_DIR)/libradio/Makefile.app

include $(TOCK_USERLAND_BASE_DIR)/AppMakefile.mk
File renamed without changes.
14 changes: 14 additions & 0 deletions examples/lora/sensor-transmit/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Makefile for user application

# Specify this directory relative to the current application.
TOCK_USERLAND_BASE_DIR = ../../../

# Which files to compile.
CXX_SRCS := $(wildcard *.cc)

# Use the libtock-c Make system
include $(TOCK_USERLAND_BASE_DIR)/libradio/Makefile

include $(TOCK_USERLAND_BASE_DIR)/libradio/Makefile.app

include $(TOCK_USERLAND_BASE_DIR)/AppMakefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include "libtockHal.h"

// Include some libtock-c helpers
#include <sensors/humidity.h>
#include <sensors/temperature.h>
#include <libtock-sync/sensors/humidity.h>
#include <libtock-sync/sensors/temperature.h>

#define BUFFER_LEN 64

Expand Down Expand Up @@ -47,17 +47,17 @@ int main(void) {
}
printf("success!\r\n");

int temp = 0;
unsigned humi = 0;
int temp = 0;
int humi = 0;

// loop forever
for ( ;;) {
// Ensure there are no pending callbacks
yield_no_wait();

// Read some sensor data from the board
temperature_read_sync(&temp);
humidity_read_sync(&humi);
libtocksync_temperature_read(&temp);
libtocksync_humidity_read(&humi);

snprintf(buffer, BUFFER_LEN, "Temp: %d, Hum: %u", temp, humi);

Expand Down
39 changes: 39 additions & 0 deletions libradio/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
LIBNAME := RadioLib

TOCK_USERLAND_BASE_DIR ?= ../

$(LIBNAME)_DIR := $(TOCK_USERLAND_BASE_DIR)/libradio/$(LIBNAME)

# We ideally want this:
# $(LIBNAME)_SRCS := \
# $($(LIBNAME)_DIR)/src/Module.cpp \
# $(wildcard $($(LIBNAME)_DIR)/src/*.cpp) \
# $(wildcard $($(LIBNAME)_DIR)/src/*/*.cpp) \
# $(wildcard $($(LIBNAME)_DIR)/src/*/*/*.cpp)
#
# But due to this in the GCC arm binary in the CI:
#
# ```
# (insn 179 178 46 8 (set (reg:SI 3 r3 [168])
# (mem/u/c:SI (plus:SI (reg:SI 12 ip [169])
# (unspec:SI [
# (symbol_ref/u:SI ("*.LC1") [flags 0x2])
# ] UNSPEC_PIC_SYM)) [0 S4 A32])) "../../../RadioLib/src/modules/LR11x0/LR11x0.cpp":638:16 929 {*thumb1_movsi_insn}
# (expr_list:REG_EQUAL (symbol_ref/u:SI ("*.LC1") [flags 0x2])
# (nil)))
# during RTL pass: postreload
# ../../../RadioLib/src/modules/LR11x0/LR11x0.cpp:650:1: internal compiler error: in extract_constrain_insn, at recog.c:2195
# ```
#
# we need to drop LR11x0
$(LIBNAME)_SRCS := \
$(wildcard $($(LIBNAME)_DIR)/src/*.cpp) \
$(wildcard $($(LIBNAME)_DIR)/src/utils/*.cpp) \
$(wildcard $($(LIBNAME)_DIR)/src/modules/C*/.cpp) \
$(wildcard $($(LIBNAME)_DIR)/src/modules/LL*/*.cpp) \
$(wildcard $($(LIBNAME)_DIR)/src/modules/RF*/*.cpp) \
$(wildcard $($(LIBNAME)_DIR)/src/modules/S*/*.cpp) \
$(wildcard $($(LIBNAME)_DIR)/src/modules/n*/*.cpp) \
$(wildcard $($(LIBNAME)_DIR)/src/protocols/*/*.cpp) \

include $(TOCK_USERLAND_BASE_DIR)/TockLibrary.mk
5 changes: 5 additions & 0 deletions libradio/Makefile.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Include the core RadioLib headers
override CPPFLAGS += -isystem $(TOCK_USERLAND_BASE_DIR)/libradio/RadioLib/src

# Include the Tock specific headers
override CPPFLAGS += -isystem $(TOCK_USERLAND_BASE_DIR)/libradio/RadioLib/examples/NonArduino/Tock
1 change: 1 addition & 0 deletions libradio/RadioLib
Submodule RadioLib added at 954477
1 change: 0 additions & 1 deletion wip/lora/RadioLib
Submodule RadioLib deleted from 0ef554
26 changes: 0 additions & 26 deletions wip/lora/build-RadioLib.sh

This file was deleted.

33 changes: 0 additions & 33 deletions wip/lora/sensor-receive/Makefile

This file was deleted.

33 changes: 0 additions & 33 deletions wip/lora/sensor-transmit/Makefile

This file was deleted.

Loading