裸机系统的软件测试

时间:2022-06-03 11:59:08

I am writing a project in C++ for an embedded system with no OS support; almost no library support. Very bare-metal. Hence, a fair amount of my code is tightly coupled(e.g., software triggered interrupts and the layer directly above them).

我正在用C ++编写一个没有OS支持的嵌入式系统项目;几乎没有图书馆支持。非常裸露的金属。因此,相当数量的我的代码紧密耦合(例如,软件触发的中断和它们正上方的层)。

Part of what I am doing involves changing the serial port configuration, thus driving concurrent change on the PC end (the UI end) and the microprocessor(the activity end). I'm doing okay so far in a super-careful incremental type development(piece by piece fitting it in). However, I'd like to be more confident about my code working in an engineering sense.

我正在做的部分工作涉及改变串口配置,从而推动PC端(UI端)和微处理器(活动端)的并发更改。到目前为止,我在一个非常谨慎的增量型开发中做得很好(逐件拟合它)。但是,我希望对我在工程意义上工作的代码更有信心。

What kind of methodologies/frameworks would you recommend for this kind of situation?

对于这种情况,您会推荐哪种方法/框架?

Edit:

I use the AMD186 ES on an ACore86 board made by Tern, Inc. Compiler: Paradigm, free edition(ships with the board). I don't have an option to change what I'm working on, unfortunately.

我在Tern,Inc。制造的ACore86板上使用AMD186 ES。编译器:Paradigm,免费版(随板提供)。不幸的是,我没有选择改变我正在做的工作。

5 个解决方案

#1


2  

The lack of infrastructure in a bare metal environment is pretty challenging. I'd recommend you focus on debugging tools. Even with great care and excellent methodology, you'll need the ability to debug things.

裸机环境中缺乏基础设施非常具有挑战性。我建议你专注于调试工具。即使非常谨慎和优秀的方法,您也需要能够进行调试。

It would behoove you to get gdbagent working. You'll need to implement this yourself, but it is a simple text-based protocol. You run gdb on an external machine and communicate with the gdbagent on your target. You certainly could run the gdbagent protocol over the serial port, but this rapidly becomes tedious when large amounts of data need to be examined. If you have a faster interface available, take advantage of it.

你应该让gdbagent工作。您需要自己实现它,但它是一个简单的基于文本的协议。您在外部计算机上运行gdb并与目标上的gdbagent进行通信。您当然可以通过串行端口运行gdbagent协议,但是当需要检查大量数据时,这很快就会变得乏味。如果您有更快的界面,请充分利用它。

I don't know what your budget is, but you should also plan for a JTAG debugger. gdbagent is great so long as your gdbagent on the target is able to run. If everything crashes hard, you're toast. JTAG debuggers are enormously expensive, but can be rented. I've used Corelis products in the past, and I've heard good things about Abatron.

我不知道您的预算是多少,但您还应该计划JTAG调试器。只要目标上的gdbagent能够运行,gdbagent就很棒。如果一切都很难崩溃,你就会敬酒。 JTAG调试器非常昂贵,但可以租用。我过去使用过Corelis产品,我听说过Abatron的好消息。

#2


1  

I think you're best bet is to work with the vendor of your compiler to get a device simulator.

我认为您最好的选择是与编译器的供应商合作以获得设备模拟器。

Tessy supposedly works with that chip. Check out: http://www.hitex.us/products.html?con_186.html~content

据说Tessy可以使用该芯片。查看:http://www.hitex.us/products.html?con_186.html〜content

#3


1  

When timing is important I like to use a free I/O pin or two and a scope together to instrument the code. I'm also a fan of the JTAG port for source-level debugging. You can also have the microprocessor store a vector of data and send it back over a second uart (if you have one) to the PC for analysis.

当时序很重要时,我喜欢使用一个或两个*I / O引脚和一个范围来检测代码。我也是用于源级调试的JTAG端口的粉丝。您还可以让微处理器存储数据向量,并通过第二个uart(如果有的话)将其发送回PC进行分析。

#4


0  

Something that I've seen done in this sort of area is unit testing.

我在这类领域看到过的东西是单元测试。

No, I'm not joking.

不,我不是在开玩笑。

Unit tests run on the device, under the control of the host PC.

在主机PC的控制下,在设备上运行单元测试。

You write a wrapper to ley load programs into SRAM under unit test control.

您可以在单元测试控制下编写一个包装器,以便将程序加载到SRAM中。

Then your PC can send a program, run it and check the output.

然后你的电脑可以发送一个程序,运行它并检查输出。

If you need to exercise your board , get a labjack or similar USB interface card.

如果您需要锻炼您的电路板,请获取一个labjack或类似的USB接口卡。

Now that's the hardware in a test jig, all run from yours host PC.

