Skip to content

Commit

Permalink
Update SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins authored and wirepas-bot committed Jul 15, 2020
1 parent fe25608 commit 1ed873f
Show file tree
Hide file tree
Showing 300 changed files with 15,952 additions and 4,167 deletions.
30 changes: 30 additions & 0 deletions board/nrf52832_mdk_v2/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* Copyright 2020 Wirepas Ltd. All Rights Reserved.
*
* See file LICENSE.txt for full license details.
*
*/

/**
* @file
*
* Board definition for the
* <a href="https://www.seeedstudio.com/nRF52832-MDK-V2-IoT-Micro-Development-Kit-p-3049.html"> nrf52832-MDK V2 kit</a>
*/

#ifndef _BOARD_NRF52832_MDK_V2_BOARD_H_
#define _BOARD_NRF52832_MDK_V2_BOARD_H_

// Serial port pins
#define BOARD_USART_TX_PIN 20
#define BOARD_USART_RX_PIN 19

// List of GPIO pins for the LEDs on the board: LED R, G, B
#define BOARD_LED_PIN_LIST {23, 22, 24}

// Active low polarity for LEDs
#define BOARD_LED_ACTIVE_LOW true

// The board supports DCDC
#define BOARD_SUPPORT_DCDC

#endif /* _BOARD_NRF52832_MDK_V2_BOARD_H_ */
3 changes: 3 additions & 0 deletions board/nrf52832_mdk_v2/config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Mcu of the board
MCU=nrf52
MCU_SUB=832
6 changes: 6 additions & 0 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ arm_toolchain=
# Sequence 0xFF = Will accept any valid OTAP sequence
otap_seq_number=1

# Only set this value if python interpreter is not found. Python3 is preferred.
# Python2 is end of life and support will be removed in the future.
# Leaving value empty uses the shebang value of the script, which is #!/usr/bin/env python3
# and fallback to "python" cmd
python_interpreter=

2 changes: 1 addition & 1 deletion doc_src_doxy/application_examples.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Application examples can be found @ref source_folder "here".
/** @example scheduler_example/app.c
*/

/** @example shared_libdata_example/app.c
/** @example shared_data_example/app.c
*/

