Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
52eaea7
don't make otaa configurable at runtime
MedadRufus Aug 5, 2022
05f08f0
use ABP, not OTAA
MedadRufus Aug 5, 2022
d0cca79
revert unneeded change in cmakelists
MedadRufus Aug 5, 2022
e50d900
Revert unnecessary changes in NvmDataMgmt.c
MedadRufus Aug 5, 2022
0ffcb67
revert unnessary import
MedadRufus Aug 5, 2022
365b456
delete mocking/CMakeLists.txt
MedadRufus Aug 5, 2022
eaf3597
Indentation for cmake file
MedadRufus Aug 5, 2022
4f29714
Delete ideal_launch.json
MedadRufus Aug 5, 2022
d287dda
revert back adc-board.c changes
MedadRufus Aug 5, 2022
b0a2903
Delete config.c
MedadRufus Aug 5, 2022
1cc22c6
put back warning macro
MedadRufus Aug 5, 2022
217c122
significant simplifications and formatting of main.c
MedadRufus Aug 5, 2022
c631703
Merge branch 'icspace-dev' into #446-minimise-changes-from-stock-lora…
MedadRufus Aug 6, 2022
7b35e1e
delete mocking cmake
MedadRufus Aug 6, 2022
ae7804f
delete references to context_management_enabled variable
MedadRufus Aug 6, 2022
aef7585
don't build target main.c for unittests
MedadRufus Aug 6, 2022
6b93ee4
Merge branch 'icspace-dev' into #446-minimise-changes-from-stock-lora…
MedadRufus Aug 6, 2022
3f2d7c0
delete ref to do_n_transmissions() in uniitest
MedadRufus Aug 6, 2022
0530315
put back check for n polygons
MedadRufus Aug 6, 2022
c407b89
remove mock imports from where its not needed
MedadRufus Aug 6, 2022
90aa7c5
integration test executable
MedadRufus Aug 6, 2022
0cd7c92
get rid of mocks from gps
MedadRufus Aug 6, 2022
93f7bc3
just builds
MedadRufus Aug 6, 2022
286177a
add back in our way of incrementing time.
MedadRufus Aug 6, 2022
9e4a299
[bugfix] Fix correct count of txs on credential
MedadRufus Aug 6, 2022
c068fa7
[bugfix] Fix correct count of txs on credential
MedadRufus Aug 6, 2022
5c31541
return dummy gps info
MedadRufus Aug 6, 2022
8061bd3
need max of 20 timers
MedadRufus Aug 6, 2022
ba83218
use more of the original timer implementation
MedadRufus Aug 6, 2022
1bd4c76
put back all rtc stuff
MedadRufus Aug 6, 2022
3df1300
put in rtc mock
MedadRufus Aug 6, 2022
7412202
current time in rtc board mock
MedadRufus Aug 6, 2022
f819ea2
start and stop alarms
MedadRufus Aug 6, 2022
de7d975
Update rtc-board-mock.c
MedadRufus Aug 6, 2022
63a62d2
redundant code
MedadRufus Aug 6, 2022
0aef33d
Update timer-mock.cpp
MedadRufus Aug 8, 2022
96aedde
use original timer
MedadRufus Aug 8, 2022
57345c0
put in rtc converstion
MedadRufus Aug 8, 2022
6dd99e5
Delete timer-mock.cpp
MedadRufus Aug 8, 2022
256a787
RtcProcess and RtcTempCompensation
MedadRufus Aug 8, 2022
80a838e
Update main.c
MedadRufus Aug 8, 2022
1697ccd
delete redundant stuff
MedadRufus Aug 8, 2022
724d302
Update rtc-board-mock.c
MedadRufus Aug 8, 2022
41036b9
Update rtc-board-mock.c
MedadRufus Aug 8, 2022
3084340
Update rtc-board-mock.c
MedadRufus Aug 8, 2022
ed3c07a
Update main.c
MedadRufus Aug 8, 2022
7c27d77
Update rtc-board-mock.c
MedadRufus Aug 8, 2022
e1f9fa4
simplify
MedadRufus Aug 8, 2022
a78b6c0
setup alarm in right place
MedadRufus Aug 8, 2022
2b8fdfc
bump tx count only after the final rx has been received.
MedadRufus Aug 8, 2022
c38236b
Delete main.h
MedadRufus Aug 8, 2022
2d49f21
Update config.h
MedadRufus Aug 8, 2022
7875309
move rtc tick simulation off to separate files
MedadRufus Aug 8, 2022
55c1d17
Printout that lorawan stack initialised for wrong region
MedadRufus Aug 8, 2022
a21bdb3
Merge branch '#446-minimise-changes-from-stock-loramac-node' into int…
MedadRufus Aug 8, 2022
ea44209
Merge branch 'icspace-dev' into integration-tests
MedadRufus Sep 23, 2022
e5ec82b
Merge branch 'icspace-dev' into integration-tests
MedadRufus Sep 23, 2022
a9538b5
Merge branch 'icspace-dev' into integration-tests
MedadRufus Sep 24, 2022
52232ab
include grpc
MedadRufus Sep 24, 2022
6d45a20
add greeter client
MedadRufus Sep 24, 2022
1f18f40
first stab at using protobuf
MedadRufus Sep 24, 2022
b210b52
clone specific version
MedadRufus Sep 24, 2022
5d918ee
use fetchcontent
MedadRufus Sep 24, 2022
6ac4676
use src dir
MedadRufus Sep 24, 2022
30944a1
status messages
MedadRufus Sep 24, 2022
4134f59
hack it with fixed cache values
MedadRufus Sep 24, 2022
b54171d
shallow clone
MedadRufus Sep 24, 2022
4d4a842
Revert "shallow clone"
MedadRufus Sep 24, 2022
c595f1a
shallow clone
MedadRufus Sep 24, 2022
e6f8d92
build 64 bit
MedadRufus Sep 24, 2022
30aa330
use correct paths
MedadRufus Sep 24, 2022
f03fa0a
delete duplicate
MedadRufus Sep 24, 2022
14d2020
Update .gitignore
MedadRufus Sep 24, 2022
9b63bf8
temp disable usage of main.c
MedadRufus Sep 24, 2022
3779853
get rid of cpputest
MedadRufus Sep 24, 2022
e0f5a27
parallel build
MedadRufus Sep 24, 2022
dd7eb36
use pre-installed protobuf
MedadRufus Sep 24, 2022
48396da
Update cpputest.yml
MedadRufus Sep 24, 2022
0369dd3
Update cpputest.yml
MedadRufus Sep 24, 2022
3b04da0
Update cpputest.yml
MedadRufus Sep 24, 2022
a676fa5
Revert "Update cpputest.yml"
MedadRufus Sep 24, 2022
21f768c
Revert "Update cpputest.yml"
MedadRufus Sep 24, 2022
9413b4a
Revert "Update cpputest.yml"
MedadRufus Sep 24, 2022
a11cd6e
use correct path
MedadRufus Sep 24, 2022
27c63bd
move code into ublox-mock
MedadRufus Sep 24, 2022
c71aa2c
put in project files
MedadRufus Sep 24, 2022
2c52cf8
Delete common.cmake
MedadRufus Sep 24, 2022
56711a5
single target
MedadRufus Sep 24, 2022
b055eba
Revert "temp disable usage of main.c"
MedadRufus Sep 24, 2022
286addf
Revert "move code into ublox-mock"
MedadRufus Sep 24, 2022
644ded5
include main
MedadRufus Sep 24, 2022
0425078
greeter client is main
MedadRufus Sep 24, 2022
c964cf1
Revert "single target"
MedadRufus Sep 24, 2022
6d51863
make greeter client accessible from outside
MedadRufus Sep 24, 2022
fc5d18c
include mocks and files from project
MedadRufus Sep 24, 2022
10397e5
no local project
MedadRufus Sep 24, 2022
75a8a6f
include main
MedadRufus Sep 24, 2022
c338c4e
Revert "make greeter client accessible from outside"
MedadRufus Oct 31, 2022
62bd6f6
do it function
MedadRufus Oct 31, 2022
b1eac72
Create greeter_client.hpp
MedadRufus Oct 31, 2022
fd49c6c
call do it in main
MedadRufus Oct 31, 2022
04313f5
simplify
MedadRufus Oct 31, 2022
ef8bd5d
simplyfy stuff[does not work yet]
MedadRufus Oct 31, 2022
e0747e4
use classes - nearly compiles
MedadRufus Nov 1, 2022
6337c63
compile errors fixed - only linker errors
MedadRufus Nov 1, 2022
ce4d26f
put in c++ guards
MedadRufus Nov 1, 2022
8b9751a
delete cpp gps simulator
MedadRufus Nov 1, 2022
650c478
call from gps simulator[WORKS]
MedadRufus Nov 1, 2022
b7434af
[WIP] try to seperate out the init function from the get function
MedadRufus Nov 1, 2022
9f0329d
separate out greeter client[compiles]
MedadRufus Nov 2, 2022
a178869
fix order[WORKS]
MedadRufus Nov 2, 2022
a1df0e2
autoformat
MedadRufus Nov 2, 2022
cdad618
delete redundant struct elements
MedadRufus Nov 2, 2022
dd268b8
return gps info
MedadRufus Nov 2, 2022
28875cd
put back sats count
MedadRufus Nov 2, 2022
5533db9
more data types to be sent
MedadRufus Nov 2, 2022
da7dca8
its doubles
MedadRufus Nov 2, 2022
69bdce8
testing only[revert later]
MedadRufus Nov 2, 2022
f1b6df0
handle reply
MedadRufus Nov 3, 2022
53deddb
Revert "testing only[revert later]"
MedadRufus Nov 3, 2022
b28606a
helloworld
MedadRufus Nov 14, 2022
753e266
remove unneeded
MedadRufus Nov 14, 2022
932d54f
Create Makefile
MedadRufus Nov 14, 2022
393ed75
move and strip down
MedadRufus Nov 14, 2022
6ab7e20
Update .gitignore
MedadRufus Nov 14, 2022
239df0b
delete unneeded
MedadRufus Nov 14, 2022
dbee762
rename
MedadRufus Nov 14, 2022
7d39ee7
only use the hello .proto file
MedadRufus Nov 14, 2022
09949eb
Update greeter_client.cc
MedadRufus Nov 14, 2022
25385d2
use iterator
MedadRufus Nov 14, 2022
3b4a1f5
better tightness
MedadRufus Nov 14, 2022
1c47093
remove message
MedadRufus Nov 14, 2022
842d482
pass GPS status
MedadRufus Nov 14, 2022
a9188e1
baked in parameters
MedadRufus Nov 14, 2022
570fd9b
easier to debug
MedadRufus Nov 14, 2022
54a4d43
make sure tx count is incremented, even if it does not transmit
MedadRufus Nov 14, 2022
5315184
Merge branch 'icspace-dev' into further-integration-tests-make-it-work
MedadRufus Nov 14, 2022
2a4a4c3
Delete ublox-mock.cpp
MedadRufus Nov 14, 2022
47c9731
Merge branch 'icspace-dev' into further-integration-tests-make-it-work
MedadRufus Nov 15, 2022
070b928
Merge branch 'icspace-dev' into further-integration-tests-make-it-work
MedadRufus Nov 15, 2022
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
7 changes: 3 additions & 4 deletions .github/workflows/cpputest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ env:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
container:
image: pllee4/ubuntu-ci:20.04-gRPC

