Using LwIP on the STM32H7

Robin Müller robin.mueller.m at gmail.com
Thu Jan 28 13:35:10 UTC 2021


Hi,

I am trying to get LwIP working on the STM32H7 because it has a low RAM
usage (at least that's what I heard). We already did this for FreeRTOS, but
we used the LwIP Raw API to not be bound specifically to the OS. I am now
trying to adapt LwIP to RTEMS , but I'm not really a LwIP expert and most
did copy & paste up until now.

So far, transferring the code has worked, but there are some specific
sections in the code used for our FreeRTOS example which put the ethernet
DMA descriptors in specific sections:

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_RX_BUFFER_SIZE]
__attribute__((section(".RxArraySection"))); /* Ethernet Receive Buffers */

/* For RTEMS can we put this in the text section? */
//ETH_DMADescTypeDef DMARxDscrTab[ETH_RX_DESC_CNT]; /* Ethernet Rx DMA
Descriptors */
//ETH_DMADescTypeDef DMATxDscrTab[ETH_TX_DESC_CNT];   /* Ethernet Tx DMA
Descriptors */
//uint8_t Rx_Buff[ETH_RX_DESC_CNT][ETH_RX_BUFFER_SIZE]; /* Ethernet Receive
Buffers */

I got an "section `.unexpected_sections' will not fit in region
*   `UNEXPECTED_SECTIONS'" error because of this. I checked the linker
script used, which was taken from the STM32CubeH7 repository and found this
LwIP specific section:

  .lwip_sec (NOLOAD) : {
    . = ABSOLUTE(0x30040000);
    *(.RxDecripSection)

    . = ABSOLUTE(0x30040060);
    *(.TxDecripSection)

    . = ABSOLUTE(0x30040200);
    *(.RxArraySection)
  } >RAM_D2 AT> FLASH

So the descriptors are placed at RAM_D2 (or SRAM_3 in RTEMS). I've placed
the following
section in linkcmds.base now:

    .lwip_sec (NOLOAD) : ALIGN_WITH_INPUT {
        . = ABSOLUTE(0x30040000);
        *(.RxDecripSection)

        . = ABSOLUTE(0x30040060);
        *(.TxDecripSection)

        . = ABSOLUTE(0x30040200);
       *(.RxArraySection)
  } >SRAM_3 AT> REGION_TEXT_LOAD

Are any STM32 or LwIP experts here that see a problem with this adaption? I
still need to do some other stuff to integrate LwIP properly so I haven't
tested it yet. Are there any other thinks I need to take into account for
making LwIP work with RTEMS?

Kind Regards
Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20210128/909e0fb9/attachment.html>


More information about the users mailing list