Skip to main content
Graduate
August 9, 2021
Solved

Azure RTOS ThreadX NetXDuo Cache

  • August 9, 2021
  • 4 replies
  • 1867 views

Hello together,

I have a question regarding caching on AzureRTOS ThreadX/NetXDuo. At the moment I am switching from freeRTOS + lwIP to AzureRTOS ThreadX + NetXDuo. So far everything works but I have some questions regarding caching.

I know that the ethernet 2 descriptiors DMARxDscrTab + DMATxDescrTab

ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT] __attribute__((section(".RxDecripSection"))); /* Ethernet Rx DMA Descriptors */
ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT] __attribute__((section(".TxDecripSection"))); /* Ethernet Tx DMA Descriptors */
uint8_t Rx_Buff[ETH_RX_DESC_CNT][ETH_MAX_PACKET_SIZE] __attribute__((section(".RxArraySection"))); /* Ethernet Receive Buffers */

must be protected by the MPU to avoid caching due to DMA access. So far no problem, I have set the regon to "Device" so that they can't be cached. Now on AzureRTOS NetXDuo it seem that Rx_Buff is not needed as this is allocated by the general byte-pool of AzureRTOS.

  • a. Is this assuption correct?

In my case the buffer is called nx_byte_pool_buffer.

#if defined ( __ICCARM__ ) /* IAR Compiler */
 #pragma location = ".NetXPoolSection"
#elif defined ( __CC_ARM ) /* MDK ARM Compiler */
 __attribute__((section(".NetXPoolSection")))
#elif defined ( __GNUC__ ) /* GNU Compiler */
 __attribute__((section(".NetXPoolSection")))
#endif
/* USER CODE END NX_Pool_Buffer */
static UCHAR nx_byte_pool_buffer[NX_APP_MEM_POOL_SIZE];
static TX_BYTE_POOL nx_app_byte_pool;

So what about caching on this general byte pool as all threads and byte storages are allocated from it.

  • b. Can I enable caching here or should I protect it from caching as well by MPU settings?

Many thanks in advance.

    This topic has been closed for replies.
    Best answer by Walid ZRELLI

    Hello @ESawa.1​ ,

    Sorry for the delay. Here are the answers to your questions:

    a- Yes, the assumption is correct.

    b- The entire pool has to be set as device (disable caching) because buffers used by DMA are inside it.

    It is possible to separate the buffers from the pool in case disabling cache on the pool is inconvenient.

    Please click on Select as Best if my post fully answered your question. This will help other customers with the same issue to find the solution faster!

    BeST Regards,

    Walid

    4 replies

    Visitor II
    August 26, 2021

    Hello @ESawa.1​ ,

    Your questions have been raised internally. I will keep you posted.

    BeST Regards,

    Walid

    ESawa.1Author
    Graduate
    August 26, 2021

    Great I am looking forward to hear from you.

    Best regards,

    Eric

    ESawa.1Author
    Graduate
    October 28, 2021

    Hey together,

    @Walid ZRELLI​ are there any news regarding my question?

    Best regards,

    Eric

    Visitor II
    November 4, 2021

    Hello @ESawa.1​ ,

    Sorry for the delay. Here are the answers to your questions:

    a- Yes, the assumption is correct.

    b- The entire pool has to be set as device (disable caching) because buffers used by DMA are inside it.

    It is possible to separate the buffers from the pool in case disabling cache on the pool is inconvenient.

    Please click on Select as Best if my post fully answered your question. This will help other customers with the same issue to find the solution faster!

    BeST Regards,

    Walid

    ESawa.1Author
    Graduate
    November 4, 2021

    Dear @Walid ZRELLI​ ,

    thanks for checking this topic again. This answers my question almost complete. The only thing I would like to know is if there is an example how to separate the buffers.

    As I understand NetXDuo all packets (TCP & UDP) are put into the "packet pool".

    • a. Is this correct?
    • b. If so would it be enough to separate this section here in the code into an none-cachable region?

    0693W00000GWQqGQAX.pngBest regards,

    Eric

    Visitor II
    November 4, 2021

    Hello @ESawa.1​ 

    • a. Yes correct.

    • b. We didn’t try, but, yes, it should be correct.

    We don’t have/provide an example using split of the packet buffers.

    BeST Regards,

    Walid