RedBoot 停止在任何输入上启动

RedBoot stops booting on any input

我的嵌入式板的引导加载程序有问题。有时重启后无法开机

问题已被追踪到 RedBoot,它等待 (0.1s) "ctrl-C" 中止启动并进入交互模式,您可以在其中编辑它。问题是,虽然在未连接的串行控制台上随机出现 "ctrl-C" 字符的可能性极小,但 任何随机 字符有时会被诱导 "out of air",然后 RedBoot 停止在提示“== 在 0.100 秒内执行启动脚本 - 输入 ^C 中止”,直到任一者按下回车键,删除有问题的字符(使用退格键)或使用 ctrl-C 进入 RedBoot。

有没有什么方法可以禁用此 "feature" 而不会完全禁用到达 "RedBoot>" 提示符的能力​​?

一个老线程,但我刚遇到完全相同的问题。在我的例子中,这是因为 Redboot 控制台串行端口绑定到另一个同时启动的嵌入式 Windows 系统。在这种情况下,串行端口上的短暂噪音总是可以保证的,Redboot 总是会卡住,如原始问题所述!

我的修复非常简单 - 在 main.c 中,函数 cyg_start():

diff --git a/packages/redboot/current/src/main.c b/packages/redboot/current/src/main.c
index 0531dcc..9b1ce97 100644
--- a/packages/redboot/current/src/main.c
+++ b/packages/redboot/current/src/main.c
@@ -356,26 +356,11 @@ cyg_start(void)
 # endif
     if (script) {
         // Give the guy a chance to abort any boot script
-        char *hold_script = script;
         int script_timeout_ms = script_timeout * CYGNUM_REDBOOT_BOOT_SCRIPT_TIMEOUT_RESOLUTION;
         diag_printf("== Executing boot script in %d.%03d seconds - enter ^C to abort\n", 
                     script_timeout_ms/1000, script_timeout_ms%1000);
-        script = NULL;
-        res = _GETS_CTRLC;  // Treat 0 timeout as ^C
-        while (script_timeout_ms >= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) {
-            res = _rb_gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT);
-            if (res >= _GETS_OK) {
-                diag_printf("== Executing boot script in %d.%03d seconds - enter ^C to abort\n", 
-                            script_timeout_ms/1000, script_timeout_ms%1000);
-                continue;  // Ignore anything but ^C
-            }
-            if (res != _GETS_TIMEOUT) break;
-            script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT;
-        }
-        if (res == _GETS_CTRLC) {
+        if (_rb_break(script_timeout_ms)) {
             script = NULL;  // Disable script
-        } else {
-            script = hold_script;  // Re-enable script
         }
     }
 #endif

如果需要,CTRL-C 仍可用于中止引导脚本,但任何其他字符(包括由噪声创建的虚假字符)会立即被解释为超时。在我的场景中,这是完美的,因为您唯一希望能够键入 CTRL-C 的情况是,如果您手动重置 Redboot 板并在嵌入式 Windows 系统上打开串行控制台以观察发生了什么。