diff options
author | Archit Aggarwal <architag@amazon.com> | 2020-11-09 15:07:19 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-09 15:07:19 -0800 |
commit | 21878bd6196a574720df21983cf8abbcefbc6335 (patch) | |
tree | 25ee84cafac13bba0dd900e3713d4d30536a01c5 | |
parent | 596b466300c2423686e9d3e96655f7e2eab60bcd (diff) | |
download | freertos-git-21878bd6196a574720df21983cf8abbcefbc6335.tar.gz |
Allow overriding default definitions of logging macros (#384)
* Update logging_stack.h file to avoid use of __FUNCTION__ macro
* Revert to use __FUNCTION__ instead of __FILE__
* Fix comment about metadata format
* Fix incorrect mapping of SdkLog function
* Fix typo causing LOG_METADATA_ARGS to be undefined
* Fix another bug with SdkLog macro definition
* Fix formatting
* Move mapping of SdkLog to vLoggingPrintf from logging_stack to config files
* Remove dependency of LIBRARY_LOG_NAME on LIBRARY_METADATA_* macros
* Minor improvements
Co-authored-by: Gary Wicker <14828980+gkwicker@users.noreply.github.com>
Co-authored-by: RichardBarry <3073890+RichardBarry@users.noreply.github.com>
25 files changed, 391 insertions, 107 deletions
diff --git a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/core_mqtt_config.h b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/core_mqtt_config.h index 4d4a05ab2..9740e3f03 100644 --- a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/core_mqtt_config.h +++ b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/core_mqtt_config.h @@ -47,6 +47,17 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/demo_config.h b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/demo_config.h index 09d28f919..c0b6ec636 100644 --- a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/demo_config.h +++ b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/demo_config.h @@ -51,11 +51,24 @@ #ifndef LIBRARY_LOG_LEVEL #define LIBRARY_LOG_LEVEL LOG_INFO #endif + +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ #ifndef democonfigCLIENT_IDENTIFIER + /** * @brief The MQTT client identifier used in this example. Each client identifier * must be unique so edit as required to ensure no two clients connecting to the @@ -114,27 +127,27 @@ * #define democonfigROOT_CA_PEM "...insert here..." */ -#define democonfigROOT_CA_PEM \ -"-----BEGIN CERTIFICATE-----\n"\ -"MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\n"\ -"ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n"\ -"b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL\n"\ -"MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv\n"\ -"b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4g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noQdeXeGADbkpy\n" \ + "rqXRfboQnoZsG4q5WTP468SQvvG5\n" \ + "-----END CERTIFICATE-----" /** * @brief Client certificate. diff --git a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/shadow_config.h b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/shadow_config.h index 3f4d88eee..b4ec8ba24 100644 --- a/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/shadow_config.h +++ b/FreeRTOS-Plus/Demo/AWS/Device_Shadow_Windows_Simulator/Device_Shadow_Demo/shadow_config.h @@ -44,6 +44,17 @@ #define LIBRARY_LOG_LEVEL LOG_INFO #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/core_mqtt_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/core_mqtt_config.h index 4d4a05ab2..9740e3f03 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/core_mqtt_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/core_mqtt_config.h @@ -47,6 +47,17 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/demo_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/demo_config.h index 26efec80a..da02216c8 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/demo_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Basic_TLS/demo_config.h @@ -51,6 +51,18 @@ #ifndef LIBRARY_LOG_LEVEL #define LIBRARY_LOG_LEVEL LOG_INFO #endif + +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/core_mqtt_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/core_mqtt_config.h index acd95955d..82d69fc90 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/core_mqtt_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/core_mqtt_config.h @@ -49,6 +49,17 @@ #define LIBRARY_LOG_LEVEL LOG_NONE #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/demo_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/demo_config.h index da8c3f409..c900eccd6 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/demo_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Keep_Alive/demo_config.h @@ -49,6 +49,18 @@ #ifndef LIBRARY_LOG_LEVEL #define LIBRARY_LOG_LEVEL LOG_INFO #endif + +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/core_mqtt_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/core_mqtt_config.h index a076a3313..0f36cd9ed 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/core_mqtt_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/core_mqtt_config.h @@ -49,6 +49,17 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/demo_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/demo_config.h index cc920ea8d..9da7745a0 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/demo_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Multitask/demo_config.h @@ -48,6 +48,18 @@ #ifndef LIBRARY_LOG_LEVEL #define LIBRARY_LOG_LEVEL LOG_INFO #endif + +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/core_mqtt_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/core_mqtt_config.h index 4d4a05ab2..9740e3f03 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/core_mqtt_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/core_mqtt_config.h @@ -47,6 +47,17 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/demo_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/demo_config.h index 969774a91..38f3c01cb 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/demo_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Mutual_Auth/demo_config.h @@ -51,6 +51,18 @@ #ifndef LIBRARY_LOG_LEVEL #define LIBRARY_LOG_LEVEL LOG_INFO #endif + +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/core_mqtt_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/core_mqtt_config.h index acd95955d..82d69fc90 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/core_mqtt_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/core_mqtt_config.h @@ -49,6 +49,17 @@ #define LIBRARY_LOG_LEVEL LOG_NONE #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/demo_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/demo_config.h index da8c3f409..c900eccd6 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/demo_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Plain_Text/demo_config.h @@ -49,6 +49,18 @@ #ifndef LIBRARY_LOG_LEVEL #define LIBRARY_LOG_LEVEL LOG_INFO #endif + +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/core_mqtt_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/core_mqtt_config.h index b2c9107c8..7eea8f4b9 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/core_mqtt_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/core_mqtt_config.h @@ -49,6 +49,17 @@ #define LIBRARY_LOG_LEVEL LOG_INFO #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/demo_config.h b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/demo_config.h index bd3457581..534671e5b 100644 --- a/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/demo_config.h +++ b/FreeRTOS-Plus/Demo/coreMQTT_Windows_Simulator/MQTT_Serializer/demo_config.h @@ -49,6 +49,18 @@ #ifndef LIBRARY_LOG_LEVEL #define LIBRARY_LOG_LEVEL LOG_INFO #endif + +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/core_mqtt_config.h b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/core_mqtt_config.h index 4d4a05ab2..9740e3f03 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/core_mqtt_config.h +++ b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/core_mqtt_config.h @@ -47,6 +47,17 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/core_pkcs11_config.h b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/core_pkcs11_config.h index 851f3eac9..9f44c22f2 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/core_pkcs11_config.h +++ b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/core_pkcs11_config.h @@ -56,6 +56,17 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /** diff --git a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/demo_config.h b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/demo_config.h index 3f0ba4582..08cc74c0c 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/demo_config.h +++ b/FreeRTOS-Plus/Demo/corePKCS11_MQTT_Mutual_Auth_Windows_Simulator/demo_config.h @@ -51,6 +51,18 @@ #ifndef LIBRARY_LOG_LEVEL #define LIBRARY_LOG_LEVEL LOG_INFO #endif + +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/core_pkcs11_config.h b/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/core_pkcs11_config.h index 449d5ca78..5b98ee4e7 100644 --- a/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/core_pkcs11_config.h +++ b/FreeRTOS-Plus/Demo/corePKCS11_Windows_Simulator/core_pkcs11_config.h @@ -56,43 +56,54 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /** * @brief Malloc API used by core_pkcs11.h */ -#define PKCS11_MALLOC pvPortMalloc +#define PKCS11_MALLOC pvPortMalloc /** * @brief Free API used by core_pkcs11.h */ -#define PKCS11_FREE vPortFree +#define PKCS11_FREE vPortFree /** -* @brief PKCS #11 default user PIN. -* -* The PKCS #11 standard specifies the presence of a user PIN. That feature is -* sensible for applications that have an interactive user interface and memory -* protections. However, since typical microcontroller applications lack one or -* both of those, the user PIN is assumed to be used herein for interoperability -* purposes only, and not as a security feature. -* + * @brief PKCS #11 default user PIN. + * + * The PKCS #11 standard specifies the presence of a user PIN. That feature is + * sensible for applications that have an interactive user interface and memory + * protections. However, since typical microcontroller applications lack one or + * both of those, the user PIN is assumed to be used herein for interoperability + * purposes only, and not as a security feature. + * * Note: Do not cast this to a pointer! The library calls sizeof to get the length * of this string. -*/ -#define configPKCS11_DEFAULT_USER_PIN "0000" + */ +#define configPKCS11_DEFAULT_USER_PIN "0000" /** -* @brief Maximum length (in characters) for a PKCS #11 CKA_LABEL -* attribute. -*/ -#define pkcs11configMAX_LABEL_LENGTH 32 + * @brief Maximum length (in characters) for a PKCS #11 CKA_LABEL + * attribute. + */ +#define pkcs11configMAX_LABEL_LENGTH 32 /** -* @brief Maximum number of token objects that can be stored -* by the PKCS #11 module. -*/ -#define pkcs11configMAX_NUM_OBJECTS 6 + * @brief Maximum number of token objects that can be stored + * by the PKCS #11 module. + */ +#define pkcs11configMAX_NUM_OBJECTS 6 /** * @brief Maximum number of sessions that can be stored @@ -101,73 +112,73 @@ #define pkcs11configMAX_SESSIONS 10 /** -* @brief Set to 1 if a PAL destroy object is implemented. -* -* If set to 0, no PAL destroy object is implemented, and this functionality -* is implemented in the common PKCS #11 layer. -*/ + * @brief Set to 1 if a PAL destroy object is implemented. + * + * If set to 0, no PAL destroy object is implemented, and this functionality + * is implemented in the common PKCS #11 layer. + */ #define pkcs11configPAL_DESTROY_SUPPORTED 0 /** -* @brief Set to 1 if OTA image verification via PKCS #11 module is supported. -* -* If set to 0, OTA code signing certificate is built in via -* aws_ota_codesigner_certificate.h. -*/ + * @brief Set to 1 if OTA image verification via PKCS #11 module is supported. + * + * If set to 0, OTA code signing certificate is built in via + * aws_ota_codesigner_certificate.h. + */ #define pkcs11configOTA_SUPPORTED 0 /** -* @brief Set to 1 if PAL supports storage for JITP certificate, -* code verify certificate, and trusted server root certificate. -* -* If set to 0, PAL does not support storage mechanism for these, and -* they are accessed via headers compiled into the code. -*/ + * @brief Set to 1 if PAL supports storage for JITP certificate, + * code verify certificate, and trusted server root certificate. + * + * If set to 0, PAL does not support storage mechanism for these, and + * they are accessed via headers compiled into the code. + */ #define pkcs11configJITP_CODEVERIFY_ROOT_CERT_SUPPORTED 0 /** -* @brief The PKCS #11 label for device private key. -* -* Private key for connection to AWS IoT endpoint. The corresponding -* public key should be registered with the AWS IoT endpoint. -*/ + * @brief The PKCS #11 label for device private key. + * + * Private key for connection to AWS IoT endpoint. The corresponding + * public key should be registered with the AWS IoT endpoint. + */ #define pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS "Device Priv TLS Key" /** -* @brief The PKCS #11 label for device public key. -* -* The public key corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS. -*/ + * @brief The PKCS #11 label for device public key. + * + * The public key corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS. + */ #define pkcs11configLABEL_DEVICE_PUBLIC_KEY_FOR_TLS "Device Pub TLS Key" /** -* @brief The PKCS #11 label for the device certificate. -* -* Device certificate corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS. -*/ + * @brief The PKCS #11 label for the device certificate. + * + * Device certificate corresponding to pkcs11configLABEL_DEVICE_PRIVATE_KEY_FOR_TLS. + */ #define pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS "Device Cert" /** -* @brief The PKCS #11 label for the object to be used for code verification. -* -* Used by over-the-air update code to verify an incoming signed image. -*/ + * @brief The PKCS #11 label for the object to be used for code verification. + * + * Used by over-the-air update code to verify an incoming signed image. + */ #define pkcs11configLABEL_CODE_VERIFICATION_KEY "Code Verify Key" /** -* @brief The PKCS #11 label for Just-In-Time-Provisioning. -* -* The certificate corresponding to the issuer of the device certificate -* (pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS) when using the JITR or -* JITP flow. -*/ + * @brief The PKCS #11 label for Just-In-Time-Provisioning. + * + * The certificate corresponding to the issuer of the device certificate + * (pkcs11configLABEL_DEVICE_CERTIFICATE_FOR_TLS) when using the JITR or + * JITP flow. + */ #define pkcs11configLABEL_JITP_CERTIFICATE "JITP Cert" /** -* @brief The PKCS #11 label for the AWS Trusted Root Certificate. -* -* @see aws_default_root_certificates.h -*/ + * @brief The PKCS #11 label for the AWS Trusted Root Certificate. + * + * @see aws_default_root_certificates.h + */ #define pkcs11configLABEL_ROOT_CERTIFICATE "Root Cert" #endif /* _CORE_PKCS11_CONFIG_H_ */ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.h index a690bc429..9404fb827 100644 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.h +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/sockets_wrapper.h @@ -53,6 +53,17 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.h index 1b7c52ab0..37bb450ec 100644 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.h +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls/using_mbedtls.h @@ -48,6 +48,17 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h index 019aeed5a..ac1738aad 100644 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_mbedtls_pkcs11/using_mbedtls_pkcs11.h @@ -51,6 +51,17 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.h b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.h index 4ce4ec08a..f2bd4ee50 100644 --- a/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.h +++ b/FreeRTOS-Plus/Source/Application-Protocols/network_transport/freertos_plus_tcp/using_plaintext/using_plaintext.h @@ -43,6 +43,17 @@ #define LIBRARY_LOG_LEVEL LOG_ERROR #endif +/* Prototype for the function used to print to console on Windows simulator + * of FreeRTOS. + * The function prints to the console before the network is connected; + * then a UDP port after the network has connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); + +/* Map the SdkLog macro to the logging function to enable logging + * on Windows simulator. */ +#define SdkLog( message ) vLoggingPrintf message + #include "logging_stack.h" /************ End of logging configuration ****************/ diff --git a/FreeRTOS-Plus/Source/Utilities/logging/logging_levels.h b/FreeRTOS-Plus/Source/Utilities/logging/logging_levels.h index 112262ff0..d52d0a34d 100644 --- a/FreeRTOS-Plus/Source/Utilities/logging/logging_levels.h +++ b/FreeRTOS-Plus/Source/Utilities/logging/logging_levels.h @@ -27,11 +27,11 @@ /** * @file logging_levels.h - * @brief Defines the logging level macros. + * @brief Defines the configuration constants for all logging verbosity levels. */ -#ifndef LOGGING_LEVELS_H_ -#define LOGGING_LEVELS_H_ +#ifndef LOGGING_LEVELS_H +#define LOGGING_LEVELS_H /** * @constantspage{logging,logging library} @@ -111,4 +111,4 @@ */ #define LOG_DEBUG 4 -#endif /* ifndef LOGGING_LEVELS_H_ */ +#endif /* ifndef LOGGING_LEVELS_H */ diff --git a/FreeRTOS-Plus/Source/Utilities/logging/logging_stack.h b/FreeRTOS-Plus/Source/Utilities/logging/logging_stack.h index bb5d70216..3172d473d 100644 --- a/FreeRTOS-Plus/Source/Utilities/logging/logging_stack.h +++ b/FreeRTOS-Plus/Source/Utilities/logging/logging_stack.h @@ -27,35 +27,59 @@ /** * @file logging_stack.h - * @brief Reference implementation of Logging stack as a header-only library. + * @brief Utility header file that exposes macros for configuring logging implementation of logging macros (LogError, LogWarn, LogInfo, LogDebug). */ -#ifndef LOGGING_STACK_H_ -#define LOGGING_STACK_H_ +#ifndef LOGGING_STACK_H +#define LOGGING_STACK_H /* Include header for logging level macros. */ #include "logging_levels.h" /* Standard Include. */ +#include <stdio.h> #include <stdint.h> +/** + * @brief The name of the library or demo to add as metadata in log messages + * from the library or demo. + * + * This metadata aids in identifying the module source of log messages. + * The metadata is logged in the format `[ <LIBRARY-NAME> ]` as a prefix to the + * log messages. + * Refer to #LOG_METADATA_FORMAT for the complete format of the metadata prefix in + * log messages. + */ +/* Check if LIBRARY_LOG_NAME macro has been defined. */ +#if !defined( LIBRARY_LOG_NAME ) + #error "Please define LIBRARY_LOG_NAME for the library." +#endif + /* Metadata information to prepend to every log message. */ -#define LOG_METADATA_FORMAT "[%s:%d] " -#define LOG_METADATA_ARGS __FUNCTION__, __LINE__ - -/* Common macro for all logging interface macros. */ -#if !defined( DISABLE_LOGGING ) - -/* Prototype for the function used to print out. In this case it prints to the - * console before the network is connected then a UDP port after the network has - * connected. */ - extern void vLoggingPrintf( const char * pcFormatString, - ... ); - #define SdkLog( string ) vLoggingPrintf string -#else +#ifndef LOG_METADATA_FORMAT + #define LOG_METADATA_FORMAT "[%s:%d] " /**< @brief Format of metadata prefix in log messages. */ +#endif + +#ifndef LOG_METADATA_ARGS + #define LOG_METADATA_ARGS __FUNCTION__, __LINE__ /**< @brief Arguments into the metadata logging prefix format. */ +#endif + +/** + * @brief Common macro that maps all the logging interfaces, + * (#LogDebug, #LogInfo, #LogWarn, #LogError) to the platform-specific logging + * function. + * + * @note The default definition of the macro is an empty definition that does not + * generate any logging. + */ +#ifndef SdkLog #define SdkLog( string ) #endif +/** + * Disable definition of logging interface macros when generating doxygen output, + * to avoid conflict with documentation of macros at the end of the file. + */ /* Check that LIBRARY_LOG_LEVEL is defined and has a valid value. */ #if !defined( LIBRARY_LOG_LEVEL ) || \ ( ( LIBRARY_LOG_LEVEL != LOG_NONE ) && \ @@ -64,8 +88,6 @@ ( LIBRARY_LOG_LEVEL != LOG_INFO ) && \ ( LIBRARY_LOG_LEVEL != LOG_DEBUG ) ) #error "Please define LIBRARY_LOG_LEVEL as either LOG_NONE, LOG_ERROR, LOG_WARN, LOG_INFO, or LOG_DEBUG." -#elif !defined( LIBRARY_LOG_NAME ) - #error "Please define LIBRARY_LOG_NAME for the library." #else #if LIBRARY_LOG_LEVEL == LOG_DEBUG /* All log level messages will logged. */ @@ -105,4 +127,4 @@ #endif /* if LIBRARY_LOG_LEVEL == LOG_ERROR */ #endif /* if !defined( LIBRARY_LOG_LEVEL ) || ( ( LIBRARY_LOG_LEVEL != LOG_NONE ) && ( LIBRARY_LOG_LEVEL != LOG_ERROR ) && ( LIBRARY_LOG_LEVEL != LOG_WARN ) && ( LIBRARY_LOG_LEVEL != LOG_INFO ) && ( LIBRARY_LOG_LEVEL != LOG_DEBUG ) ) */ -#endif /* ifndef LOGGING_STACK_H_ */ +#endif /* ifndef LOGGING_STACK_H */ |