This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LwIP with Static IP address on AM1808

Other Parts Discussed in Thread: AM1808, LM3S6965, OMAP-L138, EK-TM4C1294XL

Hello

We are facing problems with LwIP stack available for Sitara AM1808 in Starterware (migrated from Stellaris). The webserver isn't running in demo application or separate project with static IP address. We don't have a DHCP server, so we couldn't test it on DHCP. IDE is CCS version 5.1

The webserver example through LwIP for Stellaris LM3S6965 Evaluation Kit is working fine with same static IP address on the same network. IDE is Keil ARM.

Is there any migration settings required for AM1808?

Regards,Yogendra

  • Hi Yogendra,

    Could you please tell what all changes you did for Static IP ? 

    I assume you redefined  #define STATIC_IP_ADDRESS to your desired IP in the desired format. (lwipopts.h)

    What is the behaviour you are seeing ? Is the code generating an abort ? Could you please explain on the behaviour a little more ?

     

    Cheers,

    Sujith.

  • Hey,

    I am working with Yogendra on this project. I have made changes only in following part :-

    ipAddr = lwIPInit(0, macArray, STATIC_IP_ADDRESS, STATIC_NETMASK, STATIC_GATEWAY, IPADDR_USE_STATIC);

    where,

    #define STATIC_IP_ADDRESS             0xC0A85A96  /* 192.168.90.150 */

    #define STATIC_NETMASK                    0xFFFFFF00  /* 255.255.255.0 */

    #define STATIC_GATEWAY                    0xC0A85AFE  /* 192.168.90.254 */

    Rest all code is untouched. My PC which I tried connecting both directly and also with a switch in between has following TCP/IP settings :-

    ip - 192.168.90.184

    netmask -/ 255.255.255.0

    gateway - 192.168.90.254

    We are not able to ping and open the webpage on browser. Same thing happens with demo application also.

    Regards,

    Rohit

  • Rohit,

    Trying with the static ip address should work - although I have faced some issues, like faulty cable etc.

    Just to rule out these, can you readily check the DHCP based out of box executable?

    You can download a tftpd32 (http://tftpd32.jounin.net/) which has a dhcp server integrated - just a few simple settings and the dhcp server starts running. You should install it on your PC.

    I hope the ready executable works...

    In the meanwhile can you send wireshark/ethereal logs to check whats happening.

    Madhvapathi Sriram

  • Hi,

    As feared, the out of the box Starterware executables for both demo code and enet_lwip alone don't work on our Zoom eXp AM1808 boards. I am running the Tftpd32 application on my PC which is disconnected from rest of my office network and connected to the board via switch ( I also tried connecting it directly but same results). I am attaching logs of wireshark and Tftpd32 for your reference 5611.lwip_am1808.zip Looks like the DHCP server is not able to assign address to this board. The message on my hyperterminal attached to the console serial port is as follows

    ------------------------------------------------------------------------------------

    StarterWare AM1808 Boot Loader
    Jumping to StarterWare Application...


    Acquiring IP Address...

    ------------------------------------------------------------------------------------

    Please help.

    Regards,

    Rohit

  • hi Rohit,

    Could you please tell which version of StarterWare you are using ?

    Regards

    Sujith.

  • Hi Rohit,

    We checked AM1808 enet_echo and enet_lwip examples locally with both static and dynamic IP and they worked fine.

    We loaded on a Spectrum Digital Board with CCS 3.3.

    I checked your wireshark log. I could see only "DHCP Discover"  sent from EVM after initialization. DHCP REQUEST is not sent from the EVM after receiving DHCP Offer. So either the lwIP stack might not have received the packet, or sending the DHCP Discover is not properly done.

    Could you please check if interrupts are enabled at all the levels properly ?  You can check if the Transmit/Receive interrupt handlers  (sitaraif_tx_inthandler and  sitaraif_rx_inthandler )are executed at any point of time.

    Regards,

    Sujith.

  • Hi,

    As mentioned above we are using LogicPD's  AM1808 Zoom eXperimenter kit and CCS v5.1.0.09000 with TMS470 compiler and AM1808_StarterWare_1_00_02_02. While in Debug mode when we place the breakpoint on sitaraif_rx_inthandler gets executed. But still the webserver application of enter_lwip does not work.


    Anyways, I think I got the answer why the codes are not working as is. The hint lies here -> http://processors.wiki.ti.com/index.php/StarterWare_01.00.02.02_Release_Notes

    They have mentioned the shortcomings of TMS470 compiler as "Unaligned memory accesses results in erroneous behaviour when binaries are generated using TMS470 tool chain. This is because the TMS470 does not support packed attributes for structures. This issue us evident when using ethernet or USB examples where the pointer/address alignment may be adjusted dynamically while parsing/dropping headers at different layers of the IP stack. In case of Out-of-box demo (built by TMS470 ARM tool chain) ethernet cannot be used, and hence do not connect the ethernet cable. also, the USB component of the demo does not work"

    and the workaround it seems is "TMS470 cannot be used on such cases. If possible please migrate to CodeSourcery GCC tool chain supported herein"

    I am surprised how you are able to run lwip app on CCSv3.3.

    But again if we use CodeSourcery GCC tool chain there is another issue of "Ethernet: enet_lwip example application hangs if the optimization level is O1 - in code sourcery tool chain context and when using IAR tool chain. This issue is observed only in certain networks. The issue is that the DHCP ACK messages are not recieved. This is under investigation " whose workaround is "In case of Code Sourcery GCC tool chain use O2 or O0 optimization "

    I am not sure how to integrate CodeSourcery GCC tool chain with CCSv5.1 and use it for Debugging purpose.

    Please help if you can.

    Regards,

    Rohit

  • Hi Rohit,

    For loading executable only we used CCS  3.3. The code generated was from GCC. You are correct. TMS470 Code Generation has problem with packed attribute support for structures.

    If you have plan to use GCC, please refer to the  below page for details on how to build projects using Code Sourcery tool chain.

    http://processors.wiki.ti.com/index.php/StarterWare_Getting_Started_01.00.XX.XX

    And the GCC generated .out file you can load onto the EVM via CCS and you will be able to debug.

    The steps for debugging via CCS is explained in  http://processors.wiki.ti.com/index.php/AM335X_StarterWare_Environment_Setup . (refers to AM335x, but this might help you.)

     

    Regards,

    Sujith.

  • Hi,

    I flashed demo.out found under "C:/Program Files/Texas Instruments/Starterware/binary/armv5/gcc/am1808/evmAM1808/demo/Release" using out2rprc.exe & sfh_OMAP-L138.exe  on my LogicPD Zoom eXp AM1808 board. No CCS is involved for now.

    The problem now is, the DHCP server is able to assign address (192.168.90.100) to the board. And I am also able to ping it. But the "http://192.168.90.100/index.html" does not show up in my web browser.  After some time even the ping does not work. Now since I am not able to debug the application, I don't know if its stuck and if so where it is stuck.

    Again, I tried all the web browsers (chrome, firefox, ie) but the same result : "Connection Timeout". Even the touch screen display hangs and I am not able to browse through the demo application which I was prior to webserver execution.

    Regards,

    Rohit

  • hi Rohit,

    I assume the program has generated an abort. Could you please check the location where the PC points when it hangs ?

    If it really generates an abort, we have to see which instruction caused an abort. Accordingly we can analyze. If you need to analyze the exact instruction where it aborted, please follow the below steps.

    1. Load your code onto the EVM. It will halt at the starting of main() function.

    2. Put breakpoints at  addresses 0xFFFF000C and 0xFFFF0010

    3. Start execution and try to ping/access the webpage for recreating the aborting scenario. When an abort is generated, according to the type of abort, it will hit either of the breakpoints.

    4. When it hits the breakpoint, Note down the Register R14 (link register) of the current mode. We might be able to find the function in which it caused an abort using this value.

    if the breakpoint at 0xFFFF00010(data abort), (R14 - 8) will give you the exact address of the aborted instruction (LDR/STR instruction). Further debugging will be possible with the help of this. If the breakpoint at 0xFFFF0000C, R14 might have got corrupted sometimes, in that case, we have to debug further to analyze where it is aborted, with the help of R0-R12.

    Regards

    Sujith.

  • Hi,

    How do you suggest I load the program from CCSv5.1 ? Since TMS470 does not work for lwip I cannot use its binary for debugging. Then again I cannot load GCC based project in my CCSv5.1. I had flashed demo.out file on my board. How can I debug it using CCS ??

    Please state clear procedure right from importing the project to debugging with paths. I have gone through the links and they serve no purpose to my current question. It would be kind of you to state the exact procedure here instead of pasting links.

    Thank You.

    Regards,

    Rohit.

  • Hi Rohit,

    It is clear that we can use GCC for generating .out/.bin file for ethernet example. So for now, leave the case of using TMS470 for code generation or importing CCS projects. I am neither referring to how to debug after flashing.

    Once GCC .out file is generated, the same .out file can be loaded via CCS and debugged. CCS will be able to show all the symbols. There is no CCS project involved here.

    Let me check how I can provide you the details on the procedure.

    Cheers.

    Sujith.

  • Hi Rohit,

    I am pasting some relevant information below. Could you plese check if the below information is useful for you ? Otherwise please revert if you need any further clarification.

    CCSv5 can be used to connect to the target (EVM), load executable binaries and debug. To connect to the target one needs to have a target configuration for the CCSv5 and this can be used to launch a debug session.

    Creating a target configuration, if one doesn't exist already.

    1. Launch Code Composer Studio v5 eclipse IDE
    2. File menu-> New-> Other-> General ->Target Configuration File. Click Next
    3. Filename : AM1808EVM. Check "Use shared location" to be available to anyone who uses the workspace. Click Finish. A window opens up which is to configure the connection details
    4. Connection: Chose the host-to-target connection details. For example "Spectrum Digital XDS510 USB Emulator", if XDS510 is being used.
    5. Device: Type AM1808. AM1808 should be available in the device list. Select AM1808
    6. Click on "Target Configuration". "Initialization Script" for ARM9 should point to a proper GEL file that needs to be used.
    7. Click Save.

     

    Launching a debug session and connecting to the target

    1. Run Menu ->Debug. This will launch the debugging session for AM1808
    2. Right Click on the ARM9 target and select Connect.

    Loading and running a program/executable

    1. Run menu ->Load ->Load Program. Here browse to the required executable and click OK (eg: binary/armv5/gcc/am1808/evmAM1808/demo/demo.out)
    2. Run menu -> Run

    Regards

    Sujith.

  • Hi,

    Thanks for mentioning the procedure in detail. Its now working. I am able to load "binary/armv5/gcc/am1808/evmAM1808/demo/Debug/demo.out" using CCSv5.1 on my Logic PD Zoom eXp Am1808 board. I also located source to "C:\Program Files\Texas Instruments\Starterware\examples\evmAM1808\demo" after which I was able to put breakpoints. The DHCP now works fine and also I am able to load "http://192.168.90.100/index.html" but strangely not in firefox. It works fine in IE and chrome.

    Now that the code is running fine, the last thing I would need your help is for setting up CCSv5.1 for building StarterWare using CodeSourcery Toolchain. According to the procedure mentioned in the above links, I have to compile (build) the code via command prompt using "make". I have installed the toolchain on my Windows PC. When I try to make, I get the following error :-

    C:\Program Files\Texas Instruments\Starterware\build\armv5\gcc\am1808\evmAM1808\
    enet_lwip>make debug
    make TARGET_MODE=debug lib
    make[1]: Entering directory `/c/Program Files/Texas Instruments/Starterware/buil
    d/armv5/gcc/am1808/evmAM1808/enet_lwip'
    make[2]: Entering directory `/c/Program Files/Texas Instruments/Starterware/buil
    d/armv5/gcc/am1808/drivers'
    make[2]: `debug' is up to date.
    make[2]: Leaving directory `/c/Program Files/Texas Instruments/Starterware/build
    /armv5/gcc/am1808/drivers'
    make[2]: Entering directory `/c/Program Files/Texas Instruments/Starterware/buil
    d/armv5/gcc/am1808/evmAM1808/platform'
    make[2]: `debug' is up to date.
    make[2]: Leaving directory `/c/Program Files/Texas Instruments/Starterware/build
    /armv5/gcc/am1808/evmAM1808/platform'
    make[2]: Entering directory `/c/Program Files/Texas Instruments/Starterware/buil
    d/armv5/gcc/am1808/system_config'
    make[2]: `debug' is up to date.
    make[2]: Leaving directory `/c/Program Files/Texas Instruments/Starterware/build
    /armv5/gcc/am1808/system_config'
    make[2]: Entering directory `/c/Program Files/Texas Instruments/Starterware/buil
    d/armv5/gcc/utils'
    make[2]: `debug' is up to date.
    make[2]: Leaving directory `/c/Program Files/Texas Instruments/Starterware/build
    /armv5/gcc/utils'
    make[1]: Leaving directory `/c/Program Files/Texas Instruments/Starterware/build
    /armv5/gcc/am1808/evmAM1808/enet_lwip'
    make TARGET_MODE=Debug lwip
    make[1]: Entering directory `/c/Program Files/Texas Instruments/Starterware/buil
    d/armv5/gcc/am1808/evmAM1808/enet_lwip'
    arm-none-linux-gnueabi-gcc -c -g -fdata-sections -ffunction-sections -Wall -I../
    ../../../../..//include -I../../../../../..//include/hw -I../../../../../..//inc
    lude/armv5 -I../../../../../..//include/armv5/am1808 -I../../../../../..//grlib/
    include -I../../../../../..//usblib/include -I../../../../../..//ipclite/include
     -I../../../../../..//nandlib/include -I"/include" -Dam1808 -DevmAM1808 -I../../
    ../../../../third_party/lwip-1.3.2 -I../../../../../../third_party/lwip-1.3.2/sr
    c/include -I../../../../../../third_party/lwip-1.3.2/src/include/ipv4 -I../../..
    /../../../third_party/lwip-1.3.2/src/include/lwip -I../../../../../../third_part
    y/lwip-1.3.2/ports/am1808/include -I../../../../../../third_party/lwip-1.3.2/app
    s/httpserver_raw_io -I../../../../../../examples/evmAM1808/enet_lwip/ -I../../..
    /../../../third_party/lwip-1.3.2 -I../../../../../../third_party/lwip-1.3.2/src/
    include -I../../../../../../third_party/lwip-1.3.2/src/include/ipv4 -I../../../.
    ./../../third_party/lwip-1.3.2/src/include/lwip -I../../../../../../third_party/
    lwip-1.3.2/ports/am1808/include -I../../../../../../third_party/lwip-1.3.2/apps/
    httpserver_raw_io -I../../../../../../examples/evmAM1808/enet_lwip/ ../../../../
    ../../third_party/lwip-1.3.2/apps/httpserver_raw_io/httpd_io.c
    arm-none-linux-gnueabi-gcc -c -g -fdata-sections -ffunction-sections -Wall -I../
    ../../../../..//include -I../../../../../..//include/hw -I../../../../../..//inc
    lude/armv5 -I../../../../../..//include/armv5/am1808 -I../../../../../..//grlib/
    include -I../../../../../..//usblib/include -I../../../../../..//ipclite/include
     -I../../../../../..//nandlib/include -I"/include" -Dam1808 -DevmAM1808 -I../../
    ../../../../third_party/lwip-1.3.2 -I../../../../../../third_party/lwip-1.3.2/sr
    c/include -I../../../../../../third_party/lwip-1.3.2/src/include/ipv4 -I../../..
    /../../../third_party/lwip-1.3.2/src/include/lwip -I../../../../../../third_part
    y/lwip-1.3.2/ports/am1808/include -I../../../../../../third_party/lwip-1.3.2/app
    s/httpserver_raw_io -I../../../../../../examples/evmAM1808/enet_lwip/ -I../../..
    /../../../third_party/lwip-1.3.2 -I../../../../../../third_party/lwip-1.3.2/src/
    include -I../../../../../../third_party/lwip-1.3.2/src/include/ipv4 -I../../../.
    ./../../third_party/lwip-1.3.2/src/include/lwip -I../../../../../../third_party/
    lwip-1.3.2/ports/am1808/include -I../../../../../../third_party/lwip-1.3.2/apps/
    httpserver_raw_io -I../../../../../../examples/evmAM1808/enet_lwip/ ../../../../
    ../../third_party/lwip-1.3.2/ports/am1808/lwiplib.c
    make[1]: Leaving directory `/c/Program Files/Texas Instruments/Starterware/build
    /armv5/gcc/am1808/evmAM1808/enet_lwip'
    make TARGET_MODE=Debug bin
    make[1]: Entering directory `/c/Program Files/Texas Instruments/Starterware/buil
    d/armv5/gcc/am1808/evmAM1808/enet_lwip'
    arm-none-linux-gnueabi-gcc  -c -g -fdata-sections -ffunction-sections -Wall -I..
    /../../../../..//include -I../../../../../..//include/hw -I../../../../../..//in
    clude/armv5 -I../../../../../..//include/armv5/am1808 -I../../../../../..//grlib
    /include -I../../../../../..//usblib/include -I../../../../../..//ipclite/includ
    e -I../../../../../..//nandlib/include -I"/include" -Dam1808 -DevmAM1808 -I../..
    /../../../../third_party/lwip-1.3.2 -I../../../../../../third_party/lwip-1.3.2/s
    rc/include -I../../../../../../third_party/lwip-1.3.2/src/include/ipv4 -I../../.
    ./../../../third_party/lwip-1.3.2/src/include/lwip -I../../../../../../third_par
    ty/lwip-1.3.2/ports/am1808/include -I../../../../../../third_party/lwip-1.3.2/ap
    ps/httpserver_raw_io -I../../../../../../examples/evmAM1808/enet_lwip/ ../../../
    ../../../examples/evmAM1808/enet_lwip//*.c
    arm-none-linux-gnueabi-ld -e Entry -u Entry -u __aeabi_uidiv -u __aeabi_idiv --g
    c-sections -L"/arm-none-linux-gnueabi/lib/" -L"/lib/gcc/arm-none-linux-gnueabi/4
    .3.3/" -L../../../../../..//binary/armv5/gcc/am1808/drivers/Debug -L../../../../
    ../..//binary/armv5/gcc/am1808/evmAM1808/platform/Debug -L../../../../../..//bin
    ary/armv5/gcc/am1808/system_config/Debug -L../../../../../..//binary/armv5/gcc/a
    m1808/ipclite/Debug -L../../../../../..//binary/armv5/gcc/utils/Debug -L../../..
    /../../..//binary/armv5/gcc/am1808/usblib/Debug -L../../../../../..//binary/armv
    5/gcc/grlib/Debug -L../../../../../..//binary/armv5/gcc/nandlib/Debug -o Debug/e
    netLwip.out -Map Debug/enetLwip.map \
                  Debug/*.o* -T enetLwip.lds -ldrivers -lutils -lplatform -lsystem_c
    onfig -lc -lgcc -ldrivers -lutils -lplatform -lsystem_config -lc -lgcc
    c:\Program Files\CodeSourcery\Sourcery G++ Lite\bin\arm-none-linux-gnueabi-ld.ex
    e: cannot find -lc
    make[1]: *** [bin] Error 1
    make[1]: Leaving directory `/c/Program Files/Texas Instruments/Starterware/build
    /armv5/gcc/am1808/evmAM1808/enet_lwip'
    make: *** [debug] Error 2

    When I check the directory Debug under enet_lwip folder, I see that all the .o files are created. But it fails to link them due to "cannot find -lc" error. I guess its not able to link some dynamic library. Can you put some light on this issue also ?

    Only after this I can tweak the enet_lwip code for Static IP address and check if its working !

    Regards,

    Rohit

  • Hi Rohit,

    Could you please verify if  the enviornment variable LIB_PATH is added and is pointing  to proper Code Sourcery installation directory ?

    Regards,

    Sujith.

  • Hi,

    I did add LIB_PATH pointing to installation directory of CodeSourcery to my environment variables in Windows. I tried the same thing in Linux Ubuntu 10.4 but same error cannot find -lc appeared. Here too I had exported LIB_PATH pointing to linux's installation of Code Sourcery directory.

    Funny thing is, to be sure, I even tried adding the absolute path of the Code Sourcery tool chain installation directory to makedefs file ie by explicitly mentioning LIB_PATH at the start of file. Still same story.

    After much googling I found out that in Windows some issue is with Cygwin's directory structure. But then this should have worked on linux atleast which has nothing to do with Cygwin.

    Next I found out that  its better to use the *-gcc command rather than the *-ld command for linking too, as it knows what std libs need to be linked to a C program without explicitely mentioning it on the command line. So I changed the LD part of makedefs from ld to gcc. Now to my horror a new error has appeared in linux.

    arm-none-linux-gnueabi-gcc: Debug/demo.map: No such file or directory
    arm-none-linux-gnueabi-gcc: unrecognized option '-Map'
    make[1]: *** [bin] Error 1

    I am now trying to figure out how to add this file (which was supposed to be auto generated as in cgt_css build) to my Debug folder.

    One thing I observed is that I have ended up wasting lot of time setting up TI CCS StarterWare instead of using it for my project. Same thing happened with linux sdk for AM1808. Due to lack of proper documentation and direct support we customers have to suffer both in terms of time and extra effort which could be easily avoided.

    Regards,

    Rohit

  • 1. I am suspecting that the gcc version you are using is not the right one. the tool should be "arm-none-eabi" but in your case it is "arm-none-linux-gnueabi". refer the link for information to download and install codesourcery.

    2. Also the spaces in folder name (program files) may cause problem. Try to install with the path such that there are no spaces in the folder name. one more suggestion while exporting LIB_PATH give the path in double quotes and in linux format (slashes) eg - (export LIB_PATH="D:/programs/CodeSourcery/Sourcery_G++_Lite").

    Regards

    Baskaran

  • Rohit,

    Refer to the older user guide here:http://processors.wiki.ti.com/index.php/SitaraWare_GettingStarted_1.00.xx.xx#For_Windows

    The below line is very important:

    5. "set CYGPATH=cypath" to convert Windows native style filenames to POSIX style filenames. Not doing this might lead to linker errors while trying to find libc path


    Also, while glad to know that you have got things working, some info on what went wrong previously and what fixed it would benifit the community!

    Regards,

    Madhvapathi Sriram


  • Hi.

    I removed my old CodeSourcery Tool Chain and installed the one you mentioned. Also to be sure, I reinstalled StarterWare. Next I updated the LIB_PATH in my windows environment variable list. Now I am able to make without errors.

    As I wanted to integrate this project in CCSv5.1, cleared my workspace and imported "Existing Code as Makefile Project" and pointed to location "build\armv5\gcc\am1808\evmAM1808\demo\". The I added files from "examples\evmAM1808\demo" folder. Now I created make targets and was able to build the project in CCS using Code Sourcery Toolchain. For Debugging I have created a new Target Configuration File with AM1808 credentials and gel file. After pointing to demo code location, I am now able to load the debug binary into my board.

    Now the main aim of assigning static ip was done by making required changes in demoEnet.c file. I recompiled the code using CCS-CodeSourcery setup and was able to generate new debug binary which when loaded into the board via CCS works fine. Finally I am able to open the web page with static ip.

    The only issue now is  "unresolved includes" in my demo project.

    Thanks for the support.

    Regard,

    Rohit

  • hello sujit,

    i am working with enet-lwip for my EK-TM4C1294XL board i want to use static IP address to show the decided page on the browser. How to assign the static IP address. please help