<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Is there any advantage to using bsd networking over LWiP, or vice versa? <div class=""><br class=""></div><div class="">With Robin’s BSP, if it gets released, I think I should be able to finish up my bsd networking BSP for STM32F7. I’ll also see what I can do about getting it going for F4 as well.</div><div class=""><br class=""></div><div class="">Andrei<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 2021-January-29, at 12:21, Gedare Bloom <<a href="mailto:gedare@rtems.org" class="">gedare@rtems.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: SabonRoman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class="Apple-interchange-newline"><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 29, 2021 at 9:57 AM Robin Müller <<a href="mailto:robin.mueller.m@gmail.com" class="">robin.mueller.m@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class=""><div class=""><div class=""><div class="">The whole code base I'm using might go public soon so I will also send the link here<br class=""></div>as soon as it is. I think this might also be useful for people who would like to evaluate how to set up Eclipse and the CMake build system for<span class="Apple-converted-space"> </span><br class=""></div><div class="">their application<br class=""></div><div class=""><br class=""></div>Kind Regards<br class=""></div>Robin<br class=""></div><br class=""></blockquote><div class="">This will be greatly appreciated, thank you. Glad you got it working, and in relatively short order!</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 29 Jan 2021 at 17:47, Robin Müller <<a href="mailto:robin.mueller.m@gmail.com" target="_blank" class="">robin.mueller.m@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class="">Alright, I figured out the issue, that was an application level problem, the UDP frames are received and sent without issues as far as I can see.<br class=""></div>I think I might submit a patch soon with some of initial improvements. But I will summarize the changes I had to do here for now in case other people want to<span class="Apple-converted-space"> </span><br class=""></div><div class="">use lwIP, based on the example application provided by STM.<br class=""></div><br class=""></div><div class=""><b class="">BSP Changes:</b><br class=""><br class=""></div><div class=""><b class="">Inside bsps/arm/stm32h7/start/bspstart.c:</b><br class=""><br class=""></div><div class="">I changed the HAL_GetTick() function, which returned 0 previously to return the tick count by default:<span class="Apple-converted-space"> </span><br class=""><br class=""></div><div class="">uint32_t HAL_GetTick(void)<br class="">{<br class=""> <span class="Apple-converted-space"> </span>return rtems_clock_get_ticks_since_boot();<br class="">}<br class=""><br class=""></div>I'm not sure whether there was a specific reason to have it return 0 by default, but that led to some issues because this function is generally called by the<span class="Apple-converted-space"> </span><br class="">HAL or by example applications and it's a lot of hassle to replace every call with  rtems_clock_get_ticks_since_boot()<span class="Apple-converted-space"> </span><br class=""></div><br class=""></div><div class=""><b class="">bsps/arm/shared/start/linkcmds.base:</b><br class=""><br class=""></div><div class="">I added following section to the linker file.<br class=""></div><div class="">This is a really ugly solution because this file is used by all ARM bsps. I might look into how to make it stm32h7 specific, but it worked for me now because<br class=""></div><div class="">I only have the STM32H7<br class=""></div><div class=""><br class="">   <span class="Apple-converted-space"> </span>/* Ugly solution for now */<br class="">   <span class="Apple-converted-space"> </span>.lwip_sec (NOLOAD) : ALIGN_WITH_INPUT {<br class="">       <span class="Apple-converted-space"> </span>. = ABSOLUTE(0x30040000);<br class="">       <span class="Apple-converted-space"> </span>*(.RxDecripSection)<br class="">       <span class="Apple-converted-space"> </span>. = ABSOLUTE(0x30040060);<br class="">       <span class="Apple-converted-space"> </span>*(.TxDecripSection)<br class="">       <span class="Apple-converted-space"> </span>. = ABSOLUTE(0x30040200);<br class="">       *(.RxArraySection)<br class="">   <span class="Apple-converted-space"> </span>} >SRAM_3 AT> REGION_TEXT_LOAD<br class=""><br class=""><b class="">bsps/arm/stm32h7/hal/stm32h7xx_hal_eth.c:<br class=""><br class=""></b></div><div class="">On line 364 in<span class="Apple-converted-space"> </span><b class="">HAL_ETH_Init</b>, comment out the preprocessor guards to set the DSL to 64bit. I don't know what this line exactly does yet, but it was necessary<span class="Apple-converted-space"> </span><br class=""></div><div class="">to get lwIP to work properly.<br class=""><br class=""></div><div class=""><b class=""></b></div><div class="">#ifndef __rtems__<br class="">   /* SET DSL to 64 bit */<br class="">   MODIFY_REG(heth->Instance->DMACCR, ETH_DMACCR_DSL, ETH_DMACCR_DSL_64BIT);<br class="">#endif /* __rtems__ */<br class=""><br class=""></div><div class="">On line 2648 in<span class="Apple-converted-space"> </span><b class="">ETH_DMATxDescListInit<span class="Apple-converted-space"> </span></b>comment the preprocessor guard so that the function is executed. This is necessary<br class=""></div><div class="">so the DMA descriptors are set up properly.<br class=""><br class=""></div><div class="">Do the same for<span class="Apple-converted-space"> </span><b class="">ETH_DMARxDescListInit</b><span class="Apple-converted-space"> </span>starting at line 2687.<br class=""><br class=""></div><div class="">I think that was all. Hope it helps some people<br class=""><br class=""></div><div class="">Kind Regards<br class=""></div><div class="">Robin Müller<br class=""></div><div class=""><br class=""><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 29 Jan 2021 at 15:45, Robin Müller <<a href="mailto:robin.mueller.m@gmail.com" target="_blank" class="">robin.mueller.m@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class="">I think I might have found one issue. In the HAL_ETH_Init(ETH_HandleTypeDef *heth) function<span class="Apple-converted-space"> </span><br class=""><br class=""></div>The following piece of code was excluded:<br class=""><br class="">#ifndef __rtems__<br class=""> <span class="Apple-converted-space"> </span>/* SET DSL to 64 bit */<br class=""> <span class="Apple-converted-space"> </span>MODIFY_REG(heth->Instance->DMACCR, ETH_DMACCR_DSL, ETH_DMACCR_DSL_64BIT);<br class="">#endif /* __rtems__ */<br class=""><br class=""></div>I reintroduced the line and now I have been able to receive UDP frames and send some back. I am still missing some frames, but at least it's working now.<br class=""></div><div class="">I might look into how to put the lwIP section in a separate linkcmd file once I have figured out why some frames are missing, but the way I see it,<span class="Apple-converted-space"> </span><br class="">it is driver specific (STM used SDRAM3 for the required lwIP memory. One way would be to add an option in the config.ini like STM32H7_USE_LWIP and then<br class=""></div><div class="">load those additional sections for lwIP.<br class=""></div><br class=""></div>Kind Regards<br class=""></div>Robin<br class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 29 Jan 2021 at 14:18, Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank" class="">joel@rtems.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="auto" class=""><div class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 29, 2021, 5:52 AM Robin Müller <<a href="mailto:robin.mueller.m@gmail.com" target="_blank" class="">robin.mueller.m@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class=""><div class=""><div class=""><div class=""><div class=""><div class="">Hi,<br class=""><br class=""></div>I am actually configuring the MPU with the following function, which was taken over from the STM32 example project:<br class=""><br class="">/*Configure the MPU attributes */<br class="">void MPU_Config(void)<br class="">{<br class="">   <span class="Apple-converted-space"> </span>MPU_Region_InitTypeDef MPU_InitStruct;<br class=""><br class="">   <span class="Apple-converted-space"> </span>/* Disable the MPU */<br class="">   <span class="Apple-converted-space"> </span>HAL_MPU_Disable();<br class=""><br class="">   <span class="Apple-converted-space"> </span>/* Configure the MPU attributes as Device not cacheable<br class="">     for ETH DMA descriptors */<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.Enable = MPU_REGION_ENABLE;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.BaseAddress = 0x30040000;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.Size = MPU_REGION_SIZE_256B;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.Number = MPU_REGION_NUMBER0;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.SubRegionDisable = 0x00;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;<br class=""><br class="">   <span class="Apple-converted-space"> </span>HAL_MPU_ConfigRegion(&MPU_InitStruct);<br class=""><br class="">   <span class="Apple-converted-space"> </span>/* Configure the MPU attributes as Cacheable write through<br class="">     for LwIP RAM heap which contains the Tx buffers */<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.Enable = MPU_REGION_ENABLE;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.BaseAddress = 0x30044000;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.Size = MPU_REGION_SIZE_16KB;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.Number = MPU_REGION_NUMBER1;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.SubRegionDisable = 0x00;<br class="">   <span class="Apple-converted-space"> </span>MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;<br class=""><br class="">   <span class="Apple-converted-space"> </span>HAL_MPU_ConfigRegion(&MPU_InitStruct);<br class=""><br class="">   <span class="Apple-converted-space"> </span>/* Enable the MPU */<br class="">   <span class="Apple-converted-space"> </span>HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);<br class="">}<br class=""><br class=""></div><div class="">If I read the function correctly, it configures the descriptor areas as non-cacheable and the LwIP heap region<br class=""></div><div class="">as non bufferable. I call this in hardware_init, which is the first function called in my Init funnction<br class=""></div><br class="">void hardware_init() {<br class="">   <span class="Apple-converted-space"> </span>BSP_LED_Init(LED1);<br class="">   <span class="Apple-converted-space"> </span>BSP_LED_Init(LED2);<br class="">   <span class="Apple-converted-space"> </span>BSP_LED_Init(LED3);<br class=""><br class="">   <span class="Apple-converted-space"> </span>MPU_Config();<br class=""><br class="">   <span class="Apple-converted-space"> </span>/* Initialize the LwIP stack */<br class="">   <span class="Apple-converted-space"> </span>lwip_init();<br class=""><br class="">   <span class="Apple-converted-space"> </span>/* Configure the Network interface */<br class="">   <span class="Apple-converted-space"> </span>Netif_Config();<br class=""><br class="">}<br class=""><br class=""></div>I checked everything again and basically the setup appears to be identical to the example now.. I'm confused that it's not working.<br class=""></div><div class="">I also supplied the following interrupt function in my C code:<br class=""><br class="">/**<br class=""> <span class="Apple-converted-space"> </span>* @brief  This function handles Ethernet interrupt request.<br class=""> <span class="Apple-converted-space"> </span>* @param  None<br class=""> <span class="Apple-converted-space"> </span>* @retval None<br class=""> <span class="Apple-converted-space"> </span>*/<br class="">void ETH_IRQHandler(void)<br class="">{<br class=""> <span class="Apple-converted-space"> </span>HAL_ETH_IRQHandler(&EthHandle);<br class="">}<br class=""><br class=""></div><div class="">But it appears not to be called..<br class=""></div></div></div></blockquote></div></div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">Is the irq being registered via the RTEMS interrupt APIs? If not and you are getting an interrupt, I'd wonder why you aren't seeing a spurious interrupt flagged.</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">It shouldn't be installed directly at the hardware level.</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">--joel</div><div dir="auto" class=""><br class=""></div><div dir="auto" class=""><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class=""><div class=""><div class=""></div><div class=""><br class=""></div>Kind Regards<br class=""></div>Robin<br class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 29 Jan 2021 at 12:03, Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de" rel="noreferrer" target="_blank" class="">sebastian.huber@embedded-brains.de</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">On 29/01/2021 12:01, Robin Müller wrote:<br class=""><br class="">> The HAL_ETH_Transmit call just times out. If I set the timeout to 20<span class="Apple-converted-space"> </span><br class="">> to HAL_MAX_DELAY, the function will just block indefinitely.<br class="">> Does anyone have an idea why this might happen?<br class="">I would check the memory settings in the MPU for this area. You probably<span class="Apple-converted-space"> </span><br class="">need some sort of device memory (uncached).<br class=""><br class="">--<span class="Apple-converted-space"> </span><br class="">embedded brains GmbH<br class="">Herr Sebastian HUBER<br class="">Dornierstr. 4<br class="">82178 Puchheim<br class="">Germany<br class="">email:<span class="Apple-converted-space"> </span><a href="mailto:sebastian.huber@embedded-brains.de" rel="noreferrer" target="_blank" class="">sebastian.huber@embedded-brains.de</a><br class="">phone: +49-89-18 94 741 - 16<br class="">fax:   +49-89-18 94 741 - 08<br class=""><br class="">Registergericht: Amtsgericht München<br class="">Registernummer: HRB 157899<br class="">Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler<br class="">Unsere Datenschutzerklärung finden Sie hier:<br class=""><a href="https://embedded-brains.de/datenschutzerklaerung/" rel="noreferrer noreferrer" target="_blank" class="">https://embedded-brains.de/datenschutzerklaerung/</a><br class=""><br class=""></blockquote></div>_______________________________________________<br class="">users mailing list<br class=""><a href="mailto:users@rtems.org" rel="noreferrer" target="_blank" class="">users@rtems.org</a><br class=""><a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer noreferrer" target="_blank" class="">http://lists.rtems.org/mailman/listinfo/users</a></blockquote></div></div></div></blockquote></div></blockquote></div></blockquote></div>_______________________________________________<br class="">users mailing list<br class=""><a href="mailto:users@rtems.org" target="_blank" class="">users@rtems.org</a><br class=""><a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank" class="">http://lists.rtems.org/mailman/listinfo/users</a></blockquote></div></div><span style="caret-color: rgb(0, 0, 0); font-family: SabonRoman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: SabonRoman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: SabonRoman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">users mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: SabonRoman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:users@rtems.org" style="font-family: SabonRoman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">users@rtems.org</a><br style="caret-color: rgb(0, 0, 0); font-family: SabonRoman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="http://lists.rtems.org/mailman/listinfo/users" style="font-family: SabonRoman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://lists.rtems.org/mailman/listinfo/users</a></div></blockquote></div><br class="">
<br class=""></div></div></body></html>