Bootloader to Application + lwip crash

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Bootloader to Application + lwip crash

nrichard
Hello,

My project consists of two sub-projects, a bootloader and an application.  My bootloader is programmed at the start of flash, and always starts when the board is given power.  I also have an application project, that through my bootloader I use FTP to transfer the image to a certain address.  Then I can jump to that address and my application starts.  This process works perfectly fine.

In both my application and my bootloader, I am using lwip version 2.0.2 raw api for all internet related protocols and applications.  These include ftp, http, telnet, and snmp.  The bootloader specifically has ftp, http, and telnet.  The application has ftp, http, telnet, AND snmp.  So other than snmp, these two projects are nearly identical.

The issue I'm having is that when I jump from my bootloader to my application, lwip crashes my board.  The initialization works perfectly fine, but when I try to ping the board, go to the built in web page, or try snmp, etc. it completely locks up my board and I am forced to hit the reset button.  What's more interesting is that when I turn on one of the built in printf debug statements, it prints messages for random traffic.  Along with that, if I turn multiple debug options on, aka, cluttering my console with debug print statements, my application works exactly as intended, just with a very high ms (around 60+ when it should be <1).

Just to clarify, my bootloader is working exactly as intended with lwip.  The webpage works, I can ping the board, and use telnet.  My application is exactly the same as my bootloader, it just has snmp added on and a few minor changes (none that would break lwip since they are unrelated).

Any ideas? What steps could I take to resolve this issue?  I'm not sure if this is a problem with my lwip settings in my application somehow, or an issue with something else.  I find it very strange that lwip on my bootloader works perfectly yet the lwip on my application does not.

Thanks, Nick
Reply | Threaded
Open this post in threaded view
|

Re: Bootloader to Application + lwip crash

Krzysztof Wesołowski

Can you load and start application without involving bootloader?

It's quite possible that driver handling hardware init does not work as expected if hw was already configured (i.e. MAC, DMA are already setup and in the middle of operation when application start).


On Mon, 1 May 2017, 23:27 nrichard, <[hidden email]> wrote:
Hello,

My project consists of two sub-projects, a bootloader and an application.
My bootloader is programmed at the start of flash, and always starts when
the board is given power.  I also have an application project, that through
my bootloader I use FTP to transfer the image to a certain address.  Then I
can jump to that address and my application starts.  This process works
perfectly fine.

In both my application and my bootloader, I am using lwip version 2.0.2 raw
api for all internet related protocols and applications.  These include ftp,
http, telnet, and snmp.  The bootloader specifically has ftp, http, and
telnet.  The application has ftp, http, telnet, AND snmp.  So other than
snmp, these two projects are nearly identical.

The issue I'm having is that when I jump from my bootloader to my
application, lwip crashes my board.  The initialization works perfectly
fine, but when I try to ping the board, go to the built in web page, or try
snmp, etc. it completely locks up my board and I am forced to hit the reset
button.  What's more interesting is that when I turn on one of the built in
printf debug statements, it prints messages for random traffic.  Along with
that, if I turn multiple debug options on, aka, cluttering my console with
debug print statements, my application works exactly as intended, just with
a very high ms (around 60+ when it should be <1).

Just to clarify, my bootloader is working exactly as intended with lwip.
The webpage works, I can ping the board, and use telnet.  My application is
exactly the same as my bootloader, it just has snmp added on and a few minor
changes (none that would break lwip since they are unrelated).

Any ideas? What steps could I take to resolve this issue?  I'm not sure if
this is a problem with my lwip settings in my application somehow, or an
issue with something else.  I find it very strange that lwip on my
bootloader works perfectly yet the lwip on my application does not.

Thanks, Nick



--
View this message in context: http://lwip.100.n7.nabble.com/Bootloader-to-Application-lwip-crash-tp29489.html
Sent from the lwip-users mailing list archive at Nabble.com.

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
--
Pozdrawiam,
Krzysztof Wesołowski
+48 721 337 238

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Bootloader to Application + lwip crash

Ajay Bhargav (SiWi)

Are you taking care of relocating your ISR routines or reassign ISR handlers after you switch from bootloader to application? If you’re using ARM are you switching between USER and SVC mode?

 

-Ajay

 

From: [hidden email]
Sent: Tuesday, May 2, 2017 2:58 PM
To: [hidden email]
Subject: Re: [lwip-users] Bootloader to Application + lwip crash

 

Can you load and start application without involving bootloader?

It's quite possible that driver handling hardware init does not work as expected if hw was already configured (i.e. MAC, DMA are already setup and in the middle of operation when application start).

 

On Mon, 1 May 2017, 23:27 nrichard, <[hidden email]> wrote:

Hello,

My project consists of two sub-projects, a bootloader and an application.
My bootloader is programmed at the start of flash, and always starts when
the board is given power.  I also have an application project, that through
my bootloader I use FTP to transfer the image to a certain address.  Then I
can jump to that address and my application starts.  This process works
perfectly fine.

