Skip to content

Commit

Permalink
Anjay-freertos-client 23.09
Browse files Browse the repository at this point in the history
Features
- (commercial feature) Added support Anjay Core Persistence
- (commercial feature) Added support for SIM Bootstrap for STM32L496G-DISCOVERY with BG96 project
- Added persistence support of Security object, Server object and Attribute
  Storage, controllable through shell
- B-U585I-IOT02A and B-L462E-CELL1 targets now use external flash as storage for
  runtime configuration instead of EEPROM
- MONARCH project removed due to suspended X-Cube-Cellular support
- Added TCP support, both for management connection and CoAP+TCP FOTA downloads
- Added the Current Time resource in the Device object, and implemented real time synchronization using the cellular modem features

Improvements
- Updated X-Cube-Cellular to version 7.1.0
- Updated Mbed TLS to version 3.4.1 and enabled DTLS Connection ID support
- Enabled LwM2M 1.1 by default
- Introduced various flash footprint optimizations
- Added support for the User Button on B-U585I-IOT02A

Bugfixes
- Fixed B-U585I-IOT02A + BG96 demo app freezing in Release mode
  • Loading branch information
Kucmasz committed Sep 7, 2023
1 parent 205c2d0 commit b27a42c
Show file tree
Hide file tree
Showing 158 changed files with 18,514 additions and 14,478 deletions.
79 changes: 75 additions & 4 deletions Application/Inc/anjay/anjay_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
/**
* Enable support for features new to LwM2M protocol version 1.1.
*/
/* #undef ANJAY_WITH_LWM2M11 */
#define ANJAY_WITH_LWM2M11

/**
* Enable support for OSCORE-based security for LwM2M connections.
Expand Down Expand Up @@ -258,15 +258,22 @@
* (<c>anjay_new_from_core_persistence()</c> and
* <c>anjay_delete_with_core_persistence()</c> APIs).
*
* Requires <c>ANJAY_WITH_OBSERVE</c> to be enabled, and
* <c>AVS_COMMONS_WITH_AVS_PERSISTENCE</c> to be enabled in avs_commons
* Requires <c>ANJAY_WITH_OBSERVE</c> to be enabled,
* <c>AVS_COMMONS_WITH_AVS_PERSISTENCE</c> to be enabled in avs_commons, and
* <c>WITH_AVS_COAP_OBSERVE_PERSISTENCE</c> to be enabled in avs_coap
* configuration.
*
* IMPORTANT: Only available as a commercial feature. Ignored in the open
* source version.
*/
/* #undef ANJAY_WITH_CORE_PERSISTENCE */

/**
* Disable automatic closing of server connection sockets after
* MAX_TRANSMIT_WAIT of inactivity.
*/
/* #undef ANJAY_WITHOUT_QUEUE_MODE_AUTOCLOSE */

/**
* Enable support for CoAP Content-Format numerical values 1541-1544 that have
* been used before final LwM2M TS 1.0.
Expand Down Expand Up @@ -511,6 +518,12 @@
*/
#define ANJAY_WITH_MODULE_FW_UPDATE

/**
* Enable advanced_fw_update module (implementation of the 33629 custom
* Advanced Firmware Update object).
*/
/* #undef ANJAY_WITH_MODULE_ADVANCED_FW_UPDATE */

/**
* Disable support for PUSH mode Firmware Update.
*
Expand Down Expand Up @@ -556,11 +569,69 @@
* <c>AVS_COMMONS_WITH_AVS_PERSISTENCE</c> to be enabled in avs_commons
* configuration.
*
* IMPORTANT: Only available with the boostrapper feature. Ignored in the open
* IMPORTANT: Only available with the bootstrapper feature. Ignored in the open
* source version.
*/
/* #undef ANJAY_WITH_MODULE_BOOTSTRAPPER */

/**
* Enable the SIM bootstrap module, which enables reading the SIM bootstrap
* information from a smartcard, which can then be passed through to the
* bootstrapper module.
*
* Requires <c>ANJAY_WITH_MODULE_BOOTSTRAPPER</c> to be enabled.
*
* IMPORTANT: Only available with the bootstrapper feature. Ignored in the open
* source version.
*/
/* #undef ANJAY_WITH_MODULE_SIM_BOOTSTRAP */

