Skip to content

Commit 425fd14

Browse files
author
Bot
committed
Update SDK
1 parent 2248baa commit 425fd14

File tree

464 files changed

+201428
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

464 files changed

+201428
-14
lines changed

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#exclude licensed wirepas binaries
2+
image/*
3+
4+
#but include the README still
5+
!image/readme.md
6+
7+
#exclude license acceptance
8+
.license_accepted
9+
10+
#do not commit the build outputs
11+
build/
12+
13+
#don't commit sensitive bootoader keys
14+
custom_bootloader_keys.ini
15+
16+
*.pyc

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "projects/doxygen/doxygen-awesome-css"]
2+
path = projects/doxygen/doxygen-awesome-css
3+
url = https://github.com/jothepro/doxygen-awesome-css.git

Readme.md

Lines changed: 77 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,92 @@
11
# Wirepas SDK for 5G
22

3-
<img src="WCS-Icons-5gmesh.png" alt="drawing" width="200"/>
3+
This repository contains Wirepas SDK, which allows the development of an application
4+
to be executed on the same chip as Wirepas Stack.
5+
This application is often referred as a _Single-MCU application_.
6+
7+
8+
> :warning:
9+
>
10+
> _To use the SDK, you need to have access to the Wirepas binaries. You need to have a
11+
> software license agreement (SLA) with Wirepas to get them. If you would like to become
12+
> a SLA licensee, please see the right contact from www.wirepas.com/contact_
13+
>
14+
15+
- [Overview](#overview)
16+
- [Documentation](#documentation)
17+
- [Wirepas binaries](#wirepas-binaries)
18+
- [Environment](#environment)
19+
- [How to build an application](#how-to-build-an-application)
20+
- [License](#license)
421

522

623
## Overview
724

8-
This repository hosts the __Wirepas SDK for 5G profiles__. It allows the development of an application
9-
to be executed on the same chip as Wirepas Stack.
10-
This application is often referred as a _Single-MCU application_.
25+
The following diagram, describes the main components of the SDK.
26+
27+
![Main components][here_main_components]
28+
29+
30+
## Documentation
31+
32+
The documentation for this SDK is written with Doxygen and generated in HTML format.
33+
34+
It is hosted [here](https://wirepas.github.io/wm-sdk-5g/).
35+
You can select the desired version depending on the SDK version you are working on.
36+
37+
Some information is available on this page too, but it is just a subset of what the html documentation
38+
contains.
1139

12-
__To use this SDK, you need to have access to the Wirepas binaries. You need to have a
13-
software license agreement (SLA) with Wirepas to get them. If you would like to become
14-
a SLA licensee, please see the right contact from www.wirepas.com/contact__
40+
## Wirepas binaries
1541

42+
As a Wirepas SLA licensee, you should have received access to protected zipped archive containing the Wirepas binaries.
43+
Please extract them at the root of [image folder][here_image] (All the *.a, *.hex and *.conf files must be at the root of this folder).
1644

17-
## Version selection
45+
## Environment
1846

19-
To start using the sdk, please select the desired release.
47+
This SDK relies on GNU Arm toolchain. To use the SDK you will need to fulfill the following requirements:
2048

21-
They are listed on the [release page](https://github.com/wirepas/wm-sdk-5g/releases).
49+
1. A GCC Arm toolchain (_version 10.3.1 is recommended_)
50+
2. The make tool
51+
3. python 3.x
52+
4. pycryptodome package for python (_can be installed with pip_)
2253

23-
Each realease has a tag with following format vx.x.x (Ex: v1.0.0).
54+
In order to validate that your environment is correctly configured, you should be able to build the custom_app application.
2455

25-
You can switch to a given release with its tag:
56+
For more information, please refer to [Documentation](#documentation)
2657

27-
```shell
28-
git checkout vx.x.x
58+
## How to build an application
59+
60+
This SDK supports multiple target boards. All of them are listed under [board folder][here_board] and can be selected with target_board=<target_board>
61+
62+
This SDK contains multiple application examples that can be found under [source folder][here_source] and can be selected with app_name=<app_name>
63+
64+
> :warning:
65+
>
66+
> The first time you'll build an application, you'll be prompted to choose bootloader keys.
67+
> Once chosen the first time, they will be used for all your images and must be kept secret
68+
> and in a safe place where they will not be lost or deleted. It is also possible to define
69+
> keys per application.
70+
71+
To build the _custom_app_ application for a given board, please execute following command.
72+
73+
```shell
74+
make app_name=custom_app target_board=<board_name>
2975
```
76+
77+
You can customize verbosity of the log with the option V=value. Value can be 0 (default), 1 for more build info and 2 for even more build info.
78+
79+
After execution of this command, you should find the _final_image_custom_app.hex_ under _build/<board_name>/custom_app_ folder.
80+
81+
For more information, please refer to [Documentation](#documentation)
82+
83+
## License
84+
85+
See [LICENSE][here_license] for full license details.
86+
87+
[here_license]: LICENSE.txt
88+
[here_main_components]: projects/doxygen/media/main_components.png
89+
[here_board]: board/
90+
[here_source]: source/
91+
[here_image]: image/
92+

WCS-Icons-5gmesh.png

-5.66 KB
Binary file not shown.

api/wms_app.h

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
/* Copyright 2017 Wirepas Ltd. All Rights Reserved.
2+
*
3+
* See file LICENSE.txt for full license details.
4+
*
5+
*/
6+
7+
/**
8+
* \file wms_app.h
9+
*
10+
* The global macros, types and functions available to applications can be found
11+
* in the wms_app.h header.
12+
*/
13+
#ifndef APP_H_
14+
#define APP_H_
15+
16+
#include <stdlib.h>
17+
#include <stdint.h>
18+
19+
/* TODO: Move to a separate header */
20+
#define __STATIC_INLINE static inline
21+
22+
/**
23+
* Global application API version. This is incremented if the global function
24+
* table format changes in an incompatible way. The value of this macro is
25+
* placed in the application header, so that the stack can detect and handle the
26+
* situation.
27+
*/
28+
#define APP_API_VERSION 0x200
29+
30+
/** Magic 16-byte string for locating a v2 application in Flash */
31+
#define APP_V2_TAG ("APP2\171\306\073\165" \
32+
"\263\303\334\322\035\266\006\115")
33+
34+
/** Length of \ref APP_V2_TAG, in bytes */
35+
#define APP_V2_TAG_LENGTH 16
36+
37+
/** Byte offset of \ref APP_V2_TAG from the start of application memory area */
38+
#define APP_V2_TAG_OFFSET 48
39+
40+
41+
/** Minimum supported application API version, when a tag is present: v2 */
42+
#define APP_V2_TAG_MIN_API_VERSION 0x200
43+
44+
/** Application API version when no tag present: v1 */
45+
#define APP_API_V1_VERSION 0x100
46+
47+
/** Container for \ref APP_V2_TAG, for pointer arithmetic */
48+
typedef union
49+
{
50+
uint8_t bytes[APP_V2_TAG_LENGTH];
51+
uint32_t array[APP_V2_TAG_LENGTH / 4];
52+
} app_v2_tag_t;
53+
54+
/**
55+
* \brief Application information header
56+
*
57+
* If an application is compiled to support application API v2, this header
58+
* can found in the beginning of the application memory area. It is placed
59+
* right after the \ref APP_V2_TAG, which is at \ref APP_V2_TAG_OFFSET.
60+
*/
61+
typedef struct
62+
{
63+
/** Expected API version of application */
64+
uint32_t api_version;
65+
/** Expected start address of application memory area, for sanity checks */
66+
uint32_t start_address;
67+
/** Total number of bytes used in the application memory area */
68+
uint32_t length;
69+
/** First address used in RAM area (was forced to be 0 before) */
70+
uint32_t start_ram_address;
71+
} app_information_header_t;
72+
73+
/**
74+
* Firmware version type, returned from \ref
75+
* app_global_functions_t.getStackFirmwareVersion(). The individual sub-fields
76+
* can be accessed, or the whole 32-bit value can be read all at once, using
77+
* the version field.
78+
*/
79+
typedef union
80+
{
81+
struct
82+
{
83+
/** Firmware development version number component */
84+
uint8_t devel;
85+
/** Firmware maintenance version number component */
86+
uint8_t maint;
87+
/** Firmware minor version number component */
88+
uint8_t minor;
89+
/** Firmware major version number component */
90+
uint8_t major;
91+
};
92+
uint32_t version;
93+
} app_firmware_version_t;
94+
95+
/**
96+
* Get the global API version, which may be greater than the \ref
97+
* APP_API_VERSION macro if the stack firmware is newer than the SDK used to
98+
* compile the application. It is up to the stack firmware to be backward
99+
* compatible with any global API changes, or not run the application at all.
100+
* \return Supported application API version, \ref APP_API_VERSION
101+
*/
102+
typedef uint32_t (*app_get_api_version_f)(void);
103+
104+
/**
105+
* \brief Get stack firmware version
106+
* \return Stack firmware version
107+
*/
108+
typedef app_firmware_version_t (*app_get_stack_firmware_version_f)(void);
109+
110+
/**
111+
* \brief Open a library
112+
*
113+
* This is the most important function of the Single-MCU API. All other
114+
* functions are in libraries, opened using the this function. Parameters are
115+
* the name and version of the library. The name is actually a 32-bit value,
116+
* which is defined in each library header as a macro:
117+
* \c APP_LIB_LIBRARY_NAME. The library version is also a macro defined in the same
118+
* library header: \c APP_LIB_LIBRARY_VERSION.
119+
*
120+
* Example of opening a library:
121+
*
122+
* @code
123+
*
124+
* // The System library
125+
* static const app_lib_system_t * lib_system = NULL;
126+
*
127+
* ...
128+
*
129+
* void App_init(const app_global_functions_t * functions)
130+
* {
131+
* lib_system = functions->openLibrary(APP_LIB_SYSTEM_NAME,
132+
* APP_LIB_SYSTEM_VERSION);
133+
* if (lib_system == NULL)
134+
* {
135+
* // Could not open the System library
136+
* return;
137+
* }
138+
* ...
139+
* }
140+
* @endcode
141+
*
142+
* \param name
143+
* Symbolic name of library, a macro in library header file
144+
* \param version
145+
* Requested library version, a macro in library header file
146+
* \return Pointer to the function table of the library. Each library has its
147+
* own function table. If a NULL is returned, the library could not be
148+
* opened. Either it didn't exist, or the version is too old or new.
149+
* \note There is no corresponding closeLibrary() call. Applications never
150+
* close libraries they open.
151+
*/
152+
typedef const void * (*app_open_library_f)(uint32_t name, uint32_t version);
153+
154+
/**
155+
* \brief List of global functions, passed to \ref App_entrypoint()
156+
*/
157+
typedef struct
158+
{
159+
app_get_api_version_f getApiVersion;
160+
app_get_stack_firmware_version_f getStackFirmwareVersion;
161+
app_open_library_f openLibrary;
162+
} app_global_functions_t;
163+
164+
/**
165+
* \brief Application initial entrypoint
166+
* \param functions
167+
* Pointer to a global function table, \ref app_global_functions_t
168+
* \param reserved1
169+
* Reserved for future use
170+
* \param reserved2
171+
* Reserved for future use
172+
* \param ram_top
173+
* Pointer to a pointer of first free RAM address. The application may
174+
* reduce this value, if it does not need all the RAM provided to it
175+
*/
176+
intptr_t App_entrypoint(const void * functions,
177+
size_t reserved1,
178+
const void ** reserved2,
179+
void ** ram_top);
180+
181+
/** A function to safely call either getApiVersion() or getCurrentRole() */
182+
typedef uint32_t (*get_api_version_compatible_f)(void);
183+
184+
__STATIC_INLINE uint32_t App_getApiVersion(const void * const global_cb)
185+
{
186+
uint32_t version =
187+
((const get_api_version_compatible_f)*(const void **)global_cb)();
188+
if (version < APP_API_V1_VERSION)
189+
{
190+
// Called function was actually the getCurrentRole() function,
191+
// so the firmware only supports the v1 application API
192+
return APP_API_V1_VERSION;
193+
}
194+
return version;
195+
}
196+
197+
/**
198+
* This is the most common return type from library functions. Functions use
199+
* these return values, unless more specific return values are required.
200+
*/
201+
typedef enum
202+
{
203+
/** Everything is OK */
204+
APP_RES_OK = 0,
205+
/** Error: Other or internal error */
206+
APP_RES_UNSPECIFIED_ERROR = 1,
207+
/** Error: Feature is not implemented */
208+
APP_RES_NOT_IMPLEMENTED = 2,
209+
/** Error: One or more parameter value is invalid */
210+
APP_RES_INVALID_VALUE = 3,
211+
/** Error: One or more required pointer parameter is NULL */
212+
APP_RES_INVALID_NULL_POINTER = 4,
213+
/** Error: Current configuration does not support the requested operation */
214+
APP_RES_INVALID_CONFIGURATION = 5,
215+
/** Error: Requested resource is not available */
216+
APP_RES_RESOURCE_UNAVAILABLE = 6,
217+
/** Error: Stack is in invalid state for the requested operation */
218+
APP_RES_INVALID_STACK_STATE = 7,
219+
/** Error: Feature lock bits forbid the requested operation */
220+
APP_RES_ACCESS_DENIED = 8,
221+
} app_res_e;
222+
223+
/**
224+
* Node address. Each node must have a unique address in the network. There are
225+
* special addresses that can be used as destination addresses, see \ref
226+
* app_special_addr_e. For various addressing modes, see @c addressing.
227+
*/
228+
typedef uint32_t app_addr_t;
229+
230+
/**
231+
* \brief Special destination addresses for sending packets
232+
*/
233+
typedef enum
234+
{
235+
/** Send packet to the best available sink */
236+
APP_ADDR_ANYSINK = 0xfffffffeu,
237+
/**
238+
* @brief Send packet as broadcast to all nodes
239+
*
240+
* @note When transmitting from a sink, note that a broadcast will only be
241+
* transmitted to the nodes directly under the sink's routing tree.
242+
* To reach all nodes on the network, it is necessary to send the
243+
* broadcast from all sinks.
244+
*/
245+
APP_ADDR_BROADCAST = 0xffffffffu,
246+
/**
247+
* This is a bitmask that should be ORed with group address to send data
248+
* packet to the multicast group. For example: 0x80000002 address sends
249+
* packet to the multicast group #2.
250+
*/
251+
APP_ADDR_MULTICAST = 0x80000000u,
252+
/** This is last valid multicast address. Addresses larger than this (until
253+
* @ref APP_ADDR_ANYSINK) are unicast addresses. */
254+
APP_ADDR_MULTICAST_LAST = 0x80ffffffu,
255+
} app_special_addr_e;
256+
257+
#endif /* APP_H_ */

0 commit comments

Comments
 (0)