This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

堆栈指针加减运算指令是16位还是20位?

在IAR平台调试程序时,发现对于堆栈指针(SP)的加减运算时,反汇编窗口中显示的汇编代码是adda和suba这样的20位地址运算,为什么我看到别人的汇编代码中却是add和sub这样的16位操作运算,CPU为430F5438A,数据模式和代码模式都选择的是Large,有什么设置可以在“数据模式和代码模式都是Large”的情况下,让编译器将对于SP的操作采用16位运算符

  • 关于这个您可以看一下user's guide 内的 第6章 CPUX

    对于--code_model

             - small for a CPU module (16-bit register / address bus) 

             -large for a CPUX module (20-bit registers / address bus).

  • 为了确认使用中的实际设置您可以点击
    CCS Project Properties -> CCS Build -> MSP430 Compiler -> Advanced Options -> Assembler Options -> Generate listing file (--asm_listing, -al) .
    生成的.lst文件会报告编译器使用的内存模型。