In both my application and my bootloader, I am using lwip version 2.0.2 raw
api for all internet related protocols and applications.  These include ftp,
http, telnet, and snmp.  The bootloader specifically has ftp, http, and
telnet.  The application has ftp, http, telnet, AND snmp.  So other than
snmp, these two projects are nearly identical.

The issue I'm having is that when I jump from my bootloader to my
application, lwip crashes my board.  The initialization works perfectly
fine, but when I try to ping the board, go to the built in web page, or try
snmp, etc. it completely locks up my board and I am forced to hit the reset
button.  What's more interesting is that when I turn on one of the built in
printf debug statements, it prints messages for random traffic.  Along with
that, if I turn multiple debug options on, aka, cluttering my console with
debug print statements, my application works exactly as intended, just with
a very high ms (around 60+ when it should be <1).

Just to clarify, my bootloader is working exactly as intended with lwip.
The webpage works, I can ping the board, and use telnet.  My application is
exactly the same as my bootloader, it just has snmp added on and a few minor
changes (none that would break lwip since they are unrelated).

Any ideas? What steps could I take to resolve this issue?  I'm not sure if
this is a problem with my lwip settings in my application somehow, or an
issue with something else.  I find it very strange that lwip on my
bootloader works perfectly yet the lwip on my application does not.

Thanks, Nick



--
View this message in context: http://lwip.100.n7.nabble.com/Bootloader-to-Application-lwip-crash-tp29489.html
Sent from the lwip-users mailing list archive at Nabble.com.

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

--

Pozdrawiam,

Krzysztof Wesołowski

+48 721 337 238

 


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Bootloader to Application + lwip crash

nrichard
Yes, by itself the application works perfectly fine.  The only thing I change for it to run by itself or after the bootloader is the start flash address being x00430000 instead of x00400000.  I also have a  countdown timer (in the bootloader) on startupt.  If not interrupted by a keyboard press, a few seconds later it goes straight to the application, no initialization of lwip until after the countdown or it hits the application.

Yes, I have a binary execute function (provided by Atmel) that disables interrupts, moves the vector table, re-enables interrupts again, then loads at the address I chose.

I'm working with a Sam4e Xplained Pro. As for switching between USER and SVC mode, I have not seen these before. After looking up what they are, I would assume I am always in USER mode except for when the vector table moves.

I'll check interrupts again.  Enabling the lwip printf debug code makes it work but it's very laggy.  Without it, it does not work.  It sounds like something is not getting interrupted to me and is crashing instead.

contact wrote
Are you taking care of relocating your ISR routines or reassign ISR handlers after you switch from bootloader to application? If you’re using ARM are you switching between USER and SVC mode?

-Ajay

From: Krzysztof Wesołowski
Sent: Tuesday, May 2, 2017 2:58 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] Bootloader to Application + lwip crash

Can you load and start application without involving bootloader?
It's quite possible that driver handling hardware init does not work as expected if hw was already configured (i.e. MAC, DMA are already setup and in the middle of operation when application start).

On Mon, 1 May 2017, 23:27 nrichard, <[hidden email]> wrote:
Hello,

My project consists of two sub-projects, a bootloader and an application.
My bootloader is programmed at the start of flash, and always starts when
the board is given power.  I also have an application project, that through
my bootloader I use FTP to transfer the image to a certain address.  Then I
can jump to that address and my application starts.  This process works
perfectly fine.

In both my application and my bootloader, I am using lwip version 2.0.2 raw
api for all internet related protocols and applications.  These include ftp,
http, telnet, and snmp.  The bootloader specifically has ftp, http, and
telnet.  The application has ftp, http, telnet, AND snmp.  So other than
snmp, these two projects are nearly identical.

The issue I'm having is that when I jump from my bootloader to my
application, lwip crashes my board.  The initialization works perfectly
fine, but when I try to ping the board, go to the built in web page, or try
snmp, etc. it completely locks up my board and I am forced to hit the reset
button.  What's more interesting is that when I turn on one of the built in
printf debug statements, it prints messages for random traffic.  Along with
that, if I turn multiple debug options on, aka, cluttering my console with
debug print statements, my application works exactly as intended, just with
a very high ms (around 60+ when it should be <1).

Just to clarify, my bootloader is working exactly as intended with lwip.
The webpage works, I can ping the board, and use telnet.  My application is
exactly the same as my bootloader, it just has snmp added on and a few minor
changes (none that would break lwip since they are unrelated).

Any ideas? What steps could I take to resolve this issue?  I'm not sure if
this is a problem with my lwip settings in my application somehow, or an
issue with something else.  I find it very strange that lwip on my
bootloader works perfectly yet the lwip on my application does not.

Thanks, Nick


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
--
Pozdrawiam,
Krzysztof Wesołowski
+48 721 337 238


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Bootloader to Application + lwip crash

Ajay Bhargav (SiWi)

