* Initial release for SX1302 CoreCell Reference Design.
This commit is contained in:
Michael Coracin 2019-07-12 15:40:13 +02:00
commit 4c61c5d48e
79 changed files with 30157 additions and 0 deletions

View file

@ -0,0 +1,83 @@
### get external defined data
include ../target.cfg
### User defined build options
ARCH ?=
CROSS_COMPILE ?=
BUILD_MODE := release
OBJDIR = obj
### ----- AVOID MODIFICATIONS BELLOW ------ AVOID MODIFICATIONS BELLOW ----- ###
ifeq '$(BUILD_MODE)' 'alpha'
$(warning /\/\/\/ Building in 'alpha' mode \/\/\/\)
WARN_CFLAGS :=
OPT_CFLAGS := -O0
DEBUG_CFLAGS := -g
LDFLAGS :=
else ifeq '$(BUILD_MODE)' 'debug'
$(warning /\/\/\/ Building in 'debug' mode \/\/\/\)
WARN_CFLAGS := -Wall -Wextra
OPT_CFLAGS := -O2
DEBUG_CFLAGS := -g
LDFLAGS :=
else ifeq '$(BUILD_MODE)' 'release'
$(warning /\/\/\/ Building in 'release' mode \/\/\/\)
WARN_CFLAGS := -Wall -Wextra
OPT_CFLAGS := -O2 -ffunction-sections -fdata-sections
DEBUG_CFLAGS :=
LDFLAGS := -Wl,--gc-sections
else
$(error BUILD_MODE must be set to either 'alpha', 'debug' or 'release')
endif
### Application-specific variables
APP_NAME := net_downlink
APP_LIBS := -lparson -lbase64 -lpthread
### Environment constants
LIB_PATH := ../libtools
### Expand build options
CFLAGS := -std=c99 $(WARN_CFLAGS) $(OPT_CFLAGS) $(DEBUG_CFLAGS)
CC := $(CROSS_COMPILE)gcc
AR := $(CROSS_COMPILE)ar
### General build targets
all: $(APP_NAME)
clean:
rm -f obj/*.o
rm -f $(APP_NAME)
install:
ifneq ($(strip $(TARGET_IP)),)
ifneq ($(strip $(TARGET_DIR)),)
ifneq ($(strip $(TARGET_USR)),)
@echo "---- Copying net_downlink files to $(TARGET_IP):$(TARGET_DIR)"
@ssh $(TARGET_USR)@$(TARGET_IP) "mkdir -p $(TARGET_DIR)"
@scp net_downlink $(TARGET_USR)@$(TARGET_IP):$(TARGET_DIR)
else
@echo "ERROR: TARGET_USR is not configured in target.cfg"
endif
else
@echo "ERROR: TARGET_DIR is not configured in target.cfg"
endif
else
@echo "ERROR: TARGET_IP is not configured in target.cfg"
endif
$(OBJDIR):
mkdir -p $(OBJDIR)
### Compile main program
$(OBJDIR)/$(APP_NAME).o: src/$(APP_NAME).c | $(OBJDIR)
$(CC) -c $< -o $@ $(CFLAGS) -Iinc -I../libtools/inc
### Link everything together
$(APP_NAME): $(OBJDIR)/$(APP_NAME).o
$(CC) -L$(LIB_PATH) $^ -o $@ $(LDFLAGS) $(APP_LIBS)
### EOF

View file

@ -0,0 +1,62 @@
______ _
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2019 Semtech
Utility: Downlink server
========================
## 1. Introduction
This utility allows to send regular downlink requests to the packet forwarder
running on the gateway.
The downlinks are sent in 'immediate' mode, meaning that the SX1302 will send
the incoming packet over the air as soon as it receives it.
So, the net_downlink utility will construct a JSON 'txpk' object based on given
command line arguments, and send it on a UDP socket on the given port. Then the
packet forwarder receives it on its downlink socket, parses the JSON object to
build the packet buffer to be sent to the concentrator board.
This utility can be compiled and run on the gateway itself, or on a PC.
Optionally, the net_downlink utility can forward the received uplinks
(PUSH_DATA) to another UDP server, which can be useful for uplink Packet Error
Rate measurement while performing downlink testing (full-duplex testing etc...)
In can also be used as a UDP packet logger, logging all uplinks in a CSV file.
## 2. Dependencies
A packet forwarder must be running to receive downlink packets and send it to
the concentrator board.
## 3. Usage
### 3.1. Packet Forwarder configuration
The 'global_conf.json' file provided with the packet forwarder can be used, only
the 'server_address' must be set to 'localhost' if net_downlink is running on
the gateway itself, or set to the IP address of the PC on which the utility is
running.
### 3.2. Launching the packet forwarder
The packet forwarder has to be launched with the global_conf.json described in
3.1.
`./lora_pkt_fwd -c global_conf.json`
### 3.3. Launching net_downlink
The net_downlink utility can be started with various command line arguments.
In order to get the available options, and some examples, run:
`./net_downlink -h`
To stop the application, press Ctrl+C.

File diff suppressed because it is too large Load diff