如何使 MPLAB 导入带注释的 HEX 文件或导入命令行上指定的 HEX 文件?

发布于 2024-08-07 09:23:44 字数 488 浏览 9 评论 0原文

我正在使用 CCS c 编译器,它以 Intel 32 位十六进制格式(又名 INHX32)生成目标文件。该编译器有一个指令,可以使其在这些文件中添加注释。注释行位于文件的开头,以分号开头,如下所示:

;  This is a comment
:020000040000FA
:1000000007EF33F0000C000C056ED8CF06F0E0CF00
:1000100007F00001E9CF0DF0EACF08F0E1CF09F0D9

我想使用此指令,因为注释对于稍后将十六进制文件导入 MPLAB 的人来说非常有用。但是,MPLAB 不会导入带有注释的文件。当我尝试时,收到“文件格式无效,信息不可用”错误。

我意识到这些注释行不是原始英特尔规范的一部分,但其他一些编译器和开发工具接受它们。有没有办法让 MPLAB 这样做?

我可以编写一个脚本来删除这些行,然后将生成的文件传递给 MPLAB,但据我所知,MPLAB 无法通过命令行导入文件。

I'm working with the CCS c compiler which produces its object files in the Intel 32 bit HEX format, aka INHX32. This compiler has a directive which causes it to put comments in these files. The comment lines are at the beginning of the file, and begin with a semicolon, like so:

;  This is a comment
:020000040000FA
:1000000007EF33F0000C000C056ED8CF06F0E0CF00
:1000100007F00001E9CF0DF0EACF08F0E1CF09F0D9

I'd like to use this directive, as the comments would be extremely useful to those who later import the hex files into MPLAB. However, MPLAB will not import files with comments. When I try, I get an "Invalid file format, information not available" error.

I realize these comment lines are not part of the original Intel spec, but some other compilers and development tools accept them. Is there any way to make MPLAB do so?

I could write a script that would strip these lines out and then pass the resulting file to MPLAB, but as far as I can tell MPLAB can't import a file via the commandline.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

巨坚强 2024-08-14 09:23:44

某些版本的 MPLAB 接受注释和文件的结尾
在 CCS 中,#HEXCOMMENT\(带有反斜杠)将注释放在十六进制文件的末尾。

Some versions of MPLAB accept comments and the end of the file.
In CCS, The #HEXCOMMENT\ (with a back slash) puts the comment at the end of the hex file.

清风无影 2024-08-14 09:23:44

随机的东西...

  1. 是否有一个编译器标志可以在对象中禁用此注释?这将是最好的起点。

  2. 如果不是这样,IDE 的 C 插件是否允许您在其中添加后处理器?如果像上面这样,你就可以轻松地写一个评论吃者了。

Random stuff...

  1. Is there a compiler flag that disables this comment in the object? That would be the best place to start.

  2. If not that, does the IDE's C plug-in let you add a post-processor in it? If it's as above, you could write a comment eater easily.

猫烠⑼条掵仅有一顆心 2024-08-14 09:23:44

事实证明,MPLAB 绝对不会从命令行进行导入(或其他操作)。所以我编写了一个 AutoIt 脚本来删除注释,并将其余部分保存在临时文件中。然后,它通过控制 MPLAB 的 GUI 将该文件导入 MPLAB。

这实际上比让 MPLAB 直接导入文件更好,因为我的脚本在对话框中显示注释,因此用户无需在编辑器中打开文件来读取它们。

It turns out MPLAB definitely doesn't do imports (or much else) from the commandline. So I wrote an AutoIt script to strip the comments, and save the rest in a temporary file. Then it imports that file into MPLAB by controlling MPLAB's GUI.

This is actually better than getting MPLAB to import the file directly, since my script displays the comments in a dialog so there is no need for the user to open the file in an editor to read them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文