/**
* Forced ID of the file to read the SIM bootstrap information from.
*
* If not defined (default), the bootstrap information file will be discovered
* through the ODF file, as mandated by the specification.
*
* Requires <c>ANJAY_WITH_MODULE_BOOTSTRAPPER</c> to be enabled. At most one of
* <c>ANJAY_MODULE_SIM_BOOTSTRAP_HARDCODED_FILE_ID</c> and
* <c>ANJAY_MODULE_SIM_BOOTSTRAP_DATA_OID_OVERRIDE_HEX</c> may be defined at the
* same time.
*
* IMPORTANT: Only available with the bootstrapper feature. Ignored in the open
* source version.
*/
/* #undef ANJAY_MODULE_SIM_BOOTSTRAP_HARDCODED_FILE_ID */

/**
* Overridden OID of the SIM bootstrap information to look for in the DODF file,
* expressed as a hexlified DER representation (without the header).
*
* This is the hexlified expected value of the 'id' field within the 'OidDO'
* sequence in the DODF file (please refer to the PKCS #15 document for more
* information).
*
* If not defined, the default value of <c>"672b0901"</c>, which corresponds to
* OID 2.23.43.9.1 {joint-iso-itu-t(2) international-organizations(23) wap(43)
* oma-lwm2m(9) lwm2m-bootstrap(1)}, will be used.
*
* No other values than the default are valid according to the specification,
* but some SIM cards are known to use other non-standard values, e.g.
* <c>"0604672b0901"</c> - including a superfluous nested BER-TLV header, as
* erroneously illustrated in the EF(DODF-bootstrap) file coding example in
* LwM2M TS 1.2 and earlier (fixed in LwM2M TS 1.2.1) - which is interpreted as
* OID 0.6.4.103.43.9.1 (note that it is invalid as the 0.6 tree does not exist
* in the repository as of writing this note).
*
* Requires <c>ANJAY_WITH_MODULE_BOOTSTRAPPER</c> to be enabled. At most one of
* <c>ANJAY_MODULE_SIM_BOOTSTRAP_HARDCODED_FILE_ID</c> and
* <c>ANJAY_MODULE_SIM_BOOTSTRAP_DATA_OID_OVERRIDE_HEX</c> may be defined at the
* same time.
*
* IMPORTANT: Only available with the bootstrapper feature. Ignored in the open
* source version.
*/
/* #undef ANJAY_MODULE_SIM_BOOTSTRAP_DATA_OID_OVERRIDE_HEX */

/**
* Enable factory provisioning module. Data provided during provisioning uses
* SenML CBOR format.
Expand Down
2 changes: 2 additions & 0 deletions Application/Inc/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@

void application_init();

int avs_time_stm32_sync_time(void);

#endif // APPLICATION_H
2 changes: 1 addition & 1 deletion Application/Inc/avsystem/coap/avs_coap_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
* NOTE: Enabling at least one transport is necessary for the library to be
* useful.
*/
/* #undef WITH_AVS_COAP_TCP */
#define WITH_AVS_COAP_TCP

/**
* Enable support for OSCORE (RFC 8613).
Expand Down
19 changes: 17 additions & 2 deletions Application/Inc/avsystem/commons/avs_commons_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,8 @@
* #endif
* </code>
*/
/* #undef AVS_COMMONS_WITH_EXTERNAL_LOG_LEVELS_HEADER */
#define AVS_COMMONS_WITH_EXTERNAL_LOG_LEVELS_HEADER \
"avsystem/commons/avs_log_levels.h"

/**
* Disable log level check in runtime. Allows to save at least 1.3kB of memory.
Expand All @@ -608,7 +609,7 @@
* will not be available.
*
*/
/* #undef AVS_COMMONS_WITHOUT_LOG_CHECK_IN_RUNTIME */
#define AVS_COMMONS_WITHOUT_LOG_CHECK_IN_RUNTIME
/**@}*/

/**
Expand Down Expand Up @@ -726,6 +727,20 @@
*/
/* #undef AVS_COMMONS_NET_POSIX_AVS_SOCKET_HAVE_IN6_IS_ADDR_V4MAPPED */

/**
* Should be defined if IPv4-mapped IPv6 addresses (<c>::ffff:0.0.0.0/32</c>)
* are <strong>NOT</strong> supported by the underlying platform.
*
* Enabling this flag will prevent avs_net from using IPv4-mapped IPv6 addresses
* and instead re-open and re-bind the socket if a connection to an IPv4 address
* is requested on a previously created IPv6 socket.
*
* This may result in otherwise redundant <c>socket()</c>, <c>bind()</c> and
* <c>close()</c> system calls to be performed, but may be necessary for
* interoperability with some platforms.
*/
/* #undef AVS_COMMONS_NET_POSIX_AVS_SOCKET_WITHOUT_IN6_V4MAPPED_SUPPORT */

