smartworkbr / optiboot

Automatically exported from code.google.com/p/optiboot
0 stars 0 forks source link

Boot firmware if there is unrecognizeable characters streaming onto serial port #53

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Optiboot, like stk500v2, appears to endlessly attempt to parse incoming serial 
traffic before
booting the app.

Can we have an option or a fix that will either timeout and start the app if no 
good bootloader
packets have been found, or some other recognition system that the traffic is 
not meant for the bootloader, that will trigger the app to start anyway.

The reason for this is in an environment with an attached serial device, 
perhaps a radio, there will
be serial traffic on the UART and if there is a reset for whatever reason, this 
traffic will stop the boot loader from booting the firmware.

Original issue reported on code.google.com by justinbe...@gmail.com on 24 Jan 2012 at 1:40

GoogleCodeExporter commented 9 years ago
A good part of how optiboot stays small is that it doesn't have a complete list 
of commands that are "legal" bootloader commands.  It had the few that it 
recognizes, and everything else it just says "yes, I did that."
http://code.google.com/p/arduino/issues/detail?id=368 
(https://github.com/WestfW/Arduino/commit/e81c1123b624b6cac7da018c9c786700f3152b
c9 ) added a feature where if there are uart errors (ie speed mismatch), the 
sketch will be started, so if the sketch operates at different than 115200, you 
should be OK.
I could probably add a check for "carriage return" (which is common in many 
apps, but not used by the bootloader protocol) and treat that as "quit" - that 
might fit.  Do you think it would be sufficient?

Original comment by wes...@gmail.com on 24 Jan 2012 at 6:21

GoogleCodeExporter commented 9 years ago
Thanks for the fast answer.
Unfortunately the stuff that comes in the serial port immediately after warm 
start is a steady stream of binary, not text. And because it is a radio link it 
does need to operate at 115200.

Is there no space to just increment a recognised packet counter, and if after, 
say, 10 seconds, this counter is very low as a percentage of total characters 
received, start the sketch?

Original comment by justinbe...@gmail.com on 24 Jan 2012 at 8:04

GoogleCodeExporter commented 9 years ago
Actually, looking more closely, it SHOULD be starting the sketch if it receives 
any unrecognized command that is not immediately followed by a "space" (0x20).
Do you know what you binary data stream looks like?

Original comment by wes...@gmail.com on 24 Jan 2012 at 4:21

GoogleCodeExporter commented 9 years ago
you are probably right please close the issue I was told the problem was with 
optiboot but now it seems it is just with stk500v2 boot loader so thus issue 
should not have been lodged. sorry! 

Original comment by justinbe...@gmail.com on 24 Jan 2012 at 9:52

GoogleCodeExporter commented 9 years ago
Closed as requested; never was an optiboot issue.

Original comment by wes...@gmail.com on 5 Jan 2013 at 5:47