-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Features - Added Bubblemaker app - Added tmo_dev_edge board as a target for demo and minimal samples with the possibility to switch preferred network bearer and perform firmware update using the external flash
- Loading branch information
Showing
49 changed files
with
3,399 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# Copyright 2020-2023 AVSystem <avsystem@avsystem.com> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
cmake_minimum_required(VERSION 3.13.1) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(anjay_zephyr_demo) | ||
set(root_dir ${ANJAY_ZEPHYR_CLIENT_DIR}) | ||
|
||
if(CONFIG_PARTITION_MANAGER_ENABLED) | ||
# defined in nrf/cmake/partition_manager.cmake | ||
if(NOT EXISTS "${static_configuration_file}") | ||
set(pm_missing_message "Missing static partition manager file for board: ${BOARD}") | ||
|
||
if(ACTIVE_BOARD_REVISION) | ||
set(pm_missing_message "${pm_missing_message}, rev: ${ACTIVE_BOARD_REVISION}") | ||
endif() | ||
|
||
if(CONF_FILE_BUILD_TYPE) | ||
set(pm_missing_message "${pm_missing_message}, build type: ${CONF_FILE_BUILD_TYPE}") | ||
endif() | ||
|
||
message(FATAL_ERROR "${pm_missing_message}") | ||
endif() | ||
elseif(CONFIG_ANJAY_CLIENT_BUILD_MCUBOOT_AUTOMATICALLY) | ||
if("${CONFIG_MCUBOOT_SIGNATURE_KEY_FILE}" STREQUAL "") | ||
if(NOT CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE) | ||
message(FATAL_ERROR "Either MCUBOOT_SIGNATURE_KEY_FILE or MCUBOOT_GENERATE_UNSIGNED_IMAGE need to be set in Kconfig") | ||
endif() | ||
else() | ||
set(MCUBOOT_SIGNATURE_KEY_FILE "${CONFIG_MCUBOOT_SIGNATURE_KEY_FILE}") | ||
if(NOT IS_ABSOLUTE "${MCUBOOT_SIGNATURE_KEY_FILE}") | ||
set(MCUBOOT_SIGNATURE_KEY_FILE "${WEST_TOPDIR}/${MCUBOOT_SIGNATURE_KEY_FILE}") | ||
endif() | ||
endif() | ||
make_directory("${CMAKE_CURRENT_BINARY_DIR}/mcuboot") | ||
execute_process(COMMAND "${CMAKE_COMMAND}" | ||
-GNinja | ||
"-DAPPLICATION_CONFIG_DIR=${CMAKE_CURRENT_SOURCE_DIR}/child_image/mcuboot" | ||
"-DBOARD=${BOARD}" | ||
"-DCONF_FILE=${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr/prj.conf" | ||
"-DCONF_FILE_INCLUDE_FRAGMENTS=ON" | ||
"-DCONFIG_BOOT_SIGNATURE_KEY_FILE=\"${MCUBOOT_SIGNATURE_KEY_FILE}\"" | ||
"-DDTC_OVERLAY_FILE=${CMAKE_CURRENT_SOURCE_DIR}/child_image/mcuboot/boards/${BOARD}.overlay" | ||
"${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr" | ||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mcuboot" | ||
RESULT_VARIABLE MCUBOOT_CMAKE_RESULT) | ||
if(NOT MCUBOOT_CMAKE_RESULT EQUAL 0) | ||
message(FATAL_ERROR "Configuring MCUboot failed") | ||
endif() | ||
|
||
add_custom_target(mcuboot COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_CURRENT_BINARY_DIR}/mcuboot") | ||
|
||
# NOTE: This is largely copied from CMakeLists.txt in Zephyr itself. | ||
# However, using that would require setting HEX_FILES_TO_MERGE *before* | ||
# find_package(Zephyr), and we can't do that because we need to examine | ||
# Kconfig variables, which are populated by find_package(Zephyr). | ||
# That's why we do it ourselves here... | ||
set(MERGED_HEX_NAME "${CMAKE_CURRENT_BINARY_DIR}/zephyr/merged.hex") | ||
# In Zephyr 3.2, mergehex.py has been moved | ||
# from scripts/mergehex.py to scripts/build/mergehex.py | ||
set(MERGEHEX_SCRIPT "${ZEPHYR_BASE}/scripts/build/mergehex.py") | ||
if(NOT EXISTS "${MERGEHEX_SCRIPT}") | ||
set(MERGEHEX_SCRIPT "${ZEPHYR_BASE}/scripts/mergehex.py") | ||
endif() | ||
add_custom_command(OUTPUT "${MERGED_HEX_NAME}" | ||
COMMAND "${PYTHON_EXECUTABLE}" | ||
"${MERGEHEX_SCRIPT}" | ||
-o "${MERGED_HEX_NAME}" | ||
"${CMAKE_CURRENT_BINARY_DIR}/mcuboot/zephyr/zephyr.hex" | ||
"${CMAKE_CURRENT_BINARY_DIR}/zephyr/zephyr.signed.hex" | ||
DEPENDS mcuboot zephyr_final) | ||
add_custom_target(mergehex ALL DEPENDS "${MERGED_HEX_NAME}") | ||
|
||
if(TARGET runners_yaml_props_target) | ||
get_target_property(RUNNERS_YAML_CONTENTS runners_yaml_props_target yaml_contents) | ||
string(REGEX REPLACE "zephyr[a-zA-Z0-9._-]*[.]hex" "merged.hex" RUNNERS_YAML_CONTENTS "${RUNNERS_YAML_CONTENTS}") | ||
set_property(TARGET runners_yaml_props_target PROPERTY yaml_contents "${RUNNERS_YAML_CONTENTS}") | ||
endif() | ||
endif() | ||
|
||
set(app_sources | ||
src/main_app.c | ||
src/sensors.c | ||
src/sensors.h | ||
src/status_led.c | ||
src/status_led.h | ||
src/peripherals.h | ||
src/bubblemaker.c | ||
src/bubblemaker.h | ||
src/led_strip.c | ||
src/led_strip.h | ||
src/water_meter.c | ||
src/water_meter.h | ||
src/water_pump.c | ||
src/water_pump.h) | ||
|
||
target_sources(app PRIVATE | ||
${app_sources}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
menu "anjay-zephyr-client-app" | ||
|
||
config ANJAY_CLIENT_BUILD_MCUBOOT_AUTOMATICALLY | ||
bool "Build MCUboot as part of the main build process" | ||
depends on BOOTLOADER_MCUBOOT | ||
depends on !PARTITION_MANAGER_ENABLED | ||
select MCUBOOT_GENERATE_CONFIRMED_IMAGE | ||
default y | ||
|
||
endmenu | ||
|
||
source "Kconfig.zephyr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Bubblemaker [<img align="right" height="50px" src="https://avsystem.github.io/Anjay-doc/_images/avsystem_logo.png">](http://www.avsystem.com/) | ||
|
||
## Supported hardware and overview | ||
This folder contains support for the following targets: | ||
- [nrf9160dk_nrf9160_ns](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf9160.html) | ||
- [nrf7002dk_nrf5340_cpuapp](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/device_guides/working_with_nrf/nrf70/gs.html) | ||
|
||
The following LwM2M Objects are supported: | ||
- Security (/0) | ||
- Server (/1) | ||
- Device (/3) | ||
- Connectivity Monitoring (/4) | ||
- Firmware Update (/5) | ||
- Sensors: | ||
- Temperature (/3303) with multiple DS18B20 sensors on single 1Wire line | ||
- Pressure (/3323) | ||
- Acidity (/3326) | ||
- On/Off switch (/3342) | ||
- Push button (/3347) | ||
- Water meter (/3424) | ||
|
||
The Bubblemaker contains an example smart water meter demo with basic IPSO | ||
sensor support. It is possible to use a single water meter with an electrical or | ||
hand pump as well as two water meters with two hand pumps. When using two water | ||
meters, two players can compete and the winner is indicated through led strip | ||
light. | ||
|
||
To exclude sensor in a build, it is enough to comment or delete it's name in | ||
the `aliases` section or it's name and corresponding io-channel in the | ||
`zephyr,user` section in the `boards/<board_name>.overlay` file. For example, | ||
if the final configuration for `nRF9160 DK` should not contain temperature | ||
sensor #1, water pump and pressure sensors, the | ||
`boards/nrf9160dk_nrf9160_ns.overlay` file should look like this: | ||
``` | ||
/ { | ||
aliases { | ||
push-button-0 = &button0; | ||
push-button-1 = &button1; | ||
switch-0 = &button2; | ||
switch-1 = &button3; | ||
status-led = &led0; | ||
temperature-0 = &ds18b200; | ||
//temperature-1 = &ds18b201; | ||
led-strip = &led_strip; | ||
water-meter-0 = &water_meter0; | ||
water-meter-1 = &water_meter1; | ||
//water-pump-0 = &water_pump0; | ||
}; | ||
zephyr,user { | ||
/* these settings act as aliases for ADC sensors */ | ||
io-channels = <&adc 2>, <&adc 3>; | ||
io-channel-names = "acidity0", "acidity1"; | ||
}; | ||
/* rest of the file */ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# anjay-zephyr-client | ||
CONFIG_ANJAY_ZEPHYR_DEVICE_MANUFACTURER="Nordic Semiconductor" | ||
CONFIG_ANJAY_ZEPHYR_MODEL_NUMBER="nRF7002DK" | ||
|
||
# Anjay Settings | ||
CONFIG_ANJAY_COMPAT_MBEDTLS=y | ||
CONFIG_ANJAY_COMPAT_NET=y | ||
CONFIG_ANJAY_COMPAT_TIME=y | ||
CONFIG_ANJAY_LOG_LEVEL_INF=y | ||
CONFIG_ANJAY_WITH_NET_STATS=n | ||
CONFIG_ANJAY_WITH_SENML_JSON=y | ||
CONFIG_ANJAY_WITH_TRACE_LOGS=n | ||
CONFIG_ANJAY_WITH_ACCESS_CONTROL=n | ||
|
||
# General Settings | ||
CONFIG_MAIN_STACK_SIZE=2048 | ||
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 | ||
CONFIG_LOG_MAX_LEVEL=3 | ||
CONFIG_POSIX_MAX_FDS=16 | ||
|
||
# Networking | ||
CONFIG_NET_NATIVE=y | ||
CONFIG_NET_DHCPV4=y | ||
CONFIG_DNS_RESOLVER=y | ||
|
||
# WiFi | ||
CONFIG_WIFI=y | ||
CONFIG_WIFI_NRF700X=y | ||
CONFIG_WPA_SUPP=y | ||
CONFIG_NET_L2_WIFI_MGMT=y | ||
CONFIG_NET_L2_WIFI_MGMT_LOG_LEVEL_ERR=y | ||
CONFIG_NET_L2_ETHERNET=y | ||
|
||
# Clock synchronization | ||
CONFIG_DATE_TIME=y | ||
CONFIG_DATE_TIME_UPDATE_INTERVAL_SECONDS=600 | ||
CONFIG_DATE_TIME_TOO_OLD_SECONDS=600 | ||
CONFIG_DATE_TIME_NTP_QUERY_TIME_SECONDS=5 | ||
CONFIG_DATE_TIME_THREAD_STACK_SIZE=16384 | ||
|
||
# File system | ||
CONFIG_FLASH_PAGE_LAYOUT=y | ||
CONFIG_MPU_ALLOW_FLASH_WRITE=y | ||
|
||
# Heap | ||
CONFIG_HEAP_MEM_POOL_SIZE=200000 | ||
|
||
# Bubblemaker | ||
CONFIG_SENSOR=y | ||
CONFIG_ADC=y | ||
CONFIG_W1=y | ||
|
||
CONFIG_LED_STRIP=y | ||
CONFIG_WS2812_STRIP=y | ||
CONFIG_SPI=y | ||
|
||
CONFIG_GPIO=y |
Oops, something went wrong.