assembly - gpasm 抛出 "Processor-header file mismatch"和 "Processor type is undefined"错误

标签 assembly microchip

已关注 this question ,我正在尝试汇编 this tutorial 中的示例代码

#include "p10f200.inc"
; CONFIG
    __CONFIG _WDT_OFF & _CP_OFF & _MCLRE_OFF
    ORG 0x0000
INIT ; We are initializing the microcontroller over the next three lines.
    MOVLW ~(1 << GP1)  ;these two lines set GP1 as an output
    TRIS GPIO
    BSF GPIO, GP1 ;this line is where we set GP1 output high to light the LED
LOOP 
    GOTO LOOP                          ; loop forever
END ; Needed to end the program.

我按照 this tutorial 安装了 gputils :

brew install gputils

并且我已正确安装 gpasm-1.5.0 #1285 (Nov 15 2020)。但是当我运行 gpasm -c test001.asm 时,出现以下错误:

/usr/local/Cellar/gputils/1.5.0-1/share/gputils/header/p10f200.inc:34:Message[301] MESSAGE: "Processor-header file mismatch.  Verify selected processor."
/usr/local/Cellar/gputils/1.5.0-1/share/gputils/header/p10f200.inc:113:Error[131]   Processor type is undefined. "__MAXRAM"
/usr/local/Cellar/gputils/1.5.0-1/share/gputils/header/p10f200.inc:114:Error[131]   Processor type is undefined. "__BADRAM"
/usr/local/Cellar/gputils/1.5.0-1/share/gputils/header/p10f200.inc:115:Error[131]   Processor type is undefined. "__BADRAM"
test001.asm:6:Error[131]   Processor type is undefined. "__CONFIG"
test001.asm:7:Error[131]   Processor type is undefined. "ORG"
test001.asm:8:Error[150]   Labels must be defined in a code or data section when making an object file.
test001.asm:9:Error[131]   Processor type is undefined. "MOVLW"
test001.asm:10:Error[131]   Processor type is undefined. "TRIS"
test001.asm:11:Error[131]   Processor type is undefined. "BSF"
test001.asm:12:Error[150]   Labels must be defined in a code or data section when making an object file.
test001.asm:13:Error[131]   Processor type is undefined. "GOTO"
test001.asm:14:Warning[205] Found directive in column 1: "END"

如果您能帮助我了解问题所在以及如何解决它,我将不胜感激。

最佳答案

发现问题了。我应该指定我想要组装的处理器。可以在命令行中执行此操作:

gpasm -c -p p10f200 test001.asm 

或添加行

list p=p10f200

在代码的开头。 加上其他警告:

test001.asm:14:Warning[205] Found directive in column 1: "END"

可以通过在代码末尾的“END”行之前添加制表符来解决。

我用了this forum post作为引用。 gpasm 的文档也是 here .

关于assembly - gpasm 抛出 "Processor-header file mismatch"和 "Processor type is undefined"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68140486/

相关文章:

linux - 使用 kprobes 获取函数参数

c - 排序ARM程序集

assembly - 将两个 32 位带符号数与加法和移位相乘

assembly - 为什么要在汇编中添加一个值来初始化堆栈指针(R7)?

将 uint8_t 转换为 int8_t

c - 为什么在写入寄存器时选择补码