/**
* Is the <c>inet_ntop()</c> function available?
*
Expand Down
51 changes: 51 additions & 0 deletions Application/Inc/avsystem/commons/avs_log_levels.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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.
*/

#ifndef AVS_COMMONS_EXTERNAL_LOG_LEVELS_H
#define AVS_COMMONS_EXTERNAL_LOG_LEVELS_H

// global log level value
#define AVS_LOG_LEVEL_DEFAULT INFO

#ifdef __GNUC__

// HACK: Replace path to whole file with just the filename to save up on flash
// usage.
// Older versions of STM32CubeIDE (e.g. 1.7.0) provide __FILENAME__ definition.
// It was later replaced by __FILE_NAME__ which appeared in upstream gcc for
// compability with clang.
//
// Both definitions are not standard.

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wbuiltin-macro-redefined"

#if defined(__FILE_NAME__)
#undef __FILE__
#define __FILE__ __FILE_NAME__
#elif defined(__FILENAME__)
#undef __FILE__
#define __FILE__ __FILENAME__
#else
#pragma GCC warning \
"Both __FILE_NAME__ and __FILENAME__ macros are not available. Logs will include full file paths, which may affect the size of the application binary depending on where the project is located."
#endif // defined(__FILE_NAME__)

#pragma GCC diagnostic pop

#endif // __GNUC__

#endif
11 changes: 5 additions & 6 deletions Application/Inc/config_persistence.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
#ifndef CONFIG_PERSISTENCE_H
#define CONFIG_PERSISTENCE_H

#include "cellular_service_datacache.h"
#include <avsystem/commons/avs_stream_md5.h>

#define MAGIC "cfgstart3"
#define MAGIC_SIZE sizeof(MAGIC)
#define MAGIC_BASE_ADDR 0
#define CONFIG_BASE_ADDR (MAGIC_BASE_ADDR + MAGIC_SIZE)
#define CONFIG_BLOCK_ADDR 0
#include "cellular_service_datacache.h"

#define APN_SIZE sizeof(((dc_sim_slot_t *) 0)->apn)
#define APN_USERNAME_SIZE sizeof(((dc_sim_slot_t *) 0)->username)
Expand All @@ -40,6 +36,9 @@ typedef struct {
char firmware_version[32];
char bootstrap[2];
char security[5];
char use_persistence[2];
char sim_bs_data_md5[AVS_COMMONS_MD5_LENGTH];
char use_sim_bootstrap[2];
} config_t;

int config_save(const config_t *in_config);
Expand Down
15 changes: 14 additions & 1 deletion Application/Inc/default_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,20 @@
#define DEFAULT_APN "internet"
#define DEFAULT_APN_USERNAME "internet"
#define DEFAULT_APN_PASSWORD "internet"
#define FIRMWARE_VERSION "23.02"
#define DEFAULT_USE_PERSISTENCE "0"
#ifdef USE_SIM_BOOTSTRAP
#define DEFAULT_USE_SIM_BOOTSTRAP "y"
#else // USE_SIM_BOOTSTRAP
#define DEFAULT_USE_SIM_BOOTSTRAP "n"
#endif // USE_SIM_BOOTSTRAP
#define FIRMWARE_VERSION "23.09"
#define MD5_OF_ZERO_BYTES_INITIALIZER \
{ \
0xD4, 0x1D, 0x8C, 0xD9, 0x8F, 0x00, 0xB2, 0x04, 0xE9, 0x80, 0x09, \
0x98, 0xEC, 0xF8, 0x42, 0x7E \
}
#define MD5_OF_ZERO_BYTES \
((const char[AVS_COMMONS_MD5_LENGTH]) MD5_OF_ZERO_BYTES_INITIALIZER)

void generate_default_endpoint_name(char *endpoint_name, size_t len);

Expand Down
1 change: 1 addition & 0 deletions Application/Inc/lwm2m.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ void lwm2m_init(void);

void lwm2m_start(void);


#endif // LWM2M_H
Loading

0 comments on commit b27a42c

Please sign in to comment.