steps:
- uses: actions/checkout@v2
Expand All @@ -23,6 +25,3 @@ jobs:

- name: Build
run: cmake --build --preset=unittest_build

- name: Test
run: ctest --preset=unittest --rerun-failed --output-on-failure
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ ipch/
*.dbg*
*.scvd

.vscode/.cortex-debug.registers.state.json
:50003
:50006
.vscode/.cortex-debug.peripherals.state.json
.vscode/.cortex-debug.registers.state.json
:50003
:50006
.vscode/.cortex-debug.peripherals.state.json

# Generated files
tests/generator
12 changes: 10 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,25 @@
}
],
"buildPresets": [
{
"name": "parallel_build",
"description": "Build will all cores",
"displayName": "parallel_build",
"jobs": 0
},
{
"name": "unittest_build",
"description": "Build the unittest",
"displayName": "unittest_build",
"configurePreset": "unittesting_configs"
"configurePreset": "unittesting_configs",
"inherits": "parallel_build"
},
{
"name": "target_build",
"description": "Build for the STM32l0 target",
"displayName": "target_build",
"configurePreset": "on_target_configs"
"configurePreset": "on_target_configs",
"inherits": "parallel_build"
}
],
"testPresets": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ static uint8_t AppDataBuffer[LORAWAN_APP_DATA_BUFFER_MAX_SIZE];
*/
static LmHandlerAppData_t AppData =
{
.Buffer = AppDataBuffer,
.Port = 0,
.BufferSize = 0,
.Port = 0
.Buffer = AppDataBuffer
};

