起因::新建capl脚本后在添加系统事件on start时,on底下出现波浪线,这意味着有错误。把鼠标放在波浪线上面提示:system event handler not allowed in test module or test units(系统事件不允许用在test module或者 test units)
原因::这是因为capl脚本有两类用处,一种就是常用的绑定在节点里运行;另一种就是用于test module 或者test unit作自动化测试的,正如提示语那样。
用于test module 或者test unit的脚本会有一点不同,如下图:
而一般的脚本形式则没有多出来的那些东西,以此来辨认
解决方法:
先在simulation setup里insert network node,然后点击左下角的小笔符号,直接创建并绑定一个.can脚本,在这里面编写就不会报类似的错了
如果有用,请留下一个赞,说不定以后大家都是同事哈哈