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.

AM2732: SBL with networking and LwIP

Part Number: AM2732

Tool/software:

Hi,
I was experimenting with LwIP inside the bootloader and ran into some very strange issue that I think are related to memory corruption.
I started by taking the example of sbl_null and combining it with the example of LwIP using raw APIs (enet_cpsw_rawhttpserver).
Just trying the LwIP part works as an app, but if I try it in the context of the SBL it throws random crashes as soon as I connect my ethernet cable.
The example should be pretty simple so I don't understand why it crashes in the SBL but not as an app.
Is there something weird with this combination?

Steps to reproduce:
- flash sbl_enet_test.tiimage with uart_bootloader.py with ethernet cable detached
- attach JTAG, load symbols, put breakpoints in all of the fault interrupt handlers, modify variable to exit loop_forever
- plug in ethernet cable

sbl_enet_test.zip

  • Hi Anrea,

    I am looking into this, Please allow me 1-2 days to run some tests and share my observations.

    Regards,
    Shaunak

  • Hi Andrea, 

    1. We don't generally recommend using LwIP inside SBL code, any specific reason why LwIP cannot be a part of the application code itself?

    2. I tried to quickly skim through your code and I see a forever while loop before calling the app_main() function. Can you please help me understand how the application exits this while loop?

    Regards,
    Shaunak

  • Hi Shaunak,
    thanks for looking into this.

    1. We would like to have a Secondary Boot Loader boot from the ethernet, so we need some sort of ethernet libraries in there.
    I initially chose LwIP because that's what I'm more familiar with. May I ask what is the reason to avoid it in SBL code? Also, what other alternative would you recommend, LLDs?

    2. It's there to allow me to connect with JTAG and debug the SBL, following the procedure briefly described in the og question. It's not relevant to the problem and can be removed if needed

  • Hi,

    May I ask what is the reason to avoid it in SBL code? Also, what other alternative would you recommend, LLDs?

    1. We haven't thoroughly tested LwIP along with SBL yet. So any issues you face might be equally new to me as well.

    Generally we recommend customers to use ethernet driver without LwIP stack (just the enet-lld driver) for SBL Ethernet functionality. We have a tested working example on the AWR294x device for SBL ethernet. I am attaching the reference documentation. You can try porting it to the AM273x.

    AWR294x MCU+ SDK_ SBL QSPI ENET.pdf

    Please let me know if the above approach works for you.

    2. Got it, thanks for sharing. 

    Regards,
    Shaunak

  • Hello,
    In the end we did a long debug and found out that the crashes were because of an interrupt stack overflow.
    As a workaround we increased FIQ stack size and it now seems to work much better.
    Not sure why this happened.