/*!
Expand Down Expand Up @@ -125,14 +125,14 @@ static volatile uint8_t IsTxFramePending = 0;
*/
extern Uart_t Uart1;


uint32_t tx_count_on_this_credential = 0;

/*!
* Main application entry point.
*/
int main( void )
{

#if( USE_WATCHDOG )
IWDG_Init( );
#endif
Expand All @@ -148,9 +148,6 @@ int main( void )
/* Initialise timer */
timer_init( );

/* Transmit immediately (10 milliseconds later) */
setup_next_tx_alarm( 10 );

while( 1 )
{
switch_to_next_registered_credentials( ); // Switch to the next set of
Expand All @@ -162,6 +159,9 @@ int main( void )

static void transmit_n_times_on_this_credential( void )
{
/* Transmit immediately (10 milliseconds later) */
setup_next_tx_alarm( 10 );

print_current_region( );

/* Configure the subband settings for AS923 BEFORE initing it. Only needed
Expand Down Expand Up @@ -244,8 +244,8 @@ static void PrepareTxFrame( void )
return;
}

tx_count_on_this_credential ++;
sensor_read_and_send( &AppData, LmHandlerParams.Region );
tx_count_on_this_credential++;
uint32_t interval = read_tx_interval_in_eeprom( TX_INTERVAL_EEPROM_ADDRESS,
TX_INTERVAL_GPS_FIX_OK );
setup_next_tx_alarm( interval );
Expand Down
2 changes: 1 addition & 1 deletion src/peripherals/bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,9 @@ void BSP_sensor_Init(void)
printf("SELFTEST: Initialising GPS\n\r");

GpioWrite(&Load_enable, 0); /* Enable power to GPS */
gps_info_latest = get_latest_gps_info();
//GPS SETUP
setup_GPS();
gps_info_latest = get_latest_gps_info();

IWDG_reset();

Expand Down
2 changes: 1 addition & 1 deletion src/peripherals/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ extern "C"
* @brief Define how quickly to return to searching for a GPS fix after transmitting
*
*/
#define TX_INTERVAL_GPS_FIX_OK 2800 /* When fix was aquired, then sleep for this period (in milliseconds) before searching again */
#define TX_INTERVAL_GPS_FIX_OK 10000 /* When fix was aquired, then sleep for this period (in milliseconds) before searching again */

/**
* @brief Lorawan defaults, normally will not be changed
Expand Down
112 changes: 67 additions & 45 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
cmake_minimum_required(VERSION 3.7)
# src/CMakeLists.txt
cmake_minimum_required(VERSION 3.5.1)

# For Protobuf's cmake warnings
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()

# Get the test framework Cpputest
include(FetchContent)
FetchContent_Declare(
cpputest
GIT_REPOSITORY https://github.com/cpputest/cpputest.git
GIT_TAG v4.0
)
# Set this to ON if you want to have the CppUTests in your project as well.
set(TESTS OFF CACHE BOOL "Switch off CppUTest Test build")


set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -m32")
set(CPPUTEST_LD_FLAGS "${CPPUTEST_LD_FLAGS} -m32")
# project(hello C CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

FetchContent_MakeAvailable(cpputest)

add_definitions(
-DREGION_EU868
Expand All @@ -35,9 +28,6 @@ add_definitions(
)


include_directories(${CPPUTEST_SRC_DIR})
include_directories(${CPPUTESTEXT_SRC_DIR})

# Test includes
include_directories(${PROJECT_SOURCE_DIR}/mocking)
include_directories(${PROJECT_SOURCE_DIR}/tests/mocks/)
Expand Down Expand Up @@ -65,7 +55,7 @@ include_directories(${PROJECT_SOURCE_DIR}/src/radio/sx1276/)

# Unittests
set(UNIT_TESTS
main.cpp
# main.cpp
geofence_ut.cpp
playback_ut.cpp
lorawan_credentials_ut.cpp
Expand Down Expand Up @@ -93,18 +83,12 @@ set(MOCKS
systime-mock.cpp
ublox-mock.cpp
nvm_images.cpp
gps_mock_utils.cpp
delay-board-mock.c
gpio_mock.c
rtc-board-mock.c
mocks/rtc_mock.c
)



# CLI sources


# Put in compile files(all logic so no hardware connection)
set(FILES_UNDER_TEST
${PROJECT_SOURCE_DIR}/src/peripherals/geofence.c
Expand All @@ -120,10 +104,9 @@ set(FILES_UNDER_TEST
${PROJECT_SOURCE_DIR}/src/apps/LoRaMac/common/LmHandler/LmHandler.c
${PROJECT_SOURCE_DIR}/src/system/delay.c
${PROJECT_SOURCE_DIR}/src/system/timer.c
${PROJECT_SOURCE_DIR}/src/apps/LoRaMac/common/callbacks.c



${PROJECT_SOURCE_DIR}/src/apps/LoRaMac/common/callbacks.c
${PROJECT_SOURCE_DIR}/src/apps/LoRaMac/periodic-uplink-lpp/B-L072Z-LRWAN1/main.cpp

# Compile region files
${PROJECT_SOURCE_DIR}/src/mac/region/RegionAU915.c
${PROJECT_SOURCE_DIR}/src/mac/region/RegionUS915.c
Expand Down Expand Up @@ -168,24 +151,63 @@ set(FILES_UNDER_TEST
${PROJECT_SOURCE_DIR}/src/apps/LoRaMac/common/message_sender.c

${PROJECT_SOURCE_DIR}/src/system/nvmm.c

greeter_client.cc

)

set(SOURCE_FILES
${UNIT_TESTS}
${MOCKS}
find_package(Threads REQUIRED)

# Find Protobuf installation
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
set(protobuf_MODULE_COMPATIBLE TRUE)
find_package(Protobuf CONFIG REQUIRED)
message(STATUS "Using protobuf ${Protobuf_VERSION}")

set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
set(_REFLECTION gRPC::grpc++_reflection)
find_program(_PROTOBUF_PROTOC protoc)

# Find gRPC installation
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
find_package(gRPC CONFIG REQUIRED)
message(STATUS "Using gRPC ${gRPC_VERSION}")

set(_GRPC_GRPCPP gRPC::grpc++)
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)

# Protos
get_filename_component(h_proto "hello.proto" ABSOLUTE)
get_filename_component(h_proto_path "${h_proto}" PATH)

# Generated sources
set(h_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/hello.pb.cc")
set(h_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/hello.pb.h")
set(h_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/hello.grpc.pb.cc")
set(h_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/hello.grpc.pb.h")
add_custom_command(
OUTPUT "${h_proto_srcs}" "${h_proto_hdrs}" "${h_grpc_srcs}" "${h_grpc_hdrs}"
COMMAND ${_PROTOBUF_PROTOC}
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
-I "${h_proto_path}"
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
"${h_proto}"
DEPENDS "${h_proto}")

# Generated sources headers
include_directories("${CMAKE_CURRENT_BINARY_DIR}")

# Targets (the binaries)

add_executable("project"
${FILES_UNDER_TEST}
${MOCKS}
${h_proto_srcs}
${h_grpc_srcs}
)
target_link_libraries("project"
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF}
)

add_executable(picotracker_lora_tests ${SOURCE_FILES})
target_compile_options(picotracker_lora_tests PRIVATE -fshort-enums)
# target_compile_options(picotracker_lora_tests PRIVATE -Wall -Wextra -Wpedantic)
target_link_libraries(picotracker_lora_tests PRIVATE CppUTest CppUTestExt)


# only build 32-bit binaries
target_compile_options(picotracker_lora_tests PRIVATE -m32)
target_link_options(picotracker_lora_tests PRIVATE -m32)

# Add tests
add_test(picotracker_lora_tests picotracker_lora_tests -p) # Pass option to run CppUTests all on different threads
1 change: 0 additions & 1 deletion tests/bsp_mock.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "CppUTestExt/MockSupport.h"

extern "C"
{
Expand Down
1 change: 0 additions & 1 deletion tests/eeprom-board-mock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* Modified by Medad Newman for unittesting
*/

#include "CppUTestExt/MockSupport.h"

extern "C"
{
Expand Down
57 changes: 0 additions & 57 deletions tests/gps_mock_utils.cpp

This file was deleted.

15 changes: 0 additions & 15 deletions tests/gps_mock_utils.hpp

This file was deleted.

Loading