<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Kinetis Software Development KitのトピックRe: LwIP/FreeRTOS with KSDK 2.0</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475688#M3944</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Richard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply! Find attached the debug screenshot where the program gets stuck (I presume in the moment it receives the DHCP response packet).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Screen Shot 2016-02-22 at 23.09.13.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53611i754B8D5DD198CE0E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2016-02-22 at 23.09.13.png" alt="Screen Shot 2016-02-22 at 23.09.13.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Feb 2016 22:13:11 GMT</pubDate>
    <dc:creator>tobiaswellnitz</dc:creator>
    <dc:date>2016-02-22T22:13:11Z</dc:date>
    <item>
      <title>LwIP/FreeRTOS with KSDK 2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475684#M3940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying for the last two days to integrate LwIP with KDSK 2.0. Unfortunately, with doubtful success. I just want to initialise the stack properly and retrieve an IP address via DHCP.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whenever a packet is received (e.g. DHCP response from the router), the program gets stuck in one of the configAsserts(), either in xQueueGenericReceive or vPortEnterCritical().&lt;/P&gt;&lt;P&gt;The example project work perfectly and I can upload and debug them with the Segger OpenSDA v2 firmware. I tried to compare the files from the example projects with my own, but I couldn't find the mistake! I KDSK2 documentation is also pretty vage on how to integrate the lwip stack.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code: &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fgithub.com%2Fdh1tw%2FBasicEthernet-K64F" rel="nofollow" target="_blank"&gt;GitHub - dh1tw/BasicEthernet-K64F&lt;/A&gt; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After downloading the KSDK2.0 for my K64F I created a new (minimal + FreeRTOS) Project in KDS 3.1 using the Kinetis SDK 2.x Project Wizard.&amp;nbsp; &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I copied the lwip stack manually into the project and included the paths:&lt;/P&gt;&lt;P&gt;../lwip_1.4.1&lt;/P&gt;&lt;P&gt;../lwip_1.4.1/port&lt;/P&gt;&lt;P&gt;../lwip_1.4.1/src&lt;/P&gt;&lt;P&gt;../lwip_1.4.1/src/include&lt;/P&gt;&lt;P&gt;../lwip_1.4.1/src/include/ipv4&lt;/P&gt;&lt;P&gt;../lwip_1.4.1/src/include/ipv4/lwip&lt;/P&gt;&lt;P&gt;../lwip_1.4.1/src/include/lwip&lt;/P&gt;&lt;P&gt;../lwip_1.4.1/src/include/netif&lt;/P&gt;&lt;P&gt;../lwip_1.4.1/src/include/posix&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Preprocessor symbols are:&lt;/P&gt;&lt;P&gt;DEBUG&lt;/P&gt;&lt;P&gt;CPU_MK64FN1M0VMD12&lt;/P&gt;&lt;P&gt;USE_RTOS=1&lt;/P&gt;&lt;P&gt;FRDM_K64F&lt;/P&gt;&lt;P&gt;FREEDOM&lt;/P&gt;&lt;P&gt;FSL_RTOS_FREE_RTOS&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I use the following compiler flags: &lt;/P&gt;&lt;P&gt;-fno-common&amp;nbsp; -ffreestanding&amp;nbsp; -fno-builtin&amp;nbsp; -mapcs &lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would very much appreciate any help / feedback.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Feb 2016 16:54:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475684#M3940</guid>
      <dc:creator>tobiaswellnitz</dc:creator>
      <dc:date>2016-02-21T16:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: LwIP/FreeRTOS with KSDK 2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475685#M3941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tobias,&lt;/P&gt;&lt;P&gt;Rather than start from scratch and build up the example, there is already a lwip_httpsrv_freertos_frdmk64f demo available in KSDK_v2 for the Freedom frdm-k64f:&lt;/P&gt;&lt;P&gt;C:\NXP\KSDK_v2\SDK_2.0_FRDM-K64F_KDS\boards\frdmk64f\demo_apps\lwip\lwip_httpsrv\freertos&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used it as starting point to modify the lwip_httpsrv_freertos.c source file to implement DHCP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is that file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also if you got &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://nxp.com/ksdk" rel="nofollow"&gt;http://nxp.com/ksdk&lt;/A&gt;&lt;SPAN&gt; and click the download tab, you can grab the &lt;/SPAN&gt;&lt;/P&gt;&lt;H3 style="font-family: Lato, Arial, sans-serif; font-weight: 400; color: #333333; margin-top: 1em; font-size: 14px;"&gt;&lt;A class="dtmAssetClick" data-dtmassettype="Download" data-dtmname="Kinetis SDK Project Generator Tool" href="https://www.nxp.com/webapp/Download?colCode=KSDK-PROJECT-GENERATOR-TOOL&amp;amp;appType=license&amp;amp;location=null&amp;amp;Parent_nodeId=1395420785160723517420&amp;amp;Parent_pageType=product" style="color: #5e89c1;" target="_blank"&gt;Kinetis SDK Project Generator Tool&lt;/A&gt;&lt;SPAN class="small-rev" style="font-size: 12px; color: #b0b0b0;"&gt; (REV 2) . &lt;/SPAN&gt;&lt;/H3&gt;&lt;P&gt;It can be used to create and/or clone example projects.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Feb 2016 21:18:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475685#M3941</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2016-02-22T21:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: LwIP/FreeRTOS with KSDK 2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475686#M3942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For future reference - it would be really helpful if you could say *which* configASSERT() was failing, then I would at least be able to tell you what the symptom of the problem was, if not actually what the cause of the problem was.&amp;nbsp; Many of the asserts will have comments with further information too.&amp;nbsp; In this case it might simply be an &lt;A href="http://www.freertos.org/RTOS-Cortex-M3-M4.html"&gt;interrupt priority problem&lt;/A&gt;, but without knowing which assert it was I can't be sure.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Feb 2016 21:30:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475686#M3942</guid>
      <dc:creator>FreeRTOS_org</dc:creator>
      <dc:date>2016-02-22T21:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: LwIP/FreeRTOS with KSDK 2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475687#M3943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks a lot for the reply! Yes, I'm using the SDK 2.0 for the K64F from the mentioned links. I can confirm that all the examples compile and run flawless on the K64F board!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I'm trying to understand the entire build process on the Cortex M4 / Kinetis development platform. That's why I try building this project from scratch.&lt;/P&gt;&lt;P&gt;And yes, I'm still fairly new to 32bit uCs and RTOS. Until recently I was working either on 8bit (Pics/AVRs) or 64bit platforms (Desktop) - hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also noted that KDS links to the various drivers and middleware files in the SDK folder, rather than copying them into the project folder.&lt;/P&gt;&lt;P&gt;I personally would prefer a KDS project which contains all the necessary files so that I can put the entire project and all its files under version control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I presume that projects generated with the SDK2 Project Wizard and all the drivers / middleware (like lwip) are pre-configured with best practice parameters, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your reply!&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Feb 2016 21:39:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475687#M3943</guid>
      <dc:creator>tobiaswellnitz</dc:creator>
      <dc:date>2016-02-22T21:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: LwIP/FreeRTOS with KSDK 2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475688#M3944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Richard,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your reply! Find attached the debug screenshot where the program gets stuck (I presume in the moment it receives the DHCP response packet).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Screen Shot 2016-02-22 at 23.09.13.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53611i754B8D5DD198CE0E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2016-02-22 at 23.09.13.png" alt="Screen Shot 2016-02-22 at 23.09.13.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Feb 2016 22:13:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475688#M3944</guid>
      <dc:creator>tobiaswellnitz</dc:creator>
      <dc:date>2016-02-22T22:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: LwIP/FreeRTOS with KSDK 2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475689#M3945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tobias,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; From your sceenshot and the code, the Ethernet frames are received by the receive interrupt handler. That mean when a Ethernet frame comes, the&amp;nbsp; ethernet_input-&amp;gt;udp_input-&amp;gt;dhcp_recv...-&amp;gt;mem_alloc ... are all done in an interrupt context. However the sys_mutex_lock called in mem_alloc should not be used in an interrupt context.&amp;nbsp; Because the sys_mutex_lock will call vPortEnterCritical which will cause a ASSERT if it is called from an interrupt context. See more details in vPortEnterCritical in Port.c in freertos\source\.&lt;/P&gt;&lt;P&gt;Recommended solutions:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&amp;nbsp; Polling the Ethernet&amp;nbsp; Receive frames instead of calling by receive ISR.&amp;nbsp; So the receive frame will not be processed in an interrupt context.&lt;/P&gt;&lt;P&gt;changes should be done in ethernetif.c&lt;/P&gt;&lt;P&gt;2. If you prefer the interrupt context to receive the Ethernet frames, the ethernet_input should't be used as the netif input functions. changes must be done in this sentence "&lt;SPAN style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pl-c1" style="color: #0086b3; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;netif_add&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;(&amp;amp;fsl_netif0, &amp;amp;fsl_netif0_ipaddr, &amp;amp;fsl_netif0_netmask, &amp;amp;fsl_netif0_gw, &lt;/SPAN&gt;&lt;SPAN class="pl-c1" style="color: #0086b3; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;NULL&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px;"&gt;, ethernetif_init, &lt;STRONG&gt;ethernet_input&lt;/STRONG&gt;)&lt;/SPAN&gt;" in main.c.&lt;/P&gt;&lt;P&gt;the tcpip_input (with LWIP_TCPIP_CORE_LOCKING_INPUT defined to 0) is a recommend input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, There are some issues in the main()&lt;/P&gt;&lt;P&gt;1. There is no tcp ip initialization in the main. the tcp ip init should be done there.&lt;/P&gt;&lt;P&gt;2. The vTaskDelay should not be called before vTaskStartScheduler.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2016 05:07:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475689#M3945</guid>
      <dc:creator>meilizhou</dc:creator>
      <dc:date>2016-02-23T05:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: LwIP/FreeRTOS with KSDK 2.0</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475690#M3946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot for your hints, Meili! &lt;/P&gt;&lt;P&gt;Now everything works as expected! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I very much appreciate your explanations!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Feb 2016 21:54:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/LwIP-FreeRTOS-with-KSDK-2-0/m-p/475690#M3946</guid>
      <dc:creator>tobiaswellnitz</dc:creator>
      <dc:date>2016-02-23T21:54:58Z</dc:date>
    </item>
  </channel>
</rss>

