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.

enet_lwip doesn't work under debugger when starting address is not 0

Way to reproduce:

1. Import enet_lwip project to CCS. Remove the following lines from lwIPHostTimerHandler function, with these lines the program doesn't work at all:

    if((ui32NewIPAddress == 0) || (ui32NewIPAddress == 0xffffffff))
    {
        //
        // Loop through the LED animation.
        //

        for(ui32Idx = 1; ui32Idx < 17; ui32Idx++)
        {

            //
            // Toggle the GPIO
            //
            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1,
                    (MAP_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1) ^
                     GPIO_PIN_1));

            SysCtlDelay(g_ui32SysClock/(ui32Idx << 1));
        }
    }

     Run the program using Debug command - it works. After some time you can see IP address printed to UARTprintf, and WEB page with this address can be opened.

2. Change APP_BASE value from 0 to 0x00004000. Run the program using Debug command - it hangs somewhere on Ethernet initialization stage.

Program hangs only under debugger. If debugger is not active, it works. To check this, do the following:

1. Burn boot_serial program with offset 0.

2. Burn enet_lwip program with offset 0x00004000.

3. Power off and on the board. boot_serial successfully loads enet_lwip, and it works. So, without debugger it is OK.

The problem exists from old Stellaris series. I need to make a program which talks with host using lwip, and works with bootloader. So, I cannot debug it, and cannot load it without debugging, since CSS doesn't have such command.

My working environment:

Code Composer Studio Version: 6.1.3.00034
TivaWare_C_Series-2.1.3.156
Board: EK-TM4C129XL Rev D
Windows 10 x64

  • Hello Alex,

    Alex Farber38 said:
    1. Import enet_lwip project to CCS. Remove the following lines from lwIPHostTimerHandler function, with these lines the program doesn't work at all:

    I have never had any problem when those lines are present in the "enet_lwip" example. Those lines are executed when an IP address is not yet acquired. Can you try it again and see if you have an issue?

    Alex Farber38 said:
    2. Change APP_BASE value from 0 to 0x00004000. Run the program using Debug command - it hangs somewhere on Ethernet initialization stage.

    This is because the debugger might be loading the code at a different location than from where it is trying to run it.

    Alex Farber38 said:
    The problem exists from old Stellaris series. I need to make a program which talks with host using lwip, and works with bootloader. So, I cannot debug it, and cannot load it without debugging, since CSS doesn't have such command.

    It is best to debug the code when it is built to run from location 0. Once the debug is complete and the code works, change the APP_BASE address to the new location and use the bootloader to load the code and run it.

    Thanks,

    Sai

  • 1. This problem is described here: e2e.ti.com/.../388374
    2. OK, I have no another choice.
  • Hello Alex,

    Ok now I see the issue. I agree that the LED blinking scheme is not the best. If you have an Ethernet cable connected, you will not see the issue. Only when the Ethernet cable is not connected is the issue noticed as the AutoIP is not assigned due to the long LED blinking scheme. I have opened a bug report to correct it. I will also see why this was not fixed after being reported earlier.

    Thanks,
    Sai
  • Hi Alex,

    >1. Burn boot_serial program with offset 0.
    Is it possible the ICDI has been configured on Run to main?

    A work around was to no include the boot loader when ICDI debugging of the application. Another eye opener is to erase flash and only load and attempt to debug boot loader alone, APP_BASE: 0x0. Basically if (bl_config.h) is set for Ethernet the selected defines do not invoke (main). Even when ICDI is without Run to (main)and BL loads APP_BASE:0x00004000 it often crashes while loading the applications interrupt vector table. Not always but often that debug method corrupts BL in flash.