Quartus Prime System Console中TCL脚本exit命令无法识别终止失败问题
问题原因
Quartus Prime Standard的System Console采用基于Java实现的TCL运行环境(JACL),未兼容标准TCL的exit内置命令,因此直接调用exit会触发无效命令报错,报错信息如下:
May 10, 2021 4:01:35 PM com.altera.debug.core SEVERE: java.lang.Exception: invalid command name "exit" while executing "exit " invoked from within "if {$use_specified_base_addresses == 1} { puts "using predefined peripheral base addresses" # Peripheral address offset from taken from ..."
解决方案
根据终止需求分为两种场景选择对应实现方式:
- 仅终止当前运行的TCL脚本、不退出System Console控制台
你需要的「捕获错误后停止脚本运行」需求,可直接使用error命令主动抛出终止级错误实现,和catch逻辑适配的示例代码如下:
如果逻辑写在自定义过程内部,也可以用# 捕获过程调用的错误 if {[catch {调用你的自定义过程} error_info]} { puts "执行出错,错误信息:$error_info" # 主动抛出错误终止后续脚本执行 error "脚本因执行异常主动终止" }return -code error "终止信息"实现相同效果。 - 需要完全退出System Console程序
直接替换原exit命令为System Console专属内置退出命令quit即可正常执行。
内容的提问来源于stack exchange,提问作者quantum231
相关产品推荐
相关产品推荐