You must be getting some kind of exception, If you have a debugger then its better to see what kind of exception it is, and from backtrace log you can figure out where it is generated from. Usually init process is done under supervisory mode where you can access protected CPU registers, setup stack and init interrupt controller and stuff. So while jumping from bootloader to application code CPU must be in supervisory mode.

 

If its working with debug prints then most probably you are facing some kind of race condition which is causing an exception. JTAG debugger is your best friend or long way, you can write your own exception handler to print out application backtrace and figure out the addresses from LIST file.

 

  • Ajay

 

From: [hidden email]
Sent: Tuesday, May 2, 2017 7:29 PM
To: [hidden email]
Subject: Re: [lwip-users] Bootloader to Application + lwip crash

 

Yes, by itself the application works perfectly fine.  The only thing I change

for it to run by itself or after the bootloader is the start flash address

being x00430000 instead of x00400000.  I also have a  countdown timer (in

the bootloader) on startupt.  If not interrupted by a keyboard press, a few

seconds later it goes straight to the application, no initialization of lwip

until after the countdown or it hits the application.

 

Yes, I have a binary execute function (provided by Atmel) that disables

interrupts, moves the vector table, re-enables interrupts again, then loads

at the address I chose.

 

I'm working with a Sam4e Xplained Pro. As for switching between USER and SVC

mode, I have not seen these before. After looking up what they are, I would

assume I am always in USER mode except for when the vector table moves.

 

I'll check interrupts again.  Enabling the lwip printf debug code makes it

work but it's very laggy.  Without it, it does not work.  It sounds like

something is not getting interrupted to me and is crashing instead.

 

 

contact wrote

> Are you taking care of relocating your ISR routines or reassign ISR

> handlers after you switch from bootloader to application? If you’re using

> ARM are you switching between USER and SVC mode?

>

> -Ajay

>

> From: Krzysztof Wesołowski

> Sent: Tuesday, May 2, 2017 2:58 PM

> To: Mailing list for lwIP users

> Subject: Re: [lwip-users] Bootloader to Application + lwip crash

>

> Can you load and start application without involving bootloader?

> It's quite possible that driver handling hardware init does not work as

> expected if hw was already configured (i.e. MAC, DMA are already setup and

> in the middle of operation when application start).

>

> On Mon, 1 May 2017, 23:27 nrichard, &lt;

 

> nrichard@

 

> &gt; wrote:

> Hello,

>

> My project consists of two sub-projects, a bootloader and an application.

> My bootloader is programmed at the start of flash, and always starts when

> the board is given power.  I also have an application project, that

> through

> my bootloader I use FTP to transfer the image to a certain address.  Then

> I

> can jump to that address and my application starts.  This process works

> perfectly fine.

>

> In both my application and my bootloader, I am using lwip version 2.0.2

> raw

> api for all internet related protocols and applications.  These include

> ftp,

> http, telnet, and snmp.  The bootloader specifically has ftp, http, and

> telnet.  The application has ftp, http, telnet, AND snmp.  So other than

> snmp, these two projects are nearly identical.

>

> The issue I'm having is that when I jump from my bootloader to my

> application, lwip crashes my board.  The initialization works perfectly

> fine, but when I try to ping the board, go to the built in web page, or

> try

> snmp, etc. it completely locks up my board and I am forced to hit the

> reset

> button.  What's more interesting is that when I turn on one of the built

> in

> printf debug statements, it prints messages for random traffic.  Along

> with

> that, if I turn multiple debug options on, aka, cluttering my console with

> debug print statements, my application works exactly as intended, just

> with

> a very high ms (around 60+ when it should be <1).

>

> Just to clarify, my bootloader is working exactly as intended with lwip.

> The webpage works, I can ping the board, and use telnet.  My application

> is

> exactly the same as my bootloader, it just has snmp added on and a few

> minor

> changes (none that would break lwip since they are unrelated).

>

> Any ideas? What steps could I take to resolve this issue?  I'm not sure if

> this is a problem with my lwip settings in my application somehow, or an

> issue with something else.  I find it very strange that lwip on my

> bootloader works perfectly yet the lwip on my application does not.

>

> Thanks, Nick

>

>

> _______________________________________________

> lwip-users mailing list

 

> lwip-users@

 

> https://lists.nongnu.org/mailman/listinfo/lwip-users

> --

> Pozdrawiam,

> Krzysztof Wesołowski

> +48 721 337 238

>

>

> _______________________________________________

> lwip-users mailing list

 

> lwip-users@

 

> https://lists.nongnu.org/mailman/listinfo/lwip-users

 

 

 

 

 

--

View this message in context: http://lwip.100.n7.nabble.com/Bootloader-to-Application-lwip-crash-tp29489p29502.html

Sent from the lwip-users mailing list archive at Nabble.com.

 

_______________________________________________

lwip-users mailing list

[hidden email]

https://lists.nongnu.org/mailman/listinfo/lwip-users

 


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users