Skip to contentSkip to conversation

tools: kwboot: Allow to specify custom baudrate only in supported operations

PATCH Superseded Pali Rohár 3 participants 3 messages Mar 6, 2022 – Mar 7, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: kwboot: Allow to specify custom baudrate only in supported operations

Custom baudrate different than 115200 may be specified only when kwboot is not going to send boot/debug message pattern or when it is going to send boot message pattern with image file (in which case baudrate change happens after sending kwbimage header). BootROM detects boot/debug message pattern only at baudrate 115200.

---
 tools/kwboot.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/kwboot.c +4 -0
index 69d1be0f4823..f975c4a6c6ca 100644
@@ -2128,6 +2128,10 @@ main(int argc, char **argv)
 	if (!bootmsg && !term && !debugmsg && !imgpath)
 		goto usage;
 
+	/* boot and debug message use baudrate 115200 */
+	if (((bootmsg && !imgpath) || debugmsg) && baudrate != 115200)
+		goto usage;
+
 	ttypath = argv[optind++];
 
 	if (optind != argc)
Signature · 1 line
2.20.1
#1 lore raw
Quoted 16 lines · On Sun, 6 Mar 2022 13:38:30 +0100 Pali Rohár <[email protected]> wrote:

Custom baudrate different than 115200 may be specified only when kwboot is not going to send boot/debug message pattern or when it is going to send boot message pattern with image file (in which case baudrate change happens after sending kwbimage header). BootROM detects boot/debug message pattern only at baudrate 115200.

---
 tools/kwboot.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/kwboot.c +0 -0
index 69d1be0f4823..f975c4a6c6ca 100644

tools/kwboot.c main(int argc, char **argv) · line 2133

Quoted 6 lines
tools/kwboot.c +3 -0
@@ -2128,6 +2128,10 @@ main(int argc, char **argv)
 	if (!bootmsg && !term && !debugmsg && !imgpath)
 		goto usage;
 
+	/* boot and debug message use baudrate 115200 */
+	if (((bootmsg && !imgpath) || debugmsg) && baudrate != 115200)
+		goto usage;

Maybe this should print an actual error message describing the problem? Otherwise the user might not understand why they are getting usage...

Marek

#2 lore raw
Quoted 22 lines · Marek Behún
Quoted 19 lines · On Sun, 6 Mar 2022 13:38:30 +0100 Pali Rohár <[email protected]> wrote:

Custom baudrate different than 115200 may be specified only when kwboot is not going to send boot/debug message pattern or when it is going to send boot message pattern with image file (in which case baudrate change happens after sending kwbimage header). BootROM detects boot/debug message pattern only at baudrate 115200.

---
  tools/kwboot.c | 4 ++++
  1 file changed, 4 insertions(+)
tools/kwboot.c +0 -0
index 69d1be0f4823..f975c4a6c6ca 100644
@@ -2128,6 +2128,10 @@ main(int argc, char **argv)
  	if (!bootmsg && !term && !debugmsg && !imgpath)
  		goto usage;
 
Quoted 6 lines

tools/kwboot.c main(int argc, char **argv) · line 2133

Quoted 3 lines
tools/kwboot.c +3 -0
+	/* boot and debug message use baudrate 115200 */
+	if (((bootmsg && !imgpath) || debugmsg) && baudrate != 115200)
+		goto usage;

Maybe this should print an actual error message describing the problem? Otherwise the user might not understand why they are getting usage...

I agree. Such more detailed infos are always helpful.

Thanks,
Stefan