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.

[参考译文] TMS320F28379D:DSS 将栈变量传递给函数

Guru**** 1821780 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1423659/tms320f28379d-dss-pass-stack-variable-to-function

器件型号:TMS320F28379D

工具与软件:

我将使用 DSS 在 Jython 中编写单元测试脚本。

我想调用以下方法:

//
// Function to read a single Uint32 from the external flash
// - base is the SPI base address
// - endianness indicates little or big endian (TI C200 is little endian)
// - address is the byte address of the external flash to read from
// Returns the read 32-bit value
//
Uint32 SPI_read32bits(Uint32 base, SPI_endianess endianness, Uint32 address)
{
    Uint32 RXdata = 0;

    CS_LOW;

    // Send the READ4 opcode.
    SPI_transmitByte(base, READ4);

    // Send flash address to read data
    SPI_transmit32Bits(base, address, NO_DELAY);

    // Receive data 32-bit word from flash by sending four dummy bytes
    RXdata = SPI_receive32Bits(base, endianness, DUMMY_DATA, NO_DELAY);

    CS_HIGH;

    return RXdata;
}

如果我在 Code Composer 调试器中加载应用、可以看到参数"base"存储在寄存器"AL"中、参数"endiannems"存储在寄存器"XAR4"中。  但我不确定如何设置参数"address":

# go to the SPI_read32bits() function
debug_session.memory.writeRegister("PC", 0x8c3e1)

# pass the variables via registers
debug_session.memory.writeRegister("AL", EPPSDefines.SPIB_BASE)             # SPIB_BASE = 0x00006110
debug_session.memory.writeRegister("XAR4", EPPSDefines.SPI_DATA_BIG_ENDIAN) # SPI_DATA_BIG_ENDIAN = 1

我可以看到"SP"寄存器当前是0x40E:

是否可以使用 SP 寄存器值和 memory.writeData ()保存"address"参数值?

sp_value = debug_session.memory.readRegister("SP")
debug_session.memory.writeData(Memory.Page.PROGRAM, ???, 0x40000, 32)

当我逐步执行汇编步骤时、我可以看到如何使用传入的参数更新堆栈:

谢谢!

Diane

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Diane、您好!

    为了澄清这一点、您只是在寻找一种使用 DSS 从堆栈中读取值的方法、对吗?

    谢谢!

    Luke

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Luke、

    不、我要把一个变量压入堆栈、这样该变量可用作函数参数。

    谢谢!

    Diane

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    否、我正尝试将一个变量推入堆栈、以便该变量可用作函数参数。

    通过 DSS 无法方便地执行此操作。 但是、您使用 DSS 存储器 API 来访问相关寄存器和存储器位置是正确的。  

    器件专家应能够提供要修改的寄存器/存储器、以便对此进行仿真(我会提请他们注意该主题)。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Diane、您好!

    该主题的相关专家将在10月25日前不在办公室、请预计下周初回复。

    谢谢!

    Luke

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    有任何相关更新?

    谢谢

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我没有为您提供任何进一步的建议。