Using LwIP on the STM32H7

Robin Müller robin.mueller.m at gmail.com
Thu Jan 28 15:38:42 UTC 2021


Hi Joel,

I will look into that. I managed to get everything to compile now but I now
have issues with the aforementioned sections and the
code crashes in the low leven initialization function for LwIP. I stepped
through the code and compared the addresses of the descriptors for the
working code using FreeRTOS and the code using RTEMS. The descriptor
entries for FreeRTOS seem to contain the SRAM 3 addresses while
the descriptors in RTEMS only contains zeroes.. Does anyone have an idea
what might cause this? I attached pictures of the debug output as well..

Kind Regards
Robin.

On Thu, 28 Jan 2021 at 15:11, Joel Sherrill <joel at rtems.org> wrote:

> Specific addresses shouldn't be in the shared linkcmds.base.
>
> You could define new macro names like the other memory types and addresses
> and add those to the generic linkcmds. Then the linkcmds.base would
> generically know those sections and your BSP could set the right macros to
> place it.
>
> One thought is to add linkcmds.lwip which have those special sections (if
> they are common in LWIP -- not driver specific), and then have the BSP
> define the right things and then include linkcmds.lwip and linkcmds.base.
> That way BSPs which want to potentially use lwip could include the lwip
> linkcmds fragment and get the sections.
>
> But if those section names are driver specific, this isn't a good
> organization and we will have to think more.
>
> Hope that makes sense.
>
> --joel
>
> On Thu, Jan 28, 2021 at 7:37 AM Robin Müller <robin.mueller.m at gmail.com>
> wrote:
>
>> Some clarification: The linker script used for RTEMS is of course the
>> default RTEMS linker script, the FreeRTOS example used the linker file
>> taken from the STM32CubeH7 repository.
>>
>> Kind Regards
>> Robin Müller
>>
>> On Thu, 28 Jan 2021 at 14:35, Robin Müller <robin.mueller.m at gmail.com>
>> wrote:
>>
>>> 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
>>>
>> _______________________________________________
>> users mailing list
>> users at rtems.org
>> http://lists.rtems.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20210128/73879f51/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DescriptorsRTEMS.PNG
Type: image/png
Size: 71839 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20210128/73879f51/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DescriptorsFreeRTOS.PNG
Type: image/png
Size: 62160 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20210128/73879f51/attachment-0003.png>


More information about the users mailing list