现在这是测试夹具中的硬件,都是从你的主机PC运行的。

#5


0  

One thing I've done with some success was to design a PC environment where code can be compiled with C++ for the PC and tested, and then later compiled with "straight" C to run on the embedded system. I/O port references are #defined to be property accesses for an I/O object, which are then sent via socket to a "hardware emulation" program. Parts of the system ended up being clunkier than I would have liked, but I expect succeeding versions will be less clunky.

我取得一些成功的一件事是设计一个PC环境,其中代码可以用C ++编译用于PC并进行测试,然后用“直”C编译以在嵌入式系统上运行。 I / O端口引用#defined是I / O对象的属性访问,然后通过套接字发送到“硬件仿真”程序。系统的某些部分最终变得比我想要的更笨,但我预计成功的版本将不那么笨重。

#1


2  

The lack of infrastructure in a bare metal environment is pretty challenging. I'd recommend you focus on debugging tools. Even with great care and excellent methodology, you'll need the ability to debug things.

裸机环境中缺乏基础设施非常具有挑战性。我建议你专注于调试工具。即使非常谨慎和优秀的方法,您也需要能够进行调试。

It would behoove you to get gdbagent working. You'll need to implement this yourself, but it is a simple text-based protocol. You run gdb on an external machine and communicate with the gdbagent on your target. You certainly could run the gdbagent protocol over the serial port, but this rapidly becomes tedious when large amounts of data need to be examined. If you have a faster interface available, take advantage of it.

你应该让gdbagent工作。您需要自己实现它,但它是一个简单的基于文本的协议。您在外部计算机上运行gdb并与目标上的gdbagent进行通信。您当然可以通过串行端口运行gdbagent协议,但是当需要检查大量数据时,这很快就会变得乏味。如果您有更快的界面,请充分利用它。

I don't know what your budget is, but you should also plan for a JTAG debugger. gdbagent is great so long as your gdbagent on the target is able to run. If everything crashes hard, you're toast. JTAG debuggers are enormously expensive, but can be rented. I've used Corelis products in the past, and I've heard good things about Abatron.

我不知道您的预算是多少,但您还应该计划JTAG调试器。只要目标上的gdbagent能够运行,gdbagent就很棒。如果一切都很难崩溃,你就会敬酒。 JTAG调试器非常昂贵,但可以租用。我过去使用过Corelis产品,我听说过Abatron的好消息。

#2


1  

I think you're best bet is to work with the vendor of your compiler to get a device simulator.

我认为您最好的选择是与编译器的供应商合作以获得设备模拟器。

Tessy supposedly works with that chip. Check out: http://www.hitex.us/products.html?con_186.html~content

据说Tessy可以使用该芯片。查看:http://www.hitex.us/products.html?con_186.html〜content

#3


1  

When timing is important I like to use a free I/O pin or two and a scope together to instrument the code. I'm also a fan of the JTAG port for source-level debugging. You can also have the microprocessor store a vector of data and send it back over a second uart (if you have one) to the PC for analysis.

当时序很重要时,我喜欢使用一个或两个*I / O引脚和一个范围来检测代码。我也是用于源级调试的JTAG端口的粉丝。您还可以让微处理器存储数据向量,并通过第二个uart(如果有的话)将其发送回PC进行分析。

#4


0  

Something that I've seen done in this sort of area is unit testing.

我在这类领域看到过的东西是单元测试。

No, I'm not joking.

不,我不是在开玩笑。

Unit tests run on the device, under the control of the host PC.

在主机PC的控制下,在设备上运行单元测试。

You write a wrapper to ley load programs into SRAM under unit test control.

您可以在单元测试控制下编写一个包装器,以便将程序加载到SRAM中。

Then your PC can send a program, run it and check the output.

然后你的电脑可以发送一个程序,运行它并检查输出。

If you need to exercise your board , get a labjack or similar USB interface card.

如果您需要锻炼您的电路板,请获取一个labjack或类似的USB接口卡。

Now that's the hardware in a test jig, all run from yours host PC.

现在这是测试夹具中的硬件,都是从你的主机PC运行的。

#5


0  

One thing I've done with some success was to design a PC environment where code can be compiled with C++ for the PC and tested, and then later compiled with "straight" C to run on the embedded system. I/O port references are #defined to be property accesses for an I/O object, which are then sent via socket to a "hardware emulation" program. Parts of the system ended up being clunkier than I would have liked, but I expect succeeding versions will be less clunky.

我取得一些成功的一件事是设计一个PC环境,其中代码可以用C ++编译用于PC并进行测试,然后用“直”C编译以在嵌入式系统上运行。 I / O端口引用#defined是I / O对象的属性访问,然后通过套接字发送到“硬件仿真”程序。系统的某些部分最终变得比我想要的更笨,但我预计成功的版本将不那么笨重。