Using LwIP on the STM32H7

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


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:

__attribute__((section(".RxDecripSection"))); /* Ethernet Rx DMA
Descriptors */
__attribute__((section(".TxDecripSection")));   /* Ethernet Tx DMA
Descriptors */
__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);

    . = ABSOLUTE(0x30040060);

    . = ABSOLUTE(0x30040200);

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);

        . = ABSOLUTE(0x30040060);

        . = ABSOLUTE(0x30040200);

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list