工具与软件:
我将使用 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