/** @example test_app/app.c
Expand Down
38 changes: 17 additions & 21 deletions doc_src_doxy/doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,19 @@
The Single-MCU operation allows an application to run on the same
chip with Wirepas Mesh stack.
@htmlonly
<img src="main_components.png" usemap="#main_components_map">
<map name="main_components_map">
<area shape="rect" coords="0,0,691,77" href="#application"></area>
<area shape="rect" coords="102,131,319,205" href="#sdk_hal"></area>
<area shape="rect" coords="351,133,522,209" href="#sdk_libraries"></area>
<area shape="rect" coords="193,291,691,336" href="#single_mcu_api"></area>
<area shape="rect" coords="193,337,692,414" href="#wirepas_firmware"></area>
<area shape="rect" coords="372,447,560,524" href="#bootloader"></area>
<area shape="rect" coords="562,456,673,509" href="#bootloader_extension"></area>
<area shape="rect" coords="0,560,692,637" href="#hardware"></area>
</map>
@endhtmlonly
@image html main_components.png
Main components are following:
- @subpage application
- @subpage sdk_hal
- @subpage single_mcu_api
- @subpage sdk_libraries
- @subpage wirepas_firmware
- @subpage bootloader
- @subpage bootloader_extension
- @subpage hardware
@section application Application
@page application Application
Application firmware includes the application logic. There can be multiple
applications (i.e. different <I>kind of devices</I>) in the same network. For
Expand All @@ -46,7 +42,7 @@ and update a Wirepas Mesh network.
recommendations for application development.
@section sdk_hal Application-specific Hardware Abstraction Layer (HAL)
@page sdk_hal Application-specific Hardware Abstraction Layer (HAL)
This is commonly various software components for peripheral usage, such as
sensors/actuators and communication interfaces. Some of those are delivered as
Expand All @@ -56,15 +52,15 @@ shared between different _applications.
For HAL services offered by the SDK, see @ref api_folder "API services by SDK".
@section single_mcu_api Wirepas Mesh Single MCU API
@page single_mcu_api Wirepas Mesh Single MCU API
Wirepas Mesh stack provides Wirepas Mesh Single-MCU API for application to
use <I>stack services</I> and run tasks on the MCU.
@ref programming_interface "Application API" describes the programming
interface.
@section sdk_libraries Wirepas Mesh Single MCU libraries wrapper
@page sdk_libraries Wirepas Mesh Single MCU libraries wrapper
These libraries are wrappers on top of the @ref single_mcu_api "single MCU api".
Some services offered by the stack are quite low level and these wrapper
Expand All @@ -73,7 +69,7 @@ Main example is the app_scheduler abstracting the single periodic work offered
by stack.
@section wirepas_firmware Wirepas Mesh Stack
@page wirepas_firmware Wirepas Mesh Stack
Stack includes the Wirepas Mesh communication
stack and Wirepas scheduler for enabling the application operation in the same
MCU. Wirepas Mesh HAL includes all hardware abstractions and drivers <I>needed by
Expand All @@ -88,7 +84,7 @@ messaging) and has the highest priority. Thus, it is not recommended to
do processing intensive (time consuming) tasks on the application side.
Real-time guarantees are not provided to the application.
@section bootloader Wirepas Mesh Bootloader
@page bootloader Wirepas Mesh Bootloader
Wirepas provides a bootloader binary. Its main purpose is to do the basic
basic initialization of the hardware but also handle the processing of stored
Expand All @@ -97,14 +93,14 @@ Bootloader is in charge of the flash management and contains the flash
partitioning that is configured through an @ref config_mk_ini_file ".ini file".
@section bootloader_extension Custom bootloader extension
@page bootloader_extension Custom bootloader extension
Bootloader can be extended from the SDK. Main usage is to support an external
flash.
How to use it is described in a separated application note that will be
available soon from here.
@section hardware The physical Hardware
@page hardware The physical Hardware
This includes all the hardware of the device including the processor core,
radio for wireless communication and application-specific peripherals.
Expand Down
82 changes: 58 additions & 24 deletions doc_src_doxy/how_to_develop.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,30 @@ crucial point like the minimal steps to follow in the initialization of
an application and will give some practical guidance to correctly write
an application.
@section licensing Pre-requirements
This page contains following sections:
- @subpage licensing
- @subpage development_of_a_new_application
- @subpage build_application
- @subpage test_application
- @subpage flashing_device
- @subpage using_otap
- @subpage define_custom_board
- @subpage app_init
- @subpage adding_new_source_files_to_the_application
- @subpage recommendations
@page licensing Pre-requirements
In order to develop the software with SDK, you need to have a license for
Wirepas Mesh. Then, you have access to the firmware image according to your
architecture. If you don't have a license,
<a href="https://wirepas.com/contact/">contact Wirepas sales</a>.
@subsection debugging Debugging
This page contains following sections:
- @subpage debugging
- @subpage firmware_linking
@page debugging Debugging
In order to debug the devices with JTAG debugger, you need to use <I>
unprotected bootloader</I>. Whereas normal licensed Wirepas Mesh has JTAG
Expand All @@ -34,19 +50,25 @@ development. If you don't yet have an access to unlocked bootloader,
@note It is forbidden to install devices with unprotected bootloader in public
areas!
@subsection firmware_linking Installing firmware image
@page firmware_linking Installing firmware image
If you have licensed Wirepas Mesh, you have access to the firmware image. In
order to link that with the SDK, you have to unzip the firmware delivery to
<code>@ref image_folder "image/"</code> folder.
@section development_of_a_new_application Create new application
@page development_of_a_new_application Create new application
In this chapter we will create a new application named <code>new_app</code>.
It describes the initial steps to start writing a new application.
@subsection copy_of_an_application_example Copy of an application example
This page contains following sections:
- @subpage copy_of_an_application_example
- @subpage change_default_network_address_and_channel
- @subpage change_of_app_area_id
- @subpage configuration_of_a_node
@page copy_of_an_application_example Copy of an application example
The provided SDK contains several @ref source_folder "example applications".
They can be used as a starting point (Here, @ref custom_app/app.c "custom_app"
Expand All @@ -59,7 +81,7 @@ from <code>source/</code> folder can be used as a starting point.
To start developing the new application, copy folder <code>custom_app</code> to
a new folder named <code>new_app</code> in <code>source/</code> directory.
@subsection change_default_network_address_and_channel Change default network
@page change_default_network_address_and_channel Change default network
address and channel
To form a network, all nodes must share the same network address and
Expand Down Expand Up @@ -88,7 +110,7 @@ constants <code> NETWORK_ADDRESS</code> and <code>NETWORK_CHANNEL</code>,
CFLAGS += -DNETWORK_CHANNEL=$(default_network_channel)
@endcode
@subsection change_of_app_area_id Change of app_area_id
@page change_of_app_area_id Change of app_area_id
It is mandatory to have unique @ref app_specific_area_id "app_area_id" in order
to update specific application independently on other applications. Thus,
Expand All @@ -100,7 +122,7 @@ new arbitrary area id specific for this application:
app_specific_area_id=0x8054AA
@endcode
@subsection configuration_of_a_node Configuration of a node
@page configuration_of_a_node Configuration of a node
The \ref app_init "App_Init()" function is the entry point for the application.
It is called by the stack after each boot.
Expand Down Expand Up @@ -175,7 +197,7 @@ app_init "App_Init()" after the update.
More general information about node configuration can be found in @ref relmat4
"[4]".
@section build_application Build application
@page build_application Build application
Building is done in root of the SDK file structure. It is done by calling the
<code> @ref makefile "makefile"</code>. There can be many options for building but
Expand All @@ -192,7 +214,7 @@ For detailed information on build process, see @ref build "here".
@note Many times the application must be built on custom hardware, not yet
having board definition. See documentation @ref define_custom_board "here".
@section test_application Test application
@page test_application Test application
To practically test the application, a minimum of two boards is needed. One of
them must be configured as a @ref APP_LIB_SETTINGS_ROLE_SINK "sink" and the
Expand All @@ -208,7 +230,7 @@ is assumed that it is not the case.
To program the sink, application <code>@ref dualmcu_app/app.c "dualmcu_app"
</code> can be flashed and then configured by using Wirepas Terminal.
@section flashing_device Flashing device
@page flashing_device Flashing device
Now when application has been compiled, next step is to program that to the
device. The generated binary is located in following path (based on the <code>
Expand All @@ -223,7 +245,7 @@ build/pca10040/new_app/final_image_new_app.hex
To flash the image to the device, see @ref flashing_guideline "here".
@section using_otap Using OTAP
@page using_otap Using OTAP
When network is established, it is no longer feasible to flash every device.
Instead, OTAP (over-the-air-programming) operation can be used. For a detailed
Expand All @@ -246,7 +268,7 @@ build/pca10040/new_app/new_app.otap
build/pca10040/new_app/new_app_wpc_stack.otap
@endcode
@section define_custom_board Define custom board definition
@page define_custom_board Define custom board definition
Many times application requires custom board definition when application is
intended to be executed on board not defined in existing board definitions.
Expand All @@ -262,7 +284,7 @@ To implement new board, check out the documentation of @ref board_folder
"board definitions" and modify existing board template (according to processor
architecture).
@section app_init Application startup
@page app_init Application startup
The Wirepas Mesh Single-MCU SDK low-level initialization code sets up the
application environment to run C code. The low-level setup is outside the scope
Expand All @@ -287,7 +309,7 @@ The stack is not yet running when <code>App_init()</code> is called.
Depending on the stored settings and stack state, the stack may start right
after returning from <code>App_init()</code>.
@section adding_new_source_files_to_the_application Adding new source files
@page adding_new_source_files_to_the_application Adding new source files
For better code readability and organization, the application can be
split in to multiple source files. Adding a new source file is as simple
Expand All @@ -308,18 +330,25 @@ paths to check for header files. Any additional folders can be added to
the <code>@ref source_makefile_includes "INCLUDES"</code> variable in the
application <code>@ref source_makefile "makefile"</code>.
@section recommendations Recommendations
@page recommendations Recommendations
This chapter contains various recommendations and best practices to use
with application development.
@subsection security_for_scratchpad_images Security for scratchpad images
This page contains following sections:
- @subpage security_for_scratchpad_images
- @subpage optimization_of_network_throughput
- @subpage free_resources
- @subpage power_consumption
- @subpage persistent_memory
@page security_for_scratchpad_images Security for scratchpad images
All released SDK have the same default scratchpad encryption keys (known by all
users), so these keys cannot be considered secure. Therefore, it is recommended
to change them. See documentation @ref config_mk_ini_file "here".
@subsection optimization_of_network_throughput Optimization of throughput
@page optimization_of_network_throughput Optimization of throughput
The throughput of a Wirepas Connectivity network is expressed in packet
per seconds. To optimize this throughput, it is important to fill the
Expand All @@ -329,7 +358,7 @@ It is even more important when operating in time-slotted mode. The network
will handle the same number of packets independently of its payload
size.
@subsection free_resources Free resources
@page free_resources Free resources
All hardware resources that are not used by the Wirepas Connectivity
stack can be used freely by the application.
Expand All @@ -341,7 +370,7 @@ For example, unused GPIOs must be properly configured by the
application, to avoid unnecessary power consumption due to pull-up or
pull-down resistors.
@subsection power_consumption Power consumption
@page power_consumption Power consumption
The Wirepas Connectivity stack will try to enter the deepest possible
sleep state of the platform, to optimize power consumption.
Expand All @@ -353,14 +382,19 @@ the stack to prevent entering the deep sleep state.
Please see the \ref app_lib_system_disable_deep_sleep
"lib_system->disableDeepSleep()" function in the \ref system.h "System library".
@subsection persistent_memory How to store data in persistent memory
@page persistent_memory How to store data in persistent memory
It is often necessary to store data from an application to persistent memory
in order to still have access to it across reboots of the node.
The different methods to achieve it and their pros and cons are described in this
section.
@subsubsection storage_library Using storage library
This page contains following sections:
- @subpage storage_library
- @subpage platform_specific_storage
- @subpage dedicated_area
@page storage_library Using storage library
Wirepas Mesh Stack uses reserved areas for its own usage in internal flash.
To avoid reserving too much flash, this area is kept as small as possible.
Expand All @@ -379,7 +413,7 @@ handle.
-# It cannot be pre-flashed before first execution
-# Application must manage validity of the content (with magic number for example)
@subsubsection platform_specific_storage Using platform specific storage
@page platform_specific_storage Using platform specific storage
Most of the platforms supported by Wirepas have their own specific persistent area to
store persistent data.
Expand All @@ -401,7 +435,7 @@ For NRF52 users, Wirepas developed a wrapper to use it. You can find it @ref per
@note It is done with the Wirepas wrapper for NRF52.
@subsubsection dedicated_area Using a dedicated area in flash
@page dedicated_area Using a dedicated area in flash
The internal flash is partitioned in multiple areas. Some of these areas are used for Wirepas usage
like the bootloader or the firmware that cannot be moved.
Expand Down
Loading

0 comments on commit 1ed873f

Please sign in to comment.