From c8c8f6b09974c600ad7e9b9e757bf55a878d7a30 Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu, 11 Jul 2024 12:37:12 -0700 Subject: [PATCH] Remove DS store; Fix formatting (#52) * Use only a specified cipher suite * Clean up folder by removing support packages * Remove DS store; Fix formatting * Fix whitespace --- .DS_Store | Bin 8196 -> 0 bytes .../transport_mbedtls/using_mbedtls.c | 34 +- examples/common/mqtt_agent/mqtt_agent_task.c | 68 ++-- examples/evkbmimxrt1060/bootloader/sbl_boot.c | 2 +- .../evkbmimxrt1060/bootloader/sblconfig.h | 2 +- .../bootloader/signing_pub_key.c | 1 - .../evkbmimxrt1060/pubsub/NetworkInterface.c | 96 ++--- examples/evkbmimxrt1060/pubsub/app_main.c | 2 +- .../evkbmimxrt1060/pubsub/demo_restrictions.c | 191 ++++----- .../evkbmimxrt1060/pubsub/demo_restrictions.h | 2 +- .../pubsub/include/FreeRTOSIPConfig.h | 377 +++++++++--------- .../pubsub/include/demo_config.h | 2 +- .../pubsub/include/tcp_sockets_wrapper.h | 4 +- examples/evkbmimxrt1060/pubsub/main.c | 93 ++--- .../pubsub/tcp_sockets_wrapper.c | 6 +- examples/evkbmimxrt1060/sesip/Demo.ld | 60 +-- .../sesip/include/FreeRTOSConfig.h | 96 ++--- examples/evkbmimxrt1060/sesip/log.log | 12 - examples/evkbmimxrt1060/sesip/main.c | 4 +- .../evkbmimxrt1060/sesip/memfault_handler.c | 24 +- .../sesip/task/demo_restricted_task.c | 49 +-- projects/evkmimxrt1060/sesip/Demo.ld | 86 ++-- .../evkmimxrt1060/sesip/MIMXRT1062xxxxA.xml | 2 +- projects/evkmimxrt1060/sesip/crt_infolist.dtd | 279 ------------- 24 files changed, 604 insertions(+), 888 deletions(-) delete mode 100644 .DS_Store delete mode 100644 examples/evkbmimxrt1060/sesip/log.log delete mode 100644 projects/evkmimxrt1060/sesip/crt_infolist.dtd diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 0ffe3bec048c44591240d86ade2c9d98a4c57c2e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeI1&u-H|5XNUqMAM`y6$exfh&(|g-XIMz5D8j|gmY-(5CVx^SK#?L z!Ebg=WIL{qdO#p{EAMB|&Nn;z?K+!HMZ~n%;S-S)5vg)19@nW#ini;uQ}$BJ1JJ;i z?kpY+XYr8d;~j5r@CtYZyaHYUuYgzJZ%}|eTTAtZec!eE+AH7{_%9XE&xZz=Vk^bO zq5bHfvPS^0g4q`C?N@)Wp$4#(V&V`B#W*VHs3tvPnDpde9G&)7>Yq4tbTPJP;-o#B z^n_y4gNJEYcQGx8zV-@u1$GtCvwKCFGLfmQ3g`Dz+L}LXvBdpfe)3+{GAww1D|pwo z-czDS63aryd5(Eh;MBLAIsPHN%w#Of0_#hG^%&M%MtE=JQhSjle=#EpxgTJ=p!Fm5 z#I_A+U1PnpIhBmse9nyez(ya-3Vz517V=>fImSc0uIOVx1~LAc0eab9hdeE@t0H6K zHL*`6%10Em%tbtur}9Eh#7p7~x-=03c0>A)F)kJ49gqt`eiZp zCWRRHQcho9OIO-3`=Dl0k^wo2e9fp=LHUxI*AeFYs;IF+w>ess&AG0WY}~u_-z(3- z==#X|*6d2qdC*)Ud8hi9D3|5bZ5A6m9jD1WZi;V+)hf%{XKuRa6`)T~f_xvUjXBC_ zbI52f$Y)AMx@K1>dW~&X;OT0}@@n$RjwrM_UJ;}8&H6p(Q*RN?;z(y)x78}zFHq@8D)1Ae>qCM7 diff --git a/Middleware/FreeRTOS/transport_mbedtls/using_mbedtls.c b/Middleware/FreeRTOS/transport_mbedtls/using_mbedtls.c index c9ffd1b..f61573f 100644 --- a/Middleware/FreeRTOS/transport_mbedtls/using_mbedtls.c +++ b/Middleware/FreeRTOS/transport_mbedtls/using_mbedtls.c @@ -627,10 +627,12 @@ static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, &( pNetworkContext->sslContext.certProfile ) ); /* Only use this cipher suite to connect to the broker. */ - const int ciphersuites[] = { - MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, - 0 /* End of list. */ - }; + const int ciphersuites[] = + { + MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, + 0 /* End of list. */ + }; + mbedtls_ssl_conf_ciphersuites( &( pNetworkContext->sslContext.config ), ciphersuites ); /* Parse the server root CA certificate into the SSL context. */ @@ -731,8 +733,8 @@ static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, /* coverity[misra_c_2012_rule_11_2_violation] */ mbedtls_ssl_set_bio( &( pNetworkContext->sslContext.context ), ( void * ) pNetworkContext->tcpSocket, - xMbedTLSBioTCPSocketsWrapperSend, - xMbedTLSBioTCPSocketsWrapperRecv, + xMbedTLSBioTCPSocketsWrapperSend, + xMbedTLSBioTCPSocketsWrapperRecv, NULL ); } } @@ -810,6 +812,7 @@ static TlsTransportStatus_t tlsSetup( NetworkContext_t * pNetworkContext, } /*-----------------------------------------------------------*/ + /** * @brief Sends data over TCP socket. * @@ -856,6 +859,7 @@ int xMbedTLSBioTCPSocketsWrapperSend( void * ctx, } /*-----------------------------------------------------------*/ + /** * @brief Receives data from TCP socket. * @@ -949,15 +953,15 @@ TlsTransportStatus_t TLS_FreeRTOS_Connect( NetworkContext_t * pNetworkContext, returnStatus = tlsSetup( pNetworkContext, pHostName, pNetworkCredentials ); } -// if( returnStatus == TLS_TRANSPORT_SUCCESS ) -// { -// opt = 1; -// -// if( lwip_ioctl( pNetworkContext->tcpSocket, FIONBIO, &opt ) != 0 ) -// { -// returnStatus = TLS_TRANSPORT_CONNECT_FAILURE; -// } -// } +/* if( returnStatus == TLS_TRANSPORT_SUCCESS ) */ +/* { */ +/* opt = 1; */ +/* */ +/* if( lwip_ioctl( pNetworkContext->tcpSocket, FIONBIO, &opt ) != 0 ) */ +/* { */ +/* returnStatus = TLS_TRANSPORT_CONNECT_FAILURE; */ +/* } */ +/* } */ /* Clean up on failure. */ if( returnStatus != TLS_TRANSPORT_SUCCESS ) diff --git a/examples/common/mqtt_agent/mqtt_agent_task.c b/examples/common/mqtt_agent/mqtt_agent_task.c index 46af999..12141ad 100644 --- a/examples/common/mqtt_agent/mqtt_agent_task.c +++ b/examples/common/mqtt_agent/mqtt_agent_task.c @@ -576,12 +576,12 @@ static BaseType_t prvCreateTLSConnection( NetworkContext_t * pxNetworkContext ) xNetworkCredentials.disableSni = democonfigDISABLE_SNI; /* - xNetworkCredentials.pClientCert = democonfigCLIENT_CERT; - xNetworkCredentials.clientCertSize = sizeof( democonfigCLIENT_CERT ); - - xNetworkCredentials.pPrivateKey = democonfigPRIVATE_KEY; - xNetworkCredentials.privateKeySize = sizeof( democonfigPRIVATE_KEY ); - */ + * xNetworkCredentials.pClientCert = democonfigCLIENT_CERT; + * xNetworkCredentials.clientCertSize = sizeof( democonfigCLIENT_CERT ); + * + * xNetworkCredentials.pPrivateKey = democonfigPRIVATE_KEY; + * xNetworkCredentials.privateKeySize = sizeof( democonfigPRIVATE_KEY ); + */ if( xConnected == pdPASS ) { @@ -785,7 +785,7 @@ void prvMQTTAgentTask( void * pvParameters ) ulGlobalEntryTimeMs = prvGetTimeMs(); /* Load broker endpoint and thing name for client connection, from the key store. */ - pcThingName = prvKVStoreGetString( KVS_CORE_THING_NAME ); //democonfigCLIENT_IDENTIFIER; // + pcThingName = prvKVStoreGetString( KVS_CORE_THING_NAME ); /*democonfigCLIENT_IDENTIFIER; // */ LogInfo( ( "Thing name %s\n", pcThingName ) ); if( pcThingName != NULL ) @@ -799,7 +799,7 @@ void prvMQTTAgentTask( void * pvParameters ) if( xStatus == pdPASS ) { - pcBrokerEndpoint = prvKVStoreGetString( KVS_CORE_MQTT_ENDPOINT ); //democonfigMQTT_BROKER_ENDPOINT; // + pcBrokerEndpoint = prvKVStoreGetString( KVS_CORE_MQTT_ENDPOINT ); /*democonfigMQTT_BROKER_ENDPOINT; // */ LogInfo( ( "Endpoint %s\n", pcBrokerEndpoint ) ); if( pcBrokerEndpoint == NULL ) @@ -810,29 +810,29 @@ void prvMQTTAgentTask( void * pvParameters ) if( xStatus == pdPASS ) { - ulBrokerPort = KVStore_getUInt32( KVS_CORE_MQTT_PORT, &xStatus ); //democonfigMQTT_BROKER_PORT; // + ulBrokerPort = KVStore_getUInt32( KVS_CORE_MQTT_PORT, &xStatus ); /*democonfigMQTT_BROKER_PORT; // */ LogInfo( ( "Port %u\n", ulBrokerPort ) ); } if( xStatus == pdPASS ) - { - pcDevicePrivKeyID = prvKVStoreGetString( KVS_DEVICE_PRIVKEY_ID ); + { + pcDevicePrivKeyID = prvKVStoreGetString( KVS_DEVICE_PRIVKEY_ID ); - if( pcDevicePrivKeyID == NULL ) - { - xStatus = pdFAIL; - } - } + if( pcDevicePrivKeyID == NULL ) + { + xStatus = pdFAIL; + } + } - if( xStatus == pdPASS ) - { - pcDeviceCertID = prvKVStoreGetString( KVS_DEVICE_CERT_ID ); + if( xStatus == pdPASS ) + { + pcDeviceCertID = prvKVStoreGetString( KVS_DEVICE_CERT_ID ); - if( pcDeviceCertID == NULL ) - { - xStatus = pdFAIL; - } - } + if( pcDeviceCertID == NULL ) + { + xStatus = pdFAIL; + } + } /* Initialize the MQTT context with the buffer and transport interface. */ if( xStatus == pdPASS ) @@ -899,16 +899,16 @@ void prvMQTTAgentTask( void * pvParameters ) } if( pcDevicePrivKeyID != NULL ) - { - vPortFree( pcDevicePrivKeyID ); - pcDevicePrivKeyID = NULL; - } - - if( pcDeviceCertID != NULL ) - { - vPortFree( pcDeviceCertID ); - pcDeviceCertID = NULL; - } + { + vPortFree( pcDevicePrivKeyID ); + pcDevicePrivKeyID = NULL; + } + + if( pcDeviceCertID != NULL ) + { + vPortFree( pcDeviceCertID ); + pcDeviceCertID = NULL; + } vTaskDelete( NULL ); } diff --git a/examples/evkbmimxrt1060/bootloader/sbl_boot.c b/examples/evkbmimxrt1060/bootloader/sbl_boot.c index 34a364f..f0c5a8e 100644 --- a/examples/evkbmimxrt1060/bootloader/sbl_boot.c +++ b/examples/evkbmimxrt1060/bootloader/sbl_boot.c @@ -288,7 +288,7 @@ int boot_single_go( struct boot_rsp * rsp ) int sbl_boot_main( void ) { - /* Reset ISR is at: 0x6004071c. */ + /* Reset ISR is at: 0x6004071c. */ struct image_header br_hdr1 = { .ih_hdr_size = 0x2000 }; struct boot_rsp rsp = { .br_hdr = &br_hdr1, .br_flash_dev_id = 1, .br_image_off = 0x80000 }; int rc = 0; diff --git a/examples/evkbmimxrt1060/bootloader/sblconfig.h b/examples/evkbmimxrt1060/bootloader/sblconfig.h index 5cd2361..1af813d 100644 --- a/examples/evkbmimxrt1060/bootloader/sblconfig.h +++ b/examples/evkbmimxrt1060/bootloader/sblconfig.h @@ -37,7 +37,7 @@ /* secure */ #define COMPONENT_MCUBOOT_SECURE -//#define CONFIG_BOOT_SIGNATURE_TYPE_ROM +/*#define CONFIG_BOOT_SIGNATURE_TYPE_ROM */ #define CONFIG_BOOT_SIGNATURE #define CONFIG_BOOT_SIGNATURE_TYPE_RSA #define CONFIG_BOOT_SIGNATURE_TYPE_RSA_LEN 2048 diff --git a/examples/evkbmimxrt1060/bootloader/signing_pub_key.c b/examples/evkbmimxrt1060/bootloader/signing_pub_key.c index a7ab319..dc0943f 100644 --- a/examples/evkbmimxrt1060/bootloader/signing_pub_key.c +++ b/examples/evkbmimxrt1060/bootloader/signing_pub_key.c @@ -43,4 +43,3 @@ const unsigned char ecdsa_pub_key[] = { 0x00 }; const unsigned int ecdsa_pub_key_len = 0; #endif /* if defined( MCUBOOT_SIGN_RSA ) */ - diff --git a/examples/evkbmimxrt1060/pubsub/NetworkInterface.c b/examples/evkbmimxrt1060/pubsub/NetworkInterface.c index 347a7d2..397093f 100644 --- a/examples/evkbmimxrt1060/pubsub/NetworkInterface.c +++ b/examples/evkbmimxrt1060/pubsub/NetworkInterface.c @@ -50,9 +50,9 @@ #include "NetworkInterface.h" #if ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES != 1 - #define ipCONSIDER_FRAME_FOR_PROCESSING( pucEthernetBuffer ) eProcessBuffer +#define ipCONSIDER_FRAME_FOR_PROCESSING( pucEthernetBuffer ) eProcessBuffer #else - #define ipCONSIDER_FRAME_FOR_PROCESSING( pucEthernetBuffer ) eConsiderFrameForProcessing( ( pucEthernetBuffer ) ) +#define ipCONSIDER_FRAME_FOR_PROCESSING( pucEthernetBuffer ) eConsiderFrameForProcessing( ( pucEthernetBuffer ) ) #endif /* MDIO operations. */ @@ -72,25 +72,25 @@ /* The length or RX buffer. */ #ifndef ENET_RXBUFF_SIZE - #define ENET_RXBUFF_SIZE ( ENET_FRAME_MAX_FRAMELEN ) +#define ENET_RXBUFF_SIZE ( ENET_FRAME_MAX_FRAMELEN ) #endif /* ENET IRQ priority. Used in FreeRTOS. */ /* Interrupt priorities. */ #ifdef __CA7_REV - #ifndef ENET_PRIORITY - #define ENET_PRIORITY ( 21U ) - #endif - #ifndef ENET_1588_PRIORITY - #define ENET_1588_PRIORITY ( 20U ) - #endif +#ifndef ENET_PRIORITY +#define ENET_PRIORITY ( 21U ) +#endif +#ifndef ENET_1588_PRIORITY +#define ENET_1588_PRIORITY ( 20U ) +#endif #else - #ifndef ENET_PRIORITY - #define ENET_PRIORITY ( 6U ) - #endif - #ifndef ENET_1588_PRIORITY - #define ENET_1588_PRIORITY ( 5U ) - #endif +#ifndef ENET_PRIORITY +#define ENET_PRIORITY ( 6U ) +#endif +#ifndef ENET_1588_PRIORITY +#define ENET_1588_PRIORITY ( 5U ) +#endif #endif /* ifdef __CA7_REV */ /* The number of ENET buffers needed to receive frame of maximum length. */ @@ -99,33 +99,33 @@ /* The length or TX buffer. */ #ifndef ENET_TXBUFF_SIZE - #define ENET_TXBUFF_SIZE ( ENET_FRAME_MAX_FRAMELEN ) +#define ENET_TXBUFF_SIZE ( ENET_FRAME_MAX_FRAMELEN ) #endif /* The number of buffer descriptors in ENET RX ring. */ #ifndef ENET_RXBD_NUM - #define ENET_RXBD_NUM ( 5 ) +#define ENET_RXBD_NUM ( 5 ) #endif /* Ring should be able to receive at least 1 frame with maximum length. */ #if ENET_RXBD_NUM < MAX_BUFFERS_PER_FRAME - #error "ENET_RXBD_NUM < MAX_BUFFERS_PER_FRAME" +#error "ENET_RXBD_NUM < MAX_BUFFERS_PER_FRAME" #endif /* The number of RX buffers. ENET_RXBD_NUM is always held by ENET driver. */ #ifndef ENET_RXBUFF_NUM - #define ENET_RXBUFF_NUM ( ENET_RXBD_NUM * 2 ) +#define ENET_RXBUFF_NUM ( ENET_RXBD_NUM * 2 ) #endif /* At least ENET_RXBD_NUM number of buffers is always held by ENET driver * for RX. */ #if ENET_RXBUFF_NUM < ( ENET_RXBD_NUM + MAX_BUFFERS_PER_FRAME ) - #error "ENET_RXBUFF_NUM < (ENET_RXBD_NUM + MAX_BUFFERS_PER_FRAME)" +#error "ENET_RXBUFF_NUM < (ENET_RXBD_NUM + MAX_BUFFERS_PER_FRAME)" #endif /* The number of buffer descriptors in ENET TX ring. */ #ifndef ENET_TXBD_NUM - #define ENET_TXBD_NUM ( 3 ) +#define ENET_TXBD_NUM ( 3 ) #endif /* Set the timeout values such that the total timeout adds up to 4000ms. */ @@ -133,21 +133,21 @@ #define SINGLE_ITERATION_TIMEOUT ( 100 ) #if defined( FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL ) && FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL - #if defined( FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) && \ +#if defined( FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) && \ ( ( !defined( FSL_SDK_DISBLE_L2CACHE_PRESENT ) ) || ( FSL_SDK_DISBLE_L2CACHE_PRESENT == 0 ) ) - #if defined( FSL_FEATURE_L1DCACHE_LINESIZE_BYTE ) - #define FSL_CACHE_LINESIZE_MAX MAX( FSL_FEATURE_L1DCACHE_LINESIZE_BYTE, FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) - #define FSL_ENET_BUFF_ALIGNMENT MAX( ENET_BUFF_ALIGNMENT, FSL_CACHE_LINESIZE_MAX ) - #else - #define FSL_ENET_BUFF_ALIGNMENT MAX( ENET_BUFF_ALIGNMENT, FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) - #endif - #elif defined( FSL_FEATURE_L1DCACHE_LINESIZE_BYTE ) - #define FSL_ENET_BUFF_ALIGNMENT MAX( ENET_BUFF_ALIGNMENT, FSL_FEATURE_L1DCACHE_LINESIZE_BYTE ) - #else - #define FSL_ENET_BUFF_ALIGNMENT ENET_BUFF_ALIGNMENT - #endif /* if defined( FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) && ( ( !defined( FSL_SDK_DISBLE_L2CACHE_PRESENT ) ) || ( FSL_SDK_DISBLE_L2CACHE_PRESENT == 0 ) ) */ +#if defined( FSL_FEATURE_L1DCACHE_LINESIZE_BYTE ) +#define FSL_CACHE_LINESIZE_MAX MAX( FSL_FEATURE_L1DCACHE_LINESIZE_BYTE, FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) +#define FSL_ENET_BUFF_ALIGNMENT MAX( ENET_BUFF_ALIGNMENT, FSL_CACHE_LINESIZE_MAX ) +#else +#define FSL_ENET_BUFF_ALIGNMENT MAX( ENET_BUFF_ALIGNMENT, FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) +#endif +#elif defined( FSL_FEATURE_L1DCACHE_LINESIZE_BYTE ) +#define FSL_ENET_BUFF_ALIGNMENT MAX( ENET_BUFF_ALIGNMENT, FSL_FEATURE_L1DCACHE_LINESIZE_BYTE ) +#else +#define FSL_ENET_BUFF_ALIGNMENT ENET_BUFF_ALIGNMENT +#endif /* if defined( FSL_FEATURE_L2CACHE_LINESIZE_BYTE ) && ( ( !defined( FSL_SDK_DISBLE_L2CACHE_PRESENT ) ) || ( FSL_SDK_DISBLE_L2CACHE_PRESENT == 0 ) ) */ #else /* if defined( FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL ) && FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL */ - #define FSL_ENET_BUFF_ALIGNMENT ENET_BUFF_ALIGNMENT +#define FSL_ENET_BUFF_ALIGNMENT ENET_BUFF_ALIGNMENT #endif /* if defined( FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL ) && FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL */ /* A bigger value is chosen so that the previous notification values are @@ -156,7 +156,7 @@ #define DRIVER_FATAL ( DRIVER_READY << 1 ) #if defined( ENET_ENHANCEDBUFFERDESCRIPTOR_MODE ) - #error "ENET_ENHANCEDBUFFERDESCRIPTOR_MODE is not supported by this driver" +#error "ENET_ENHANCEDBUFFERDESCRIPTOR_MODE is not supported by this driver" #endif typedef uint8_t rx_buffer_t[ SDK_SIZEALIGN( ENET_RXBUFF_SIZE, FSL_ENET_BUFF_ALIGNMENT ) ]; @@ -479,7 +479,7 @@ static void prvEMACHandlerTask( void * parameter ) break; case kStatus_ENET_RxFrameError: /* Received an error frame. Read & drop it */ - FreeRTOS_printf( ( "RX Receive Error" ) ); + FreeRTOS_printf( ( "RX Receive Error" ) ); ENET_ReadFrame( ethernetifLocal->base, &( ethernetifLocal->handle ), NULL, 0, 0, NULL ); /* Not sure if a trace is required. The MAC had an error and needed to dump bytes */ break; @@ -554,28 +554,28 @@ static void prvProcessFrame( int length ) } else { - #if ( ( ipconfigHAS_DEBUG_PRINTF == 1 ) && defined( FreeRTOS_debug_printf ) ) - const EthernetHeader_t * pxEthernetHeader; - char ucSource[ 18 ]; - char ucDestination[ 18 ]; +#if ( ( ipconfigHAS_DEBUG_PRINTF == 1 ) && defined( FreeRTOS_debug_printf ) ) + const EthernetHeader_t * pxEthernetHeader; + char ucSource[ 18 ]; + char ucDestination[ 18 ]; - pxEthernetHeader = ( ( const EthernetHeader_t * ) pxBufferDescriptor->pucEthernetBuffer ); + pxEthernetHeader = ( ( const EthernetHeader_t * ) pxBufferDescriptor->pucEthernetBuffer ); - FreeRTOS_EUI48_ntop( pxEthernetHeader->xSourceAddress.ucBytes, ucSource, 'A', ':' ); - FreeRTOS_EUI48_ntop( pxEthernetHeader->xDestinationAddress.ucBytes, ucDestination, 'A', ':' ); + FreeRTOS_EUI48_ntop( pxEthernetHeader->xSourceAddress.ucBytes, ucSource, 'A', ':' ); + FreeRTOS_EUI48_ntop( pxEthernetHeader->xDestinationAddress.ucBytes, ucDestination, 'A', ':' ); - FreeRTOS_debug_printf( ( "Invalid target MAC: dropping frame from: %s to: %s", ucSource, ucDestination ) ); - #endif /* if ( ( ipconfigHAS_DEBUG_PRINTF == 1 ) && defined( FreeRTOS_debug_printf ) ) */ + FreeRTOS_debug_printf( ( "Invalid target MAC: dropping frame from: %s to: %s", ucSource, ucDestination ) ); +#endif /* if ( ( ipconfigHAS_DEBUG_PRINTF == 1 ) && defined( FreeRTOS_debug_printf ) ) */ vReleaseNetworkBufferAndDescriptor( pxBufferDescriptor ); /* Not sure if a trace is required. The stack did not want this message */ } } else { - #if ( ( ipconfigHAS_DEBUG_PRINTF == 1 ) && defined( FreeRTOS_debug_printf ) ) - FreeRTOS_debug_printf( ( "No Buffer Available: dropping incoming frame!!" ) ); - #endif +#if ( ( ipconfigHAS_DEBUG_PRINTF == 1 ) && defined( FreeRTOS_debug_printf ) ) + FreeRTOS_debug_printf( ( "No Buffer Available: dropping incoming frame!!" ) ); +#endif ENET_ReadFrame( ENET, &( ethernetifLocal->handle ), NULL, 0, 0, NULL ); /* No buffer available to receive this message */ diff --git a/examples/evkbmimxrt1060/pubsub/app_main.c b/examples/evkbmimxrt1060/pubsub/app_main.c index ab842f3..79371d1 100644 --- a/examples/evkbmimxrt1060/pubsub/app_main.c +++ b/examples/evkbmimxrt1060/pubsub/app_main.c @@ -124,7 +124,7 @@ int app_main( void ) if( xResult == pdPASS ) { xResult = xMQTTAgentInit( appmainMQTT_AGENT_TASK_STACK_SIZE, appmainMQTT_AGENT_TASK_PRIORITY ); - //SRC->SCR |= SRC_SCR_CORE0_RST_MASK; + /*SRC->SCR |= SRC_SCR_CORE0_RST_MASK; */ } #if ( appmainINCLUDE_OTA_UPDATE_TASK == 1 ) diff --git a/examples/evkbmimxrt1060/pubsub/demo_restrictions.c b/examples/evkbmimxrt1060/pubsub/demo_restrictions.c index 70391dc..90a4e66 100644 --- a/examples/evkbmimxrt1060/pubsub/demo_restrictions.c +++ b/examples/evkbmimxrt1060/pubsub/demo_restrictions.c @@ -25,18 +25,18 @@ * 1 tab == 4 spaces! */ - /** - * @brief Demonstration of Memory Protection Unit functionalities. - * Demo creates two restricted tasks read-only task and and a read write task. - * To find more about create restricted task API, see: https://www.freertos.org/xTaskCreateRestricted.html. - * Read-only task has read only access to a shared memory region, while Read-Write task has both read and write - * access to it. Read-only task sets a global flag to one and then try to write to the shared memory region, which generates - * hard fault by MPU. The hard fault handler implemented in this demo handles the exception gracefully by setting the global - * flag back to zero and skipping to the next instruction in the task. The read only task verifies that flag is reset to zero to confirm - * that the memory fault was raised and handled gracefully. - */ - - /* FreeRTOS include. */ +/** + * @brief Demonstration of Memory Protection Unit functionalities. + * Demo creates two restricted tasks read-only task and and a read write task. + * To find more about create restricted task API, see: https://www.freertos.org/xTaskCreateRestricted.html. + * Read-only task has read only access to a shared memory region, while Read-Write task has both read and write + * access to it. Read-only task sets a global flag to one and then try to write to the shared memory region, which generates + * hard fault by MPU. The hard fault handler implemented in this demo handles the exception gracefully by setting the global + * flag back to zero and skipping to the next instruction in the task. The read only task verifies that flag is reset to zero to confirm + * that the memory fault was raised and handled gracefully. + */ + +/* FreeRTOS include. */ #include "FreeRTOS.h" /* Task API include. */ @@ -52,25 +52,25 @@ */ #define INJECT_TEST_MEMORY_FAULT ( 0 ) - /** - * @brief Size of the shared memory between the restricted tasks. - */ +/** + * @brief Size of the shared memory between the restricted tasks. + */ #define SHARED_MEMORY_SIZE 32 - /** - * @brief Size of the memory region used by the Read only task and hard fault handler. - */ +/** + * @brief Size of the memory region used by the Read only task and hard fault handler. + */ #define MIN_REGION_SIZE 32 - /** - * @brief Stack size of the restricted tasks. - */ +/** + * @brief Stack size of the restricted tasks. + */ #define RESTRICTED_TASK_STACK_SIZE 128 - /* - * @brief Macro to override printf funtion to run it in privileged mode. - * NXP PRINTF code resides somewhere in RAM that could be provided as accessible region, but it's simpler to - * just run it as privileged */ +/* + * @brief Macro to override printf funtion to run it in privileged mode. + * NXP PRINTF code resides somewhere in RAM that could be provided as accessible region, but it's simpler to + * just run it as privileged */ #define MPU_PRINTF( ... ) \ { \ BaseType_t xRunningPrivileged = xPortRaisePrivilege(); \ @@ -79,7 +79,7 @@ } - /* For readability. Read about Hardfault Entry in ARMv7 docs for more details */ +/* For readability. Read about Hardfault Entry in ARMv7 docs for more details */ typedef struct { uint32_t r0; @@ -98,7 +98,7 @@ typedef struct * * @return pdFALSE if privilege was raised, pdTRUE otherwise. */ -extern BaseType_t xPortRaisePrivilege(void); +extern BaseType_t xPortRaisePrivilege( void ); /** * @brief Calls the port specific code to reset the privilege. @@ -107,12 +107,12 @@ extern BaseType_t xPortRaisePrivilege(void); * * @param[in] xRunningPrivileged Whether running in privelged mode or not. */ -extern void vPortResetPrivilege(BaseType_t xRunningPrivileged); +extern void vPortResetPrivilege( BaseType_t xRunningPrivileged ); /** * @brief Function used to dump the MPU memory regions allocated by linker script. */ -void printRegions(void); +void printRegions( void ); /** * @brief The Read write restricted task. @@ -121,7 +121,7 @@ void printRegions(void); * * @param[in] pvParameters Parameters to the task. */ -static void prvRWAccessTask(void* pvParameters); +static void prvRWAccessTask( void * pvParameters ); /** * @brief The read only task @@ -131,7 +131,7 @@ static void prvRWAccessTask(void* pvParameters); * * @param[in] pvParameters Parameters to the task. */ -static void prvROAccessTask(void* pvParameters); +static void prvROAccessTask( void * pvParameters ); /** * @brief Memory regions used by the linker script. @@ -151,12 +151,12 @@ extern uint32_t __SRAM_segment_end__[]; /** * @brief Shared memory area used between the restricted tasks. */ -static uint8_t ucSharedMemory[SHARED_MEMORY_SIZE] __attribute__((aligned(SHARED_MEMORY_SIZE))); +static uint8_t ucSharedMemory[ SHARED_MEMORY_SIZE ] __attribute__( ( aligned( SHARED_MEMORY_SIZE ) ) ); /** * @brief Statically allocated stack for Read-write access restristed task. */ -static StackType_t xRWAccessTaskStack[RESTRICTED_TASK_STACK_SIZE] __attribute__((aligned(RESTRICTED_TASK_STACK_SIZE * sizeof(StackType_t)))); +static StackType_t xRWAccessTaskStack[ RESTRICTED_TASK_STACK_SIZE ] __attribute__( ( aligned( RESTRICTED_TASK_STACK_SIZE * sizeof( StackType_t ) ) ) ); /* * @brief The memory region shared between Read only task and hard fault handler. @@ -164,18 +164,18 @@ static StackType_t xRWAccessTaskStack[RESTRICTED_TASK_STACK_SIZE] __attribute__( * This is how RO task communicates to handler that it intentionally memory faulted. * Note, handlers run priviliged thus will have access) * Also note, 32B is minimum valid size for region*/ -static volatile uint8_t ucROTaskFaultTracker[MIN_REGION_SIZE] __attribute__((aligned(MIN_REGION_SIZE))) = { 0 }; +static volatile uint8_t ucROTaskFaultTracker[ MIN_REGION_SIZE ] __attribute__( ( aligned( MIN_REGION_SIZE ) ) ) = { 0 }; /** * @brief Statically allocated stack for Read-only access restristed task. */ -static StackType_t xROAccessTaskStack[RESTRICTED_TASK_STACK_SIZE] __attribute__((aligned(RESTRICTED_TASK_STACK_SIZE * sizeof(StackType_t)))); +static StackType_t xROAccessTaskStack[ RESTRICTED_TASK_STACK_SIZE ] __attribute__( ( aligned( RESTRICTED_TASK_STACK_SIZE * sizeof( StackType_t ) ) ) ); /* ------------------------------------------------------------------------------- */ -void printRegions(void) +void printRegions( void ) { - uint32_t* tmp = NULL; + uint32_t * tmp = NULL; tmp = __privileged_functions_start__; tmp = __privileged_functions_end__; @@ -184,87 +184,87 @@ void printRegions(void) tmp = __privileged_data_start__; tmp = __privileged_data_end__; - (void)tmp; + ( void ) tmp; - PRINTF("\r\n"); - PRINTF("privileged functions: %08x - %08x\r\n", __privileged_functions_start__, __privileged_functions_end__); - PRINTF("privileged data: %08x - %08x\r\n", __privileged_data_start__, __privileged_data_end__); - PRINTF("system calls: %08x - %08x\r\n", __syscalls_flash_start__, __syscalls_flash_end__); - PRINTF("flash segment: %08x - %08x\r\n", __FLASH_segment_start__, __FLASH_segment_end__); - PRINTF("sram segment: %08x - %08x\r\n", __SRAM_segment_start__, __SRAM_segment_end__); - PRINTF("\r\n"); + PRINTF( "\r\n" ); + PRINTF( "privileged functions: %08x - %08x\r\n", __privileged_functions_start__, __privileged_functions_end__ ); + PRINTF( "privileged data: %08x - %08x\r\n", __privileged_data_start__, __privileged_data_end__ ); + PRINTF( "system calls: %08x - %08x\r\n", __syscalls_flash_start__, __syscalls_flash_end__ ); + PRINTF( "flash segment: %08x - %08x\r\n", __FLASH_segment_start__, __FLASH_segment_end__ ); + PRINTF( "sram segment: %08x - %08x\r\n", __SRAM_segment_start__, __SRAM_segment_end__ ); + PRINTF( "\r\n" ); } -static void prvRWAccessTask(void* pvParameters) +static void prvRWAccessTask( void * pvParameters ) { /* Unused parameters. */ - (void)pvParameters; + ( void ) pvParameters; - ucSharedMemory[0] = 0; + ucSharedMemory[ 0 ] = 0; - while (1) + while( 1 ) { - ucSharedMemory[0] = 1; - MPU_PRINTF("Ran RW task\r\n"); + ucSharedMemory[ 0 ] = 1; + MPU_PRINTF( "Ran RW task\r\n" ); - vTaskDelay(pdMS_TO_TICKS(8000)); + vTaskDelay( pdMS_TO_TICKS( 8000 ) ); } } -static void prvROAccessTask(void* pvParameters) +static void prvROAccessTask( void * pvParameters ) { uint8_t ucVal; /* Unused parameters. */ - (void)pvParameters; - ucROTaskFaultTracker[0] = 0; + ( void ) pvParameters; + ucROTaskFaultTracker[ 0 ] = 0; - for (; ; ) + for( ; ; ) { /* This task has RO access to ucSharedMemory and therefore it can read * it but cannot modify it. */ - ucVal = ucSharedMemory[0]; + ucVal = ucSharedMemory[ 0 ]; /* Silent compiler warnings about unused variables. */ - (void)ucVal; + ( void ) ucVal; #if ( INJECT_TEST_MEMORY_FAULT == 1 ) - ucROTaskFaultTracker[0] = 1; + ucROTaskFaultTracker[ 0 ] = 1; - MPU_PRINTF("Triggering memory violation...\r\n"); + MPU_PRINTF( "Triggering memory violation...\r\n" ); /* Illegal access to generate Memory Fault. */ - ucSharedMemory[0] = 0; + ucSharedMemory[ 0 ] = 0; /* Ensure that the above line did generate MemFault and the fault * handler did clear the ucROTaskFaultTracker[ 0 ]. */ - if (ucROTaskFaultTracker[0] == 0) + if( ucROTaskFaultTracker[ 0 ] == 0 ) { - MPU_PRINTF("Access Violation handled.\r\n"); + MPU_PRINTF( "Access Violation handled.\r\n" ); } else { - MPU_PRINTF("Error: Access violation should have triggered a fault\r\n"); + MPU_PRINTF( "Error: Access violation should have triggered a fault\r\n" ); } #endif /* ifdef INJECT_TEST_MEMORY_FAULT */ - MPU_PRINTF("Ran RO task\r\n"); + MPU_PRINTF( "Ran RO task\r\n" ); - vTaskDelay(pdMS_TO_TICKS(5000)); + vTaskDelay( pdMS_TO_TICKS( 5000 ) ); } } -void xCreateRestrictedTasks(BaseType_t xPriority) +void xCreateRestrictedTasks( BaseType_t xPriority ) { /* Create restricted tasks */ TaskParameters_t xRWAccessTaskParameters = { - .pvTaskCode = prvRWAccessTask, - .pcName = "RWAccess", - .usStackDepth = RESTRICTED_TASK_STACK_SIZE, - .pvParameters = NULL, - .uxPriority = xPriority, + .pvTaskCode = prvRWAccessTask, + .pcName = "RWAccess", + .usStackDepth = RESTRICTED_TASK_STACK_SIZE, + .pvParameters = NULL, + .uxPriority = xPriority, .puxStackBuffer = xRWAccessTaskStack, - .xRegions = + .xRegions = { { ucSharedMemory, SHARED_MEMORY_SIZE, portMPU_REGION_READ_WRITE | portMPU_REGION_EXECUTE_NEVER }, { 0, 0, 0 }, @@ -272,25 +272,26 @@ void xCreateRestrictedTasks(BaseType_t xPriority) } }; - xTaskCreateRestricted(&(xRWAccessTaskParameters), NULL); + xTaskCreateRestricted( &( xRWAccessTaskParameters ), NULL ); TaskParameters_t xROAccessTaskParameters = { - .pvTaskCode = prvROAccessTask, - .pcName = "ROAccess", - .usStackDepth = RESTRICTED_TASK_STACK_SIZE, - .pvParameters = NULL, - .uxPriority = xPriority, + .pvTaskCode = prvROAccessTask, + .pcName = "ROAccess", + .usStackDepth = RESTRICTED_TASK_STACK_SIZE, + .pvParameters = NULL, + .uxPriority = xPriority, .puxStackBuffer = xROAccessTaskStack, - .xRegions = + .xRegions = { { ucSharedMemory, SHARED_MEMORY_SIZE, portMPU_REGION_PRIVILEGED_READ_WRITE_UNPRIV_READ_ONLY | portMPU_REGION_EXECUTE_NEVER }, - { (void*)ucROTaskFaultTracker, SHARED_MEMORY_SIZE, portMPU_REGION_READ_WRITE | portMPU_REGION_EXECUTE_NEVER }, + { ( void * ) ucROTaskFaultTracker, SHARED_MEMORY_SIZE, portMPU_REGION_READ_WRITE | portMPU_REGION_EXECUTE_NEVER }, { 0, 0, 0 } /*{ 0x20000500, 0x100, portMPU_REGION_READ_WRITE }, */ } }; - xTaskCreateRestricted(&(xROAccessTaskParameters), NULL); + + xTaskCreateRestricted( &( xROAccessTaskParameters ), NULL ); } @@ -302,20 +303,20 @@ void xCreateRestrictedTasks(BaseType_t xPriority) * resets the shared flag to zero for read-only task and then skips the stack pointer to the next * instruction to be executed. */ -portDONT_DISCARD void vHandleMemoryFault(uint32_t* pulFaultStackAddress) +portDONT_DISCARD void vHandleMemoryFault( uint32_t * pulFaultStackAddress ) { uint32_t ulPC; uint16_t usOffendingInstruction; - HardFaultStack_t* const xFaultStack = (HardFaultStack_t*)pulFaultStackAddress; + HardFaultStack_t * const xFaultStack = ( HardFaultStack_t * ) pulFaultStackAddress; /* Read program counter. */ ulPC = xFaultStack->return_address; - if (ucROTaskFaultTracker[0] == 1) + if( ucROTaskFaultTracker[ 0 ] == 1 ) { /* Read the offending instruction. */ - usOffendingInstruction = *(uint16_t*)ulPC; + usOffendingInstruction = *( uint16_t * ) ulPC; /* From ARM docs: * If the value of bits[15:11] of the halfword being decoded is one of @@ -327,14 +328,14 @@ portDONT_DISCARD void vHandleMemoryFault(uint32_t* pulFaultStackAddress) * Otherwise, the halfword is a 16-bit instruction. */ - /* Extract bits[15:11] of the offending instruction. */ + /* Extract bits[15:11] of the offending instruction. */ usOffendingInstruction = usOffendingInstruction & 0xF800; - usOffendingInstruction = (usOffendingInstruction >> 11); + usOffendingInstruction = ( usOffendingInstruction >> 11 ); /* Increment to next instruction, depending on current instruction size (32-bit or 16-bit) */ - if ((usOffendingInstruction == 0x001F) || - (usOffendingInstruction == 0x001E) || - (usOffendingInstruction == 0x001D)) + if( ( usOffendingInstruction == 0x001F ) || + ( usOffendingInstruction == 0x001E ) || + ( usOffendingInstruction == 0x001D ) ) { ulPC += 4; } @@ -344,18 +345,18 @@ portDONT_DISCARD void vHandleMemoryFault(uint32_t* pulFaultStackAddress) } /* Indicate to RO task its expected fault was handled */ - ucROTaskFaultTracker[0] = 0; + ucROTaskFaultTracker[ 0 ] = 0; /* Resume execution after offending instruction from RO task */ xFaultStack->return_address = ulPC; - PRINTF("Expected memory violation caught by handler...\r\n", ulPC); + PRINTF( "Expected memory violation caught by handler...\r\n", ulPC ); } else { - PRINTF("Memory Access Violation. Inst @ %x\r\n", ulPC); + PRINTF( "Memory Access Violation. Inst @ %x\r\n", ulPC ); - while (1) + while( 1 ) { } } diff --git a/examples/evkbmimxrt1060/pubsub/demo_restrictions.h b/examples/evkbmimxrt1060/pubsub/demo_restrictions.h index 1f5cce2..ea7ab96 100644 --- a/examples/evkbmimxrt1060/pubsub/demo_restrictions.h +++ b/examples/evkbmimxrt1060/pubsub/demo_restrictions.h @@ -41,4 +41,4 @@ */ void xCreateRestrictedTasks( BaseType_t xPriority ); -#endif /* USER_DEMO_RESTRICTIONS_H_ */ \ No newline at end of file +#endif /* USER_DEMO_RESTRICTIONS_H_ */ diff --git a/examples/evkbmimxrt1060/pubsub/include/FreeRTOSIPConfig.h b/examples/evkbmimxrt1060/pubsub/include/FreeRTOSIPConfig.h index f4aa95b..8c5904f 100644 --- a/examples/evkbmimxrt1060/pubsub/include/FreeRTOSIPConfig.h +++ b/examples/evkbmimxrt1060/pubsub/include/FreeRTOSIPConfig.h @@ -26,283 +26,284 @@ /***************************************************************************** - * - * See the following URL for configuration information. - * https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html - * - *****************************************************************************/ +* +* See the following URL for configuration information. +* https://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_IP_Configuration.html +* +*****************************************************************************/ #ifndef FREERTOS_IP_CONFIG_H #define FREERTOS_IP_CONFIG_H /* 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, ... ); + * console before the network is connected then a UDP port after the network has + * connected. */ +extern void vLoggingPrintf( const char * pcFormatString, + ... ); /* Set to 1 to print out debug messages. If ipconfigHAS_DEBUG_PRINTF is set to -1 then FreeRTOS_debug_printf should be defined to the function used to print -out the debugging messages. */ -#define ipconfigHAS_DEBUG_PRINTF 1 -#if( ipconfigHAS_DEBUG_PRINTF == 1 ) - #define FreeRTOS_debug_printf(X) vLoggingPrintf X + * 1 then FreeRTOS_debug_printf should be defined to the function used to print + * out the debugging messages. */ +#define ipconfigHAS_DEBUG_PRINTF 1 +#if ( ipconfigHAS_DEBUG_PRINTF == 1 ) +#define FreeRTOS_debug_printf( X ) vLoggingPrintf X #endif /* Set to 1 to print out non debugging messages, for example the output of the -FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1 -then FreeRTOS_printf should be set to the function used to print out the -messages. */ -#define ipconfigHAS_PRINTF 1 -#if( ipconfigHAS_PRINTF == 1 ) - #define FreeRTOS_printf(X) vLoggingPrintf X + * FreeRTOS_netstat() command, and ping replies. If ipconfigHAS_PRINTF is set to 1 + * then FreeRTOS_printf should be set to the function used to print out the + * messages. */ +#define ipconfigHAS_PRINTF 1 +#if ( ipconfigHAS_PRINTF == 1 ) +#define FreeRTOS_printf( X ) vLoggingPrintf X #endif /* Define the byte order of the target MCU (the MCU FreeRTOS+TCP is executing -on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */ -#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN + * on). Valid options are pdFREERTOS_BIG_ENDIAN and pdFREERTOS_LITTLE_ENDIAN. */ +#define ipconfigBYTE_ORDER pdFREERTOS_LITTLE_ENDIAN /* If the network card/driver includes checksum offloading (IP/TCP/UDP checksums) -then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software -stack repeating the checksum calculations. */ -#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 + * then set ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM to 1 to prevent the software + * stack repeating the checksum calculations. */ +#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM 1 /* Several API's will block until the result is known, or the action has been -performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be -set per socket, using setsockopt(). If not set, the times below will be -used as defaults. */ -#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) -#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) + * performed, for example FreeRTOS_send() and FreeRTOS_recv(). The timeouts can be + * set per socket, using setsockopt(). If not set, the times below will be + * used as defaults. */ +#define ipconfigSOCK_DEFAULT_RECEIVE_BLOCK_TIME ( 5000 ) +#define ipconfigSOCK_DEFAULT_SEND_BLOCK_TIME ( 5000 ) /* Include support for LLMNR: Link-local Multicast Name Resolution -(non-Microsoft) */ -#define ipconfigUSE_LLMNR ( 1 ) + * (non-Microsoft) */ +#define ipconfigUSE_LLMNR ( 1 ) /* Include support for NBNS: NetBIOS Name Service (Microsoft) */ -#define ipconfigUSE_NBNS ( 1 ) +#define ipconfigUSE_NBNS ( 1 ) /* Include support for DNS caching. For TCP, having a small DNS cache is very -useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low -and also DNS may use small timeouts. If a DNS reply comes in after the DNS -socket has been destroyed, the result will be stored into the cache. The next -call to FreeRTOS_gethostbyname() will return immediately, without even creating -a socket. */ -#define ipconfigUSE_DNS_CACHE ( 1 ) -#define ipconfigDNS_CACHE_NAME_LENGTH ( 60 ) -#define ipconfigDNS_CACHE_ENTRIES ( 4 ) -#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) + * useful. When a cache is present, ipconfigDNS_REQUEST_ATTEMPTS can be kept low + * and also DNS may use small timeouts. If a DNS reply comes in after the DNS + * socket has been destroyed, the result will be stored into the cache. The next + * call to FreeRTOS_gethostbyname() will return immediately, without even creating + * a socket. */ +#define ipconfigUSE_DNS_CACHE ( 1 ) +#define ipconfigDNS_CACHE_NAME_LENGTH ( 60 ) +#define ipconfigDNS_CACHE_ENTRIES ( 4 ) +#define ipconfigDNS_REQUEST_ATTEMPTS ( 2 ) /* The IP stack executes it its own task (although any application task can make -use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY -sets the priority of the task that executes the IP stack. The priority is a -standard FreeRTOS task priority so can take any value from 0 (the lowest -priority) to (configMAX_PRIORITIES - 1) (the highest priority). -configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in -FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to -the priority assigned to the task executing the IP stack relative to the -priority assigned to tasks that use the IP stack. */ -#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) + * use of its services through the published sockets API). ipconfigUDP_TASK_PRIORITY + * sets the priority of the task that executes the IP stack. The priority is a + * standard FreeRTOS task priority so can take any value from 0 (the lowest + * priority) to (configMAX_PRIORITIES - 1) (the highest priority). + * configMAX_PRIORITIES is a standard FreeRTOS configuration parameter defined in + * FreeRTOSConfig.h, not FreeRTOSIPConfig.h. Consideration needs to be given as to + * the priority assigned to the task executing the IP stack relative to the + * priority assigned to tasks that use the IP stack. */ +#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 2 ) /* The size, in words (not bytes), of the stack allocated to the FreeRTOS+TCP -task. This setting is less important when the FreeRTOS Win32 simulator is used -as the Win32 simulator only stores a fixed amount of information on the task -stack. FreeRTOS includes optional stack overflow detection, see: -http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ -#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) + * task. This setting is less important when the FreeRTOS Win32 simulator is used + * as the Win32 simulator only stores a fixed amount of information on the task + * stack. FreeRTOS includes optional stack overflow detection, see: + * http://www.freertos.org/Stacks-and-stack-overflow-checking.html */ +#define ipconfigIP_TASK_STACK_SIZE_WORDS ( configMINIMAL_STACK_SIZE * 5 ) /* ipconfigRAND32() is called by the IP stack to generate random numbers for -things such as a DHCP transaction number or initial sequence number. Random -number generation is performed via this macro to allow applications to use their -own random number generation method. For example, it might be possible to -generate a random number by sampling noise on an analogue input. */ + * things such as a DHCP transaction number or initial sequence number. Random + * number generation is performed via this macro to allow applications to use their + * own random number generation method. For example, it might be possible to + * generate a random number by sampling noise on an analogue input. */ extern UBaseType_t uxRand(); -#define ipconfigRAND32() uxRand() +#define ipconfigRAND32() uxRand() /* If ipconfigUSE_NETWORK_EVENT_HOOK is set to 1 then FreeRTOS+TCP will call the -network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK -is not set to 1 then the network event hook will never be called. See -http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml -*/ -#define ipconfigUSE_NETWORK_EVENT_HOOK 1 + * network event hook at the appropriate times. If ipconfigUSE_NETWORK_EVENT_HOOK + * is not set to 1 then the network event hook will never be called. See + * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/API/vApplicationIPNetworkEventHook.shtml + */ +#define ipconfigUSE_NETWORK_EVENT_HOOK 1 /* Sockets have a send block time attribute. If FreeRTOS_sendto() is called but -a network buffer cannot be obtained then the calling task is held in the Blocked -state (so other tasks can continue to executed) until either a network buffer -becomes available or the send block time expires. If the send block time expires -then the send operation is aborted. The maximum allowable send block time is -capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the -maximum allowable send block time prevents prevents a deadlock occurring when -all the network buffers are in use and the tasks that process (and subsequently -free) the network buffers are themselves blocked waiting for a network buffer. -ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in -milliseconds can be converted to a time in ticks by dividing the time in -milliseconds by portTICK_PERIOD_MS. */ -#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) + * a network buffer cannot be obtained then the calling task is held in the Blocked + * state (so other tasks can continue to executed) until either a network buffer + * becomes available or the send block time expires. If the send block time expires + * then the send operation is aborted. The maximum allowable send block time is + * capped to the value set by ipconfigMAX_SEND_BLOCK_TIME_TICKS. Capping the + * maximum allowable send block time prevents prevents a deadlock occurring when + * all the network buffers are in use and the tasks that process (and subsequently + * free) the network buffers are themselves blocked waiting for a network buffer. + * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in + * milliseconds can be converted to a time in ticks by dividing the time in + * milliseconds by portTICK_PERIOD_MS. */ +#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS ) /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP -address, netmask, DNS server address and gateway address from a DHCP server. If -ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The -stack will revert to using the static IP address even when ipconfigUSE_DHCP is -set to 1 if a valid configuration cannot be obtained from a DHCP server for any -reason. The static configuration used is that passed into the stack by the -FreeRTOS_IPInit() function call. */ -#define ipconfigUSE_DHCP 1 + * address, netmask, DNS server address and gateway address from a DHCP server. If + * ipconfigUSE_DHCP is 0 then FreeRTOS+TCP will use a static IP address. The + * stack will revert to using the static IP address even when ipconfigUSE_DHCP is + * set to 1 if a valid configuration cannot be obtained from a DHCP server for any + * reason. The static configuration used is that passed into the stack by the + * FreeRTOS_IPInit() function call. */ +#define ipconfigUSE_DHCP 1 /* When ipconfigUSE_DHCP is set to 1, DHCP requests will be sent out at -increasing time intervals until either a reply is received from a DHCP server -and accepted, or the interval between transmissions reaches -ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the -static IP address passed as a parameter to FreeRTOS_IPInit() if the -re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without -a DHCP reply being received. */ -#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS ) + * increasing time intervals until either a reply is received from a DHCP server + * and accepted, or the interval between transmissions reaches + * ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the + * static IP address passed as a parameter to FreeRTOS_IPInit() if the + * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without + * a DHCP reply being received. */ +#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS ) /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP -stack can only send a UDP message to a remove IP address if it knowns the MAC -address associated with the IP address, or the MAC address of the router used to -contact the remote IP address. When a UDP message is received from a remote IP -address the MAC address and IP address are added to the ARP cache. When a UDP -message is sent to a remote IP address that does not already appear in the ARP -cache then the UDP message is replaced by a ARP message that solicits the -required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum -number of entries that can exist in the ARP table at any one time. */ -#define ipconfigARP_CACHE_ENTRIES 6 + * stack can only send a UDP message to a remove IP address if it knowns the MAC + * address associated with the IP address, or the MAC address of the router used to + * contact the remote IP address. When a UDP message is received from a remote IP + * address the MAC address and IP address are added to the ARP cache. When a UDP + * message is sent to a remote IP address that does not already appear in the ARP + * cache then the UDP message is replaced by a ARP message that solicits the + * required MAC address information. ipconfigARP_CACHE_ENTRIES defines the maximum + * number of entries that can exist in the ARP table at any one time. */ +#define ipconfigARP_CACHE_ENTRIES 6 /* ARP requests that do not result in an ARP response will be re-transmitted a -maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is -aborted. */ -#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) + * maximum of ipconfigMAX_ARP_RETRANSMISSIONS times before the ARP request is + * aborted. */ +#define ipconfigMAX_ARP_RETRANSMISSIONS ( 5 ) /* ipconfigMAX_ARP_AGE defines the maximum time between an entry in the ARP -table being created or refreshed and the entry being removed because it is stale. -New ARP requests are sent for ARP cache entries that are nearing their maximum -age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is -equal to 1500 seconds (or 25 minutes). */ -#define ipconfigMAX_ARP_AGE 150 + * table being created or refreshed and the entry being removed because it is stale. + * New ARP requests are sent for ARP cache entries that are nearing their maximum + * age. ipconfigMAX_ARP_AGE is specified in tens of seconds, so a value of 150 is + * equal to 1500 seconds (or 25 minutes). */ +#define ipconfigMAX_ARP_AGE 150 /* Implementing FreeRTOS_inet_addr() necessitates the use of string handling -routines, which are relatively large. To save code space the full -FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster -alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr() -takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter. -FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets -(for example, 192, 168, 0, 1) as its parameters. If -ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and -FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is -not set to 1 then only FreeRTOS_indet_addr_quick() is available. */ -#define ipconfigINCLUDE_FULL_INET_ADDR 1 + * routines, which are relatively large. To save code space the full + * FreeRTOS_inet_addr() implementation is made optional, and a smaller and faster + * alternative called FreeRTOS_inet_addr_quick() is provided. FreeRTOS_inet_addr() + * takes an IP in decimal dot format (for example, "192.168.0.1") as its parameter. + * FreeRTOS_inet_addr_quick() takes an IP address as four separate numerical octets + * (for example, 192, 168, 0, 1) as its parameters. If + * ipconfigINCLUDE_FULL_INET_ADDR is set to 1 then both FreeRTOS_inet_addr() and + * FreeRTOS_indet_addr_quick() are available. If ipconfigINCLUDE_FULL_INET_ADDR is + * not set to 1 then only FreeRTOS_indet_addr_quick() is available. */ +#define ipconfigINCLUDE_FULL_INET_ADDR 1 /* ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS defines the total number of network buffer that -are available to the IP stack. The total number of network buffers is limited -to ensure the total amount of RAM that can be consumed by the IP stack is capped -to a pre-determinable value. */ -#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 25 + * are available to the IP stack. The total number of network buffers is limited + * to ensure the total amount of RAM that can be consumed by the IP stack is capped + * to a pre-determinable value. */ +#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS 25 /* A FreeRTOS queue is used to send events from application tasks to the IP -stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can -be queued for processing at any one time. The event queue must be a minimum of -5 greater than the total number of network buffers. */ -#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 ) + * stack. ipconfigEVENT_QUEUE_LENGTH sets the maximum number of events that can + * be queued for processing at any one time. The event queue must be a minimum of + * 5 greater than the total number of network buffers. */ +#define ipconfigEVENT_QUEUE_LENGTH ( ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS + 5 ) /* The address of a socket is the combination of its IP address and its port -number. FreeRTOS_bind() is used to manually allocate a port number to a socket -(to 'bind' the socket to a port), but manual binding is not normally necessary -for client sockets (those sockets that initiate outgoing connections rather than -wait for incoming connections on a known port number). If -ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling -FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP -stack automatically binding the socket to a port number from the range -socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If -ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto() -on a socket that has not yet been bound will result in the send operation being -aborted. */ -#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1 + * number. FreeRTOS_bind() is used to manually allocate a port number to a socket + * (to 'bind' the socket to a port), but manual binding is not normally necessary + * for client sockets (those sockets that initiate outgoing connections rather than + * wait for incoming connections on a known port number). If + * ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 1 then calling + * FreeRTOS_sendto() on a socket that has not yet been bound will result in the IP + * stack automatically binding the socket to a port number from the range + * socketAUTO_PORT_ALLOCATION_START_NUMBER to 0xffff. If + * ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND is set to 0 then calling FreeRTOS_sendto() + * on a socket that has not yet been bound will result in the send operation being + * aborted. */ +#define ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND 1 /* Defines the Time To Live (TTL) values used in outgoing UDP packets. */ -#define ipconfigUDP_TIME_TO_LIVE 128 -#define ipconfigTCP_TIME_TO_LIVE 128 /* also defined in FreeRTOSIPConfigDefaults.h */ +#define ipconfigUDP_TIME_TO_LIVE 128 +#define ipconfigTCP_TIME_TO_LIVE 128 /* also defined in FreeRTOSIPConfigDefaults.h */ /* USE_TCP: Use TCP and all its features */ -#define ipconfigUSE_TCP ( 1 ) +#define ipconfigUSE_TCP ( 1 ) /* USE_WIN: Let TCP use windowing mechanism. */ -#define ipconfigUSE_TCP_WIN ( 1 ) +#define ipconfigUSE_TCP_WIN ( 1 ) /* The MTU is the maximum number of bytes the payload of a network frame can -contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a -lower value can save RAM, depending on the buffer management scheme used. If -ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must -be divisible by 8. */ -#define ipconfigNETWORK_MTU 1500U + * contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a + * lower value can save RAM, depending on the buffer management scheme used. If + * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must + * be divisible by 8. */ +#define ipconfigNETWORK_MTU 1500U /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used -through the FreeRTOS_gethostbyname() API function. */ -#define ipconfigUSE_DNS 1 + * through the FreeRTOS_gethostbyname() API function. */ +#define ipconfigUSE_DNS 1 /* If ipconfigREPLY_TO_INCOMING_PINGS is set to 1 then the IP stack will -generate replies to incoming ICMP echo (ping) requests. */ -#define ipconfigREPLY_TO_INCOMING_PINGS 1 + * generate replies to incoming ICMP echo (ping) requests. */ +#define ipconfigREPLY_TO_INCOMING_PINGS 1 /* If ipconfigSUPPORT_OUTGOING_PINGS is set to 1 then the -FreeRTOS_SendPingRequest() API function is available. */ -#define ipconfigSUPPORT_OUTGOING_PINGS 1 + * FreeRTOS_SendPingRequest() API function is available. */ +#define ipconfigSUPPORT_OUTGOING_PINGS 1 /* If ipconfigSUPPORT_SELECT_FUNCTION is set to 1 then the FreeRTOS_select() -(and associated) API function is available. */ -#define ipconfigSUPPORT_SELECT_FUNCTION 1 + * (and associated) API function is available. */ +#define ipconfigSUPPORT_SELECT_FUNCTION 1 /* If ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES is set to 1 then Ethernet frames -that are not in Ethernet II format will be dropped. This option is included for -potential future IP stack developments. */ -#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1 + * that are not in Ethernet II format will be dropped. This option is included for + * potential future IP stack developments. */ +#define ipconfigFILTER_OUT_NON_ETHERNET_II_FRAMES 1 /* If ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES is set to 1 then it is the -responsibility of the Ethernet interface to filter out packets that are of no -interest. If the Ethernet interface does not implement this functionality, then -set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack -perform the filtering instead (it is much less efficient for the stack to do it -because the packet will already have been passed into the stack). If the -Ethernet driver does all the necessary filtering in hardware then software -filtering can be removed by using a value other than 1 or 0. */ -#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1 + * responsibility of the Ethernet interface to filter out packets that are of no + * interest. If the Ethernet interface does not implement this functionality, then + * set ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES to 0 to have the IP stack + * perform the filtering instead (it is much less efficient for the stack to do it + * because the packet will already have been passed into the stack). If the + * Ethernet driver does all the necessary filtering in hardware then software + * filtering can be removed by using a value other than 1 or 0. */ +#define ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES 1 /* The windows simulator cannot really simulate MAC interrupts, and needs to -block occasionally to allow other tasks to run. */ -#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS ) + * block occasionally to allow other tasks to run. */ +#define configWINDOWS_MAC_INTERRUPT_SIMULATOR_DELAY ( 20 / portTICK_PERIOD_MS ) /* Advanced only: in order to access 32-bit fields in the IP packets with -32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits. -This has to do with the contents of the IP-packets: all 32-bit fields are -32-bit-aligned, plus 16-bit(!) */ -#define ipconfigPACKET_FILLER_SIZE 2U + * 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits. + * This has to do with the contents of the IP-packets: all 32-bit fields are + * 32-bit-aligned, plus 16-bit(!) */ +#define ipconfigPACKET_FILLER_SIZE 2U /* Define the size of the pool of TCP window descriptors. On the average, each -TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 -outstanding packets (for Rx and Tx). When using up to 10 TP sockets -simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */ -#define ipconfigTCP_WIN_SEG_COUNT 240 + * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 + * outstanding packets (for Rx and Tx). When using up to 10 TP sockets + * simultaneously, one could define TCP_WIN_SEG_COUNT as 120. */ +#define ipconfigTCP_WIN_SEG_COUNT 240 /* Each TCP socket has a circular buffers for Rx and Tx, which have a fixed -maximum size. Define the size of Rx buffer for TCP sockets. */ -#define ipconfigTCP_RX_BUFFER_LENGTH ( 1000 ) + * maximum size. Define the size of Rx buffer for TCP sockets. */ +#define ipconfigTCP_RX_BUFFER_LENGTH ( 1000 ) /* Define the size of Tx buffer for TCP sockets. */ -#define ipconfigTCP_TX_BUFFER_LENGTH ( 1000 ) +#define ipconfigTCP_TX_BUFFER_LENGTH ( 1000 ) /* When using call-back handlers, the driver may check if the handler points to -real program memory (RAM or flash) or just has a random non-zero value. */ -#define ipconfigIS_VALID_PROG_ADDRESS(x) ( (x) != NULL ) + * real program memory (RAM or flash) or just has a random non-zero value. */ +#define ipconfigIS_VALID_PROG_ADDRESS( x ) ( ( x ) != NULL ) /* Include support for TCP hang protection. All sockets in a connecting or -disconnecting stage will timeout after a period of non-activity. */ -#define ipconfigTCP_HANG_PROTECTION ( 1 ) -#define ipconfigTCP_HANG_PROTECTION_TIME ( 30 ) + * disconnecting stage will timeout after a period of non-activity. */ +#define ipconfigTCP_HANG_PROTECTION ( 1 ) +#define ipconfigTCP_HANG_PROTECTION_TIME ( 30 ) /* Include support for TCP keep-alive messages. */ -#define ipconfigTCP_KEEP_ALIVE ( 1 ) -#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* in seconds */ +#define ipconfigTCP_KEEP_ALIVE ( 1 ) +#define ipconfigTCP_KEEP_ALIVE_INTERVAL ( 20 ) /* in seconds */ -#define ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS ( 1 ) +#define ipconfigUDP_PASS_ZERO_CHECKSUM_PACKETS ( 1 ) -#define portINLINE __inline +#define portINLINE __inline #endif /* FREERTOS_IP_CONFIG_H */ diff --git a/examples/evkbmimxrt1060/pubsub/include/demo_config.h b/examples/evkbmimxrt1060/pubsub/include/demo_config.h index 40daeab..8417570 100644 --- a/examples/evkbmimxrt1060/pubsub/include/demo_config.h +++ b/examples/evkbmimxrt1060/pubsub/include/demo_config.h @@ -87,7 +87,7 @@ * * #define democonfigMQTT_BROKER_ENDPOINT "...insert here..." */ -#define democonfigMQTT_BROKER_ENDPOINT "192.168.1.2" //"aesqkxqeyrs5g-ats.iot.us-west-2.amazonaws.com" +#define democonfigMQTT_BROKER_ENDPOINT "192.168.1.2" /*"aesqkxqeyrs5g-ats.iot.us-west-2.amazonaws.com" */ /** * @brief The port to use for the demo. diff --git a/examples/evkbmimxrt1060/pubsub/include/tcp_sockets_wrapper.h b/examples/evkbmimxrt1060/pubsub/include/tcp_sockets_wrapper.h index 2d4072b..3b9bdbe 100644 --- a/examples/evkbmimxrt1060/pubsub/include/tcp_sockets_wrapper.h +++ b/examples/evkbmimxrt1060/pubsub/include/tcp_sockets_wrapper.h @@ -54,8 +54,8 @@ #define TCP_SOCKETS_ERRNO_EINTR ( -11 ) /*!< Interrupted system call */ #ifndef SOCKET_T_TYPEDEFED - struct xSOCKET; - typedef struct xSOCKET * Socket_t; /**< @brief Socket handle data type. */ +struct xSOCKET; +typedef struct xSOCKET * Socket_t; /**< @brief Socket handle data type. */ #endif /** diff --git a/examples/evkbmimxrt1060/pubsub/main.c b/examples/evkbmimxrt1060/pubsub/main.c index b24cc4d..d6bf832 100644 --- a/examples/evkbmimxrt1060/pubsub/main.c +++ b/examples/evkbmimxrt1060/pubsub/main.c @@ -124,15 +124,15 @@ static mflash_file_t dir_template[] = ******************************************************************************/ void Board_InitNetwork( void ) { - BaseType_t xResult; + BaseType_t xResult; - xResult = FreeRTOS_IPInit( ucIPAddress, - ucNetMask, - ucGatewayAddress, - ucDNSServerAddress, - ucMACAddress ); + xResult = FreeRTOS_IPInit( ucIPAddress, + ucNetMask, + ucGatewayAddress, + ucDNSServerAddress, + ucMACAddress ); - assert( xResult == pdPASS ); + assert( xResult == pdPASS ); } void BOARD_InitModuleClock( void ) @@ -350,66 +350,67 @@ void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber ) { - *pulNumber = 0x1234; - return pdTRUE; + *pulNumber = 0x1234; + return pdTRUE; } BaseType_t xApplicationDNSQueryHook( const char * pcName ) { - return pdFALSE; + return pdFALSE; } void pvPingTask( void * arg ) { - uint32_t ipADDR_DST; - FreeRTOS_inet_pton( FREERTOS_AF_INET, "192.168.0.2", &ipADDR_DST ); - static uint16_t i = 0; + uint32_t ipADDR_DST; - ( void ) arg; - while( 1 ) - { - FreeRTOS_OutputARPRequest( ipADDR_DST ); + FreeRTOS_inet_pton( FREERTOS_AF_INET, "192.168.0.2", &ipADDR_DST ); + static uint16_t i = 0; - FreeRTOS_SendPingRequest( ipADDR_DST, 20, 20 ); - configPRINTF(("Sent %u", i++ )); + ( void ) arg; - vTaskDelay( pdMS_TO_TICKS( 500 ) ); - } + while( 1 ) + { + FreeRTOS_OutputARPRequest( ipADDR_DST ); + + FreeRTOS_SendPingRequest( ipADDR_DST, 20, 20 ); + configPRINTF( ( "Sent %u", i++ ) ); + + vTaskDelay( pdMS_TO_TICKS( 500 ) ); + } } void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent ) { - static BaseType_t xTasksStarted = pdFALSE; + static BaseType_t xTasksStarted = pdFALSE; - if( ( eNetworkEvent == eNetworkUp ) && ( xTasksStarted != pdTRUE ) ) - { - xTasksStarted = pdTRUE; + if( ( eNetworkEvent == eNetworkUp ) && ( xTasksStarted != pdTRUE ) ) + { + xTasksStarted = pdTRUE; #if 0 - xTaskCreate( pvPingTask, - "PingTask", - configMINIMAL_STACK_SIZE * 4, - NULL, - tskIDLE_PRIORITY, - NULL ); - + xTaskCreate( pvPingTask, + "PingTask", + configMINIMAL_STACK_SIZE * 4, + NULL, + tskIDLE_PRIORITY, + NULL ); #else - if( app_main() != pdPASS ) - { - PRINTF( "\r\nApp main initialization failed.\r\n" ); - - for( ; ; ) - { - __asm( "NOP" ); - } - } -#endif - } + if( app_main() != pdPASS ) + { + PRINTF( "\r\nApp main initialization failed.\r\n" ); + + for( ; ; ) + { + __asm( "NOP" ); + } + } +#endif /* if 0 */ + } } void vApplicationPingReplyHook( ePingReplyStatus_t eStatus, - uint16_t usIdentifier ) + uint16_t usIdentifier ) { - /* Do nothing */ + /* Do nothing */ } uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress, @@ -417,5 +418,5 @@ uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress, uint32_t ulDestinationAddress, uint16_t usDestinationPort ) { - return ( ( ulSourceAddress | usSourcePort | ulDestinationAddress | usDestinationPort ) & 0xFF ); + return( ( ulSourceAddress | usSourcePort | ulDestinationAddress | usDestinationPort ) & 0xFF ); } diff --git a/examples/evkbmimxrt1060/pubsub/tcp_sockets_wrapper.c b/examples/evkbmimxrt1060/pubsub/tcp_sockets_wrapper.c index 33ab8a1..20f9344 100644 --- a/examples/evkbmimxrt1060/pubsub/tcp_sockets_wrapper.c +++ b/examples/evkbmimxrt1060/pubsub/tcp_sockets_wrapper.c @@ -34,10 +34,10 @@ /* Logging configuration for the Sockets. */ #ifndef LIBRARY_LOG_NAME - #define LIBRARY_LOG_NAME "SocketsWrapper" +#define LIBRARY_LOG_NAME "SocketsWrapper" #endif #ifndef LIBRARY_LOG_LEVEL - #define LIBRARY_LOG_LEVEL LOG_INFO +#define LIBRARY_LOG_LEVEL LOG_INFO #endif extern void vLoggingPrintf( const char * pcFormatString, @@ -65,7 +65,7 @@ extern void vLoggingPrintf( const char * pcFormatString, * @brief Maximum number of times to call FreeRTOS_recv when initiating a graceful shutdown. */ #ifndef FREERTOS_SOCKETS_WRAPPER_SHUTDOWN_LOOPS - #define FREERTOS_SOCKETS_WRAPPER_SHUTDOWN_LOOPS ( 3 ) +#define FREERTOS_SOCKETS_WRAPPER_SHUTDOWN_LOOPS ( 3 ) #endif /** diff --git a/examples/evkbmimxrt1060/sesip/Demo.ld b/examples/evkbmimxrt1060/sesip/Demo.ld index 9897945..3f474e9 100644 --- a/examples/evkbmimxrt1060/sesip/Demo.ld +++ b/examples/evkbmimxrt1060/sesip/Demo.ld @@ -12,36 +12,36 @@ MEMORY { /* Define each memory region */ - BOARD_FLASH (rx) : ORIGIN = 0x60040400, LENGTH = 0x1ffc00 /* 2047K bytes (alias Flash) */ - SRAM_DTC (rwx) : ORIGIN = 0x20000000, LENGTH = 0x20000 /* 128K bytes (alias RAM) */ - SRAM_ITC (rwx) : ORIGIN = 0x0, LENGTH = 0x20000 /* 128K bytes (alias RAM2) */ - SRAM_OC (rwx) : ORIGIN = 0x20200000, LENGTH = 0xc0000 /* 768K bytes (alias RAM3) */ - BOARD_SDRAM (rwx) : ORIGIN = 0x80000000, LENGTH = 0x1e00000 /* 30M bytes (alias RAM4) */ - NCACHE_REGION (rwx) : ORIGIN = 0x81e00000, LENGTH = 0x200000 /* 2M bytes (alias RAM5) */ + BOARD_FLASH (rx) : ORIGIN = 0x60040400, LENGTH = 0x1ffc00 /* 2047K bytes (alias Flash) */ + SRAM_DTC (rwx) : ORIGIN = 0x20000000, LENGTH = 0x20000 /* 128K bytes (alias RAM) */ + SRAM_ITC (rwx) : ORIGIN = 0x0, LENGTH = 0x20000 /* 128K bytes (alias RAM2) */ + SRAM_OC (rwx) : ORIGIN = 0x20200000, LENGTH = 0xc0000 /* 768K bytes (alias RAM3) */ + BOARD_SDRAM (rwx) : ORIGIN = 0x80000000, LENGTH = 0x1e00000 /* 30M bytes (alias RAM4) */ + NCACHE_REGION (rwx) : ORIGIN = 0x81e00000, LENGTH = 0x200000 /* 2M bytes (alias RAM5) */ } /* Define a symbol for the top of each memory region */ - __base_BOARD_FLASH = 0x60040400 ; /* BOARD_FLASH */ - __base_Flash = 0x60040400 ; /* Flash */ - __top_BOARD_FLASH = 0x60040400 + 0x1ffc00 ; /* 2047K bytes */ - __top_Flash = 0x60040400 + 0x1ffc00 ; /* 2047K bytes */ - __base_SRAM_DTC = 0x20000000 ; /* SRAM_DTC */ - __base_RAM = 0x20000000 ; /* RAM */ - __top_SRAM_DTC = 0x20000000 + 0x20000 ; /* 128K bytes */ - __top_RAM = 0x20000000 + 0x20000 ; /* 128K bytes */ - __base_SRAM_ITC = 0x0 ; /* SRAM_ITC */ - __base_RAM2 = 0x0 ; /* RAM2 */ - __top_SRAM_ITC = 0x0 + 0x20000 ; /* 128K bytes */ - __top_RAM2 = 0x0 + 0x20000 ; /* 128K bytes */ - __base_SRAM_OC = 0x20200000 ; /* SRAM_OC */ - __base_RAM3 = 0x20200000 ; /* RAM3 */ - __top_SRAM_OC = 0x20200000 + 0xc0000 ; /* 768K bytes */ - __top_RAM3 = 0x20200000 + 0xc0000 ; /* 768K bytes */ - __base_BOARD_SDRAM = 0x80000000 ; /* BOARD_SDRAM */ - __base_RAM4 = 0x80000000 ; /* RAM4 */ - __top_BOARD_SDRAM = 0x80000000 + 0x1e00000 ; /* 30M bytes */ - __top_RAM4 = 0x80000000 + 0x1e00000 ; /* 30M bytes */ - __base_NCACHE_REGION = 0x81e00000 ; /* NCACHE_REGION */ - __base_RAM5 = 0x81e00000 ; /* RAM5 */ - __top_NCACHE_REGION = 0x81e00000 + 0x200000 ; /* 2M bytes */ - __top_RAM5 = 0x81e00000 + 0x200000 ; /* 2M bytes */ + __base_BOARD_FLASH = 0x60040400 ; /* BOARD_FLASH */ + __base_Flash = 0x60040400 ; /* Flash */ + __top_BOARD_FLASH = 0x60040400 + 0x1ffc00 ; /* 2047K bytes */ + __top_Flash = 0x60040400 + 0x1ffc00 ; /* 2047K bytes */ + __base_SRAM_DTC = 0x20000000 ; /* SRAM_DTC */ + __base_RAM = 0x20000000 ; /* RAM */ + __top_SRAM_DTC = 0x20000000 + 0x20000 ; /* 128K bytes */ + __top_RAM = 0x20000000 + 0x20000 ; /* 128K bytes */ + __base_SRAM_ITC = 0x0 ; /* SRAM_ITC */ + __base_RAM2 = 0x0 ; /* RAM2 */ + __top_SRAM_ITC = 0x0 + 0x20000 ; /* 128K bytes */ + __top_RAM2 = 0x0 + 0x20000 ; /* 128K bytes */ + __base_SRAM_OC = 0x20200000 ; /* SRAM_OC */ + __base_RAM3 = 0x20200000 ; /* RAM3 */ + __top_SRAM_OC = 0x20200000 + 0xc0000 ; /* 768K bytes */ + __top_RAM3 = 0x20200000 + 0xc0000 ; /* 768K bytes */ + __base_BOARD_SDRAM = 0x80000000 ; /* BOARD_SDRAM */ + __base_RAM4 = 0x80000000 ; /* RAM4 */ + __top_BOARD_SDRAM = 0x80000000 + 0x1e00000 ; /* 30M bytes */ + __top_RAM4 = 0x80000000 + 0x1e00000 ; /* 30M bytes */ + __base_NCACHE_REGION = 0x81e00000 ; /* NCACHE_REGION */ + __base_RAM5 = 0x81e00000 ; /* RAM5 */ + __top_NCACHE_REGION = 0x81e00000 + 0x200000 ; /* 2M bytes */ + __top_RAM5 = 0x81e00000 + 0x200000 ; /* 2M bytes */ diff --git a/examples/evkbmimxrt1060/sesip/include/FreeRTOSConfig.h b/examples/evkbmimxrt1060/sesip/include/FreeRTOSConfig.h index eabd876..83c4ac2 100644 --- a/examples/evkbmimxrt1060/sesip/include/FreeRTOSConfig.h +++ b/examples/evkbmimxrt1060/sesip/include/FreeRTOSConfig.h @@ -49,62 +49,62 @@ extern void vLoggingPrintf( const char * pcFormat, #endif -#define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 0 -#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 0 -#define configTOTAL_MPU_REGIONS 16 - -#define configSUPPORT_STATIC_ALLOCATION 1 - -#define configUSE_PREEMPTION 1 -#define configUSE_IDLE_HOOK 0 -#define configUSE_TICK_HOOK 0 -#define configUSE_TICKLESS_IDLE 0 -#define configUSE_DAEMON_TASK_STARTUP_HOOK 1 -#define configCPU_CLOCK_HZ ( SystemCoreClock ) -#define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) -#define configMAX_PRIORITIES ( 9 ) -#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 90 ) -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 80 * 1024 ) ) /* 100 Kbytes. */ -#define configMAX_TASK_NAME_LEN ( 16 ) -#define configUSE_TRACE_FACILITY 1 -#define configUSE_16_BIT_TICKS 0 -#define configIDLE_SHOULD_YIELD 1 -#define configUSE_MUTEXES 1 -#define configQUEUE_REGISTRY_SIZE 8 -#define configCHECK_FOR_STACK_OVERFLOW 2 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_MALLOC_FAILED_HOOK 1 -#define configUSE_APPLICATION_TASK_TAG 0 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configGENERATE_RUN_TIME_STATS 0 -#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 0 -#define configRECORD_STACK_HIGH_ADDRESS 1 +#define configALLOW_UNPRIVILEGED_CRITICAL_SECTIONS 0 +#define configENFORCE_SYSTEM_CALLS_FROM_KERNEL_ONLY 0 +#define configTOTAL_MPU_REGIONS 16 + +#define configSUPPORT_STATIC_ALLOCATION 1 + +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 0 +#define configUSE_TICK_HOOK 0 +#define configUSE_TICKLESS_IDLE 0 +#define configUSE_DAEMON_TASK_STARTUP_HOOK 1 +#define configCPU_CLOCK_HZ ( SystemCoreClock ) +#define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) +#define configMAX_PRIORITIES ( 9 ) +#define configMINIMAL_STACK_SIZE ( ( uint16_t ) 90 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 80 * 1024 ) ) /* 100 Kbytes. */ +#define configMAX_TASK_NAME_LEN ( 16 ) +#define configUSE_TRACE_FACILITY 1 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 8 +#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_MALLOC_FAILED_HOOK 1 +#define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configGENERATE_RUN_TIME_STATS 0 +#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 0 +#define configRECORD_STACK_HIGH_ADDRESS 1 /* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 -#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) /* Software timer definitions. */ -#define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 3 ) -#define configTIMER_QUEUE_LENGTH 10 -#define configTIMER_TASK_STACK_DEPTH ( 4096 ) +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 3 ) +#define configTIMER_QUEUE_LENGTH 10 +#define configTIMER_TASK_STACK_DEPTH ( 4096 ) -#define configCOMMAND_INT_MAX_OUTPUT_SIZE ( 512 ) +#define configCOMMAND_INT_MAX_OUTPUT_SIZE ( 512 ) /* Set the following definitions to 1 to include the API function, or zero * to exclude the API function. */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 0 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xTimerPendFunctionCall 1 -#define INCLUDE_xSemaphoreGetMutexHolder 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 1 +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_xSemaphoreGetMutexHolder 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 /* Normal assert() semantics without relying on the provision of an assert.h diff --git a/examples/evkbmimxrt1060/sesip/log.log b/examples/evkbmimxrt1060/sesip/log.log deleted file mode 100644 index 24a0c1c..0000000 --- a/examples/evkbmimxrt1060/sesip/log.log +++ /dev/null @@ -1,12 +0,0 @@ -12:47:53 **** Incremental Build of configuration Debug for project bootloader **** -make -r -j8 all -make[1]: Nothing to be done for 'main-build'. -Performing post-build steps -arm-none-eabi-size "bootloader.axf" ; arm-none-eabi-objcopy -v -O binary "bootloader.axf" "bootloader.bin" ; # checksum -p MIMXRT1062xxxxA -d "bootloader.bin" - text data bss dec hex filename - 54900 548 30948 86396 1517c bootloader.axf -copy from `bootloader.axf' [elf32-littlearm] to `bootloader.bin' [binary] - - -12:47:54 Build Finished. 0 errors, 0 warnings. (took 1s.8ms) - diff --git a/examples/evkbmimxrt1060/sesip/main.c b/examples/evkbmimxrt1060/sesip/main.c index a074ff1..7100bae 100644 --- a/examples/evkbmimxrt1060/sesip/main.c +++ b/examples/evkbmimxrt1060/sesip/main.c @@ -42,7 +42,7 @@ #include "nxLog_App.h" #include "mflash_drv.h" -//#include "ex_sss_boot.h" +/*#include "ex_sss_boot.h" */ #include "mflash_file.h" @@ -128,7 +128,7 @@ int main( void ) */ void vApplicationDaemonTaskStartupHook( void ) { - /* Create read-only and a read-write task. */ + /* Create read-only and a read-write task. */ xCreateRestrictedTasks( hello_task_PRIORITY ); /* Print the memory regions once. */ diff --git a/examples/evkbmimxrt1060/sesip/memfault_handler.c b/examples/evkbmimxrt1060/sesip/memfault_handler.c index f38e039..fdcb861 100644 --- a/examples/evkbmimxrt1060/sesip/memfault_handler.c +++ b/examples/evkbmimxrt1060/sesip/memfault_handler.c @@ -25,16 +25,16 @@ * 1 tab == 4 spaces! */ - /** - * @brief File shows a sample implementation of memory fault handler. - */ +/** + * @brief File shows a sample implementation of memory fault handler. + */ - /** - * @brief Memory fault handler invoked by the MPU unit for illegal access to a previleged memory. - * This overrides the default platform MemManage_Handler and calls the demo defined hard fault - * handler in user/demo_restrictions.c file. - */ -void MemManage_Handler(void) __attribute__((naked)); +/** + * @brief Memory fault handler invoked by the MPU unit for illegal access to a previleged memory. + * This overrides the default platform MemManage_Handler and calls the demo defined hard fault + * handler in user/demo_restrictions.c file. + */ +void MemManage_Handler( void ) __attribute__( ( naked ) ); /*-----------------------------------------------------------*/ #include "FreeRTOS.h" extern void vHandleMemoryFault( uint32_t * pulFaultStackAddress ); @@ -44,7 +44,7 @@ extern void vHandleMemoryFault( uint32_t * pulFaultStackAddress ); * The handler jumps to vHandleMemoryFault function to actually * handle the fault. */ -void MemManage_Handler(void) +void MemManage_Handler( void ) { __asm volatile ( @@ -55,8 +55,8 @@ void MemManage_Handler(void) " ldr r1, .handler_address_const \n" " bx r1 \n" " \n" - " .ALIGN 4 \n" + " .ALIGN 4 \n" " .handler_address_const: .word vHandleMemoryFault \n" - ); + ); } /*-----------------------------------------------------------*/ diff --git a/examples/evkbmimxrt1060/sesip/task/demo_restricted_task.c b/examples/evkbmimxrt1060/sesip/task/demo_restricted_task.c index 5824ea3..0786df9 100644 --- a/examples/evkbmimxrt1060/sesip/task/demo_restricted_task.c +++ b/examples/evkbmimxrt1060/sesip/task/demo_restricted_task.c @@ -71,11 +71,11 @@ * @brief Macro to override printf funtion to run it in privileged mode. * NXP PRINTF code resides somewhere in RAM that could be provided as accessible region, but it's simpler to * just run it as privileged */ -#define MPU_PRINTF( ... ) \ - { \ - portRAISE_PRIVILEGE(); \ - PRINTF( __VA_ARGS__ ); \ - portRESET_PRIVILEGE(); \ +#define MPU_PRINTF( ... ) \ + { \ + portRAISE_PRIVILEGE(); \ + PRINTF( __VA_ARGS__ ); \ + portRESET_PRIVILEGE(); \ } /* For readability. Read about Hardfault Entry in ARMv7 docs for more details */ @@ -246,25 +246,25 @@ static void prvROAccessTask( void * pvParameters ) /* Silent compiler warnings about unused variables. */ ( void ) ucVal; - #if ( INJECT_TEST_MEMORY_FAULT == 1 ) - ucROTaskFaultTracker[ 0 ] = 1; - - MPU_PRINTF( "Triggering memory violation...\r\n" ); - - /* Illegal access to generate Memory Fault. */ - ucSharedMemory[ 0 ] = 0; - - /* Ensure that the above line did generate MemFault and the fault - * handler did clear the ucROTaskFaultTracker[ 0 ]. */ - if( ucROTaskFaultTracker[ 0 ] == 0 ) - { - MPU_PRINTF( "Access Violation handled.\r\n" ); - } - else - { - MPU_PRINTF( "Error: Access violation should have triggered a fault\r\n" ); - } - #endif /* ifdef INJECT_TEST_MEMORY_FAULT */ +#if ( INJECT_TEST_MEMORY_FAULT == 1 ) + ucROTaskFaultTracker[ 0 ] = 1; + + MPU_PRINTF( "Triggering memory violation...\r\n" ); + + /* Illegal access to generate Memory Fault. */ + ucSharedMemory[ 0 ] = 0; + + /* Ensure that the above line did generate MemFault and the fault + * handler did clear the ucROTaskFaultTracker[ 0 ]. */ + if( ucROTaskFaultTracker[ 0 ] == 0 ) + { + MPU_PRINTF( "Access Violation handled.\r\n" ); + } + else + { + MPU_PRINTF( "Error: Access violation should have triggered a fault\r\n" ); + } +#endif /* ifdef INJECT_TEST_MEMORY_FAULT */ MPU_PRINTF( "Ran RO task\r\n" ); vTaskDelay( pdMS_TO_TICKS( 500 ) ); @@ -317,6 +317,7 @@ void xCreateRestrictedTasks( BaseType_t xPriority ) /*{ 0x20000500, 0x100, portMPU_REGION_READ_WRITE }, */ } }; + xTaskCreateRestricted( &( xROAccessTaskParameters ), NULL ); } diff --git a/projects/evkmimxrt1060/sesip/Demo.ld b/projects/evkmimxrt1060/sesip/Demo.ld index e258d77..d7e40c6 100644 --- a/projects/evkmimxrt1060/sesip/Demo.ld +++ b/projects/evkmimxrt1060/sesip/Demo.ld @@ -34,34 +34,34 @@ MEMORY SRAM_ITC (rwx) : ORIGIN = 0x0, LENGTH = 0x20000 /* 128K bytes (alias RAM2) == ITCM */ SRAM_OC_512 (rwx) : ORIGIN = 0x20200000, LENGTH = 0x80000 /* 512k bytes (alias RAM3) == OCRAM-FleRAM + OCRAM2. Max of 1M. */ SRAM_OC_REM (rwx) : ORIGIN = 0x20280000, LENGTH = 0x40000 - BOARD_SDRAM (rwx) : ORIGIN = 0x80000000, LENGTH = 0x1e00000 /* 30M bytes (alias RAM4) == SDRAM: Can be 32MB at max. */ + BOARD_SDRAM (rwx) : ORIGIN = 0x80000000, LENGTH = 0x1e00000 /* 30M bytes (alias RAM4) == SDRAM: Can be 32MB at max. */ NCACHE_REGION (rwx) : ORIGIN = 0x81e00000, LENGTH = 0x200000 /* 2M bytes (alias RAM5) == SEMC external memories (SDRAM, NOR, PSRAM, NAND and 8080) shared memory space */ } /* Define a symbol for the top of each memory region */ - __base_BOARD_FLASH = 0x60040400 ; /* BOARD_FLASH */ - __base_Flash = 0x60040400 ; /* Flash */ - __top_BOARD_FLASH = 0x60040400 + 0x1ffc00 ; /* 2047K bytes */ - __top_Flash = 0x60040400 + 0x1ffc00 ; /* 2047K bytes */ - __base_SRAM_DTC = 0x20000000 ; /* SRAM_DTC */ - __base_RAM = 0x20000000 ; /* RAM */ - __top_SRAM_DTC = 0x20000000 + 0x20000 ; /* 128K bytes */ - __top_RAM = 0x20000000 + 0x20000 ; /* 128K bytes */ - __base_SRAM_ITC = 0x0 ; /* SRAM_ITC */ - __base_RAM2 = 0x0 ; /* RAM2 */ - __top_SRAM_ITC = 0x0 + 0x20000 ; /* 128K bytes */ - __top_RAM2 = 0x0 + 0x20000 ; /* 128K bytes */ - __base_SRAM_OC_512 = 0x20200000 ; /* SRAM_OC */ - __base_RAM3 = 0x20200000 ; /* RAM3 */ - __top_SRAM_OC_512 = 0x20200000 + 0x80000 ; /* 768K bytes */ - __top_RAM3 = 0x20200000 + 0xc0000 ; /* 768K bytes */ - __base_BOARD_SDRAM = 0x80000000 ; /* BOARD_SDRAM */ - __base_RAM4 = 0x80000000 ; /* RAM4 */ - __top_BOARD_SDRAM = 0x80000000 + 0x1e00000 ; /* 30M bytes */ - __top_RAM4 = 0x80000000 + 0x1e00000 ; /* 30M bytes */ - __base_NCACHE_REGION = 0x81e00000 ; /* NCACHE_REGION */ - __base_RAM5 = 0x81e00000 ; /* RAM5 */ - __top_NCACHE_REGION = 0x81e00000 + 0x200000 ; /* 2M bytes */ + __base_BOARD_FLASH = 0x60040400 ; /* BOARD_FLASH */ + __base_Flash = 0x60040400 ; /* Flash */ + __top_BOARD_FLASH = 0x60040400 + 0x1ffc00 ; /* 2047K bytes */ + __top_Flash = 0x60040400 + 0x1ffc00 ; /* 2047K bytes */ + __base_SRAM_DTC = 0x20000000 ; /* SRAM_DTC */ + __base_RAM = 0x20000000 ; /* RAM */ + __top_SRAM_DTC = 0x20000000 + 0x20000 ; /* 128K bytes */ + __top_RAM = 0x20000000 + 0x20000 ; /* 128K bytes */ + __base_SRAM_ITC = 0x0 ; /* SRAM_ITC */ + __base_RAM2 = 0x0 ; /* RAM2 */ + __top_SRAM_ITC = 0x0 + 0x20000 ; /* 128K bytes */ + __top_RAM2 = 0x0 + 0x20000 ; /* 128K bytes */ + __base_SRAM_OC_512 = 0x20200000 ; /* SRAM_OC */ + __base_RAM3 = 0x20200000 ; /* RAM3 */ + __top_SRAM_OC_512 = 0x20200000 + 0x80000 ; /* 768K bytes */ + __top_RAM3 = 0x20200000 + 0xc0000 ; /* 768K bytes */ + __base_BOARD_SDRAM = 0x80000000 ; /* BOARD_SDRAM */ + __base_RAM4 = 0x80000000 ; /* RAM4 */ + __top_BOARD_SDRAM = 0x80000000 + 0x1e00000 ; /* 30M bytes */ + __top_RAM4 = 0x80000000 + 0x1e00000 ; /* 30M bytes */ + __base_NCACHE_REGION = 0x81e00000 ; /* NCACHE_REGION */ + __base_RAM5 = 0x81e00000 ; /* RAM5 */ + __top_NCACHE_REGION = 0x81e00000 + 0x200000 ; /* 2M bytes */ __top_RAM5 = 0x81e00000 + 0x200000 ; /* 2M bytes */ @@ -86,34 +86,34 @@ SECTIONS FILL(0xff) __vectors_start__ = ABSOLUTE(.); __privileged_functions_start__ = .; - + /* Add in the list of all ISR vectors. */ KEEP(*(.isr_vector)) /* Global Section Table. Align it to a 4 byte boundary. */ . = ALIGN(4) ; __section_table_start = .; __data_section_table = .; - + /* SRAM_DTC */ LONG(LOADADDR(.data)); LONG( ADDR(.data)); LONG( SIZEOF(.data)); - + /* SRAM_ITC */ LONG(LOADADDR(.data_RAM2)); LONG( ADDR(.data_RAM2)); LONG( SIZEOF(.data_RAM2)); - + /* SRAM_OC */ LONG(LOADADDR(.data_RAM3)); LONG( ADDR(.data_RAM3)); LONG( SIZEOF(.data_RAM3)); - + /* BOARD_SDRAM */ LONG(LOADADDR(.data_RAM4)); LONG( ADDR(.data_RAM4)); LONG( SIZEOF(.data_RAM4)); - + /* NCACHE_REGION */ LONG(LOADADDR(.data_RAM5)); LONG( ADDR(.data_RAM5)); @@ -137,12 +137,12 @@ SECTIONS /* Reset ISR and data init functions for the board. */ *(.after_vectors*) - + /* Kernel code. */ *(privileged_functions) - + FILL(0xDEAD); - + /* Ensure that non-privileged code is placed after the region reserved for * privileged kernel code. */ /* Note that dot (.) actually refers to the byte offset from the start of @@ -151,10 +151,10 @@ SECTIONS . = __privileged_functions_region_size__; __privileged_functions_end__ = .; } > BOARD_FLASH - + /* Text Section. */ .text : ALIGN(4) - { + { /* Place the FreeRTOS System Calls first in the unprivileged region. */ __syscalls_flash_start__ = .; *(freertos_system_calls) @@ -166,7 +166,7 @@ SECTIONS *(.rodata .rodata.* .constdata .constdata.*) . = ALIGN(4); } > BOARD_FLASH - + /* * for exception handling/unwind - some Newlib functions (in common * with C++ and STDC++) use this. @@ -182,10 +182,10 @@ SECTIONS *(.ARM.exidx* .gnu.linkonce.armexidx.*) __exidx_end = .; } > BOARD_FLASH - + /* End of text section. */ _etext = .; - + /* DATA section for SRAM_ITC */ .data_RAM2 : ALIGN(4) { @@ -194,7 +194,7 @@ SECTIONS PROVIDE(__start_data_SRAM_ITC = .) ; *(.ramfunc.$RAM2) *(.ramfunc.$SRAM_ITC) - + *mflash_drv.o(.text .text* .rodata .rodata*) *fsl_flexspi.o(.text .text* .rodata .rodata*) *ota_pal.o(.text .text* .rodata .rodata*) @@ -263,7 +263,7 @@ SECTIONS __privileged_data_start__ = _data; PROVIDE(__start_data_RAM = .) ; PROVIDE(__start_data_SRAM_DTC = .) ; - + /* FreeRTOS kernel data. */ *(privileged_data) @@ -275,7 +275,7 @@ SECTIONS * dot (.) to a value extends the size of the section. */ . = __privileged_data_region_size__; __privileged_data_end__ = .; - + FILL(0xff) *(vtable) *(.ramfunc*) @@ -305,7 +305,7 @@ SECTIONS { PROVIDE(__start_bss_RAM3 = .) ; PROVIDE(__start_bss_SRAM_OC = .) ; - + *(.bss*) . = ALIGN (. != 0 ? 4 : 1) ; /* avoid empty segment */ PROVIDE(__end_bss_RAM3 = .) ; @@ -414,7 +414,7 @@ SECTIONS . = ALIGN(4) ; _end_noinit = .; PROVIDE(__end_noinit_RAM = .) ; - PROVIDE(__end_noinit_SRAM_DTC = .) ; + PROVIDE(__end_noinit_SRAM_DTC = .) ; } > SRAM_DTC AT> SRAM_DTC /* Reserve and place Heap within memory map */ diff --git a/projects/evkmimxrt1060/sesip/MIMXRT1062xxxxA.xml b/projects/evkmimxrt1060/sesip/MIMXRT1062xxxxA.xml index 80f9641..8717aec 100644 --- a/projects/evkmimxrt1060/sesip/MIMXRT1062xxxxA.xml +++ b/projects/evkmimxrt1060/sesip/MIMXRT1062xxxxA.xml @@ -2,4 +2,4 @@ - + diff --git a/projects/evkmimxrt1060/sesip/crt_infolist.dtd b/projects/evkmimxrt1060/sesip/crt_infolist.dtd deleted file mode 100644 index 26843dc..0000000 --- a/projects/evkmimxrt1060/sesip/crt_infolist.dtd +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -