Using LwIP on the STM32H7
Joel Sherrill
joel at rtems.org
Thu Jan 28 17:16:16 UTC 2021
On Thu, Jan 28, 2021 at 10:52 AM Robin Müller <robin.mueller.m at gmail.com>
wrote:
> By the way, the lwipopts.h from the STM32 example application appears to
> use the SRAM3 as the LWIP heap memory as well:
>
> /* Relocate the LwIP RAM heap pointer */
> #define LWIP_RAM_HEAP_POINTER (0x30044000)
>
> Might this be an issue?
>
Does that address conflict with memory RTEMS is using for stacks, heap or
workspace?
If so, this is going to crash in an odd an unpredictable way.
Can LWIP work with malloc() optionally? Or can you malloc() (aligned?) the
memory before initializing LWIP and turn that RAM_HEAP_POINTER into a
void * variable access? I doubt it is referenced much.
> I'm also not sure whether any interrupts are configured .. but I think the
> Raw API is polling based..
>
> Kind Regards
> Robin Müller
>
> On Thu, 28 Jan 2021 at 17:40, Robin Müller <robin.mueller.m at gmail.com>
> wrote:
>
>> Okay, I managed to achieve the initialization process by adapting the BSP
>> to perform the descriptor list initialization.
>> Unfortunately, the program now appears to crash in the following polling
>> function, which is called every 100 ms:
>>
>> void ethernetif_input(struct netif *netif)
>> {
>> err_t err;
>> struct pbuf *p;
>>
>> /* move received packet into a new pbuf */
>> p = low_level_input(netif);
>>
>> /* no packet could be read, silently ignore this */
>> if (p == NULL) return;
>>
>> /* entry point to the LwIP stack */
>> err = netif->input(p, netif);
>>
>> if (err != ERR_OK)
>> {
>> LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
>> pbuf_free(p);
>> p = NULL;
>> }
>>
>> HAL_ETH_BuildRxDescriptors(&EthHandle);
>> }
>>
>> More specifically, it appears to crash in netif->input.. Is there someone
>> who has managed to make LwIP work on the STM32 with the Raw API?
>>
>> Kind Regards
>> Robin Müller
>>
>> On Thu, 28 Jan 2021 at 17:15, Robin Müller <robin.mueller.m at gmail.com>
>> wrote:
>>
>>> Alright, I think these descriptors were not initialized inside the
>>> functions:
>>> ETH_DMATxDescListInit
>>> ETH_DMARxDescListInit
>>>
>>> because they are wrapped in preprocessor guards:
>>>
>>> static void ETH_DMATxDescListInit(ETH_HandleTypeDef *heth)
>>> {
>>> #ifndef __rtems__
>>> ETH_DMADescTypeDef *dmatxdesc;
>>> uint32_t i;
>>>
>>> /* Fill each DMATxDesc descriptor with the right values */
>>> for(i=0; i < (uint32_t)ETH_TX_DESC_CNT; i++)
>>> {
>>> dmatxdesc = heth->Init.TxDesc + i;
>>>
>>> WRITE_REG(dmatxdesc->DESC0, 0x0);
>>> WRITE_REG(dmatxdesc->DESC1, 0x0);
>>> WRITE_REG(dmatxdesc->DESC2, 0x0);
>>> WRITE_REG(dmatxdesc->DESC3, 0x0);
>>>
>>> WRITE_REG(heth->TxDescList.TxDesc[i], (uint32_t)dmatxdesc);
>>> }
>>>
>>> heth->TxDescList.CurTxDesc = 0;
>>>
>>> /* Set Transmit Descriptor Ring Length */
>>> WRITE_REG(heth->Instance->DMACTDRLR, (ETH_TX_DESC_CNT -1));
>>>
>>> /* Set Transmit Descriptor List Address */
>>> WRITE_REG(heth->Instance->DMACTDLAR, (uint32_t) heth->Init.TxDesc);
>>>
>>> /* Set Transmit Descriptor Tail pointer */
>>> WRITE_REG(heth->Instance->DMACTDTPR, (uint32_t) heth->Init.TxDesc);
>>> #endif /* __rtems__ */
>>> }
>>>
>>> Is there a specific reason the function was excluded?
>>>
>>> Kind Regards
>>> Robin
>>>
>>> On Thu, 28 Jan 2021 at 16:47, Sebastian Huber <
>>> sebastian.huber at embedded-brains.de> wrote:
>>>
>>>> On 28/01/2021 16:45, Robin Müller wrote:
>>>>
>>>> > *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bsp_nocache*)))
>>>> > .bsp_nocache 0x0000000030000000 0x18c0
>>>> >
>>>> CMakeFiles/fsfw_example.dir/bsp_stm32_rtems/boardconfig/ethernetif.c.obj
>>>> > 0x0000000030000000 DMARxDscrTab
>>>> > 0x0000000030000060 DMATxDscrTab
>>>> > 0x00000000300000c0 Rx_Buff
>>>> > 0x00000000300018c0 bsp_section_nocache_end = .
>>>> > 0x00000000000018c0 bsp_section_nocache_size =
>>>> > (bsp_section_nocache_end - bsp_section_nocache_begin)
>>>> >
>>>> > But in the debugger, the descriptor entries are still zeroed out
>>>> > unfortunately..
>>>> If you place them in BSP_NOCACHENOLOAD_SECTION or
>>>> BSP_NOCACHENOLOAD_SUBSECTION(), they are not loaded (zero initialized).
>>>>
>>>> --
>>>> embedded brains GmbH
>>>> Herr Sebastian HUBER
>>>> Dornierstr. 4
>>>> 82178 Puchheim
>>>> Germany
>>>> email: sebastian.huber at embedded-brains.de
>>>> phone: +49-89-18 94 741 - 16
>>>> fax: +49-89-18 94 741 - 08
>>>>
>>>> Registergericht: Amtsgericht München
>>>> Registernummer: HRB 157899
>>>> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
>>>> Unsere Datenschutzerklärung finden Sie hier:
>>>> https://embedded-brains.de/datenschutzerklaerung/
>>>>
>>>> _______________________________________________
> 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/ab311c27/attachment-0001.html>
More information about the users
mailing list