Testing firmware

China☆狼群 提交于 2019-12-18 12:42:06

问题


This follows a couple of other questions (but I think I have refined my question better).

I want to test out my firmware code before I put on the device.

I realize that a lot of people write their code, upload, test, etc. But I really want to write and test before upload (mainly because I want to automate the many scenarios).

So, what is the best way of doing this. If I were writing pure software, as in, no firmware at all, I would go about it by using cppunit (for example). But I'm a little lost with this firmware thing.

Any ideas?

Thanks


回答1:


Well it is hard to say without knowing how your code is architected, but basically you could test the software at the class/function level just like other software. Any code that interfaces with the device would most likely need to be tested via emmulation.




回答2:


I don't think the answer marked as "correct" is at all correct or complete.

For firmware code, you really MUST conduct a two-pronged test to be rigorous.

  1. Initial tests done using an emulator. This is ideal but presumes you can get a good emulator for the target platform.

  2. Test on the actual hardware, but in a test bed framework. That is, you test on the actual device, but with additional hardware (i.e. oscilloscope, probes) and other connections to allow proper trace/debug on what's happening.

With firmware, often the most difficult bugs are timing related, and only show up once you are on the actual hardware. In the worst cases, the actual act of probing can alter timings such that the bugs won't appear - only in the "production" version. Then you have real fun.

Cheers,

-Richard




回答3:


Many embedded devices have software simulators available, but it does depend on the device.




回答4:


You should unit test your classes as much as you can, but at the end of the day, you must run it and test it in the hardware.

To test your firmware in a device write a debugging interface so that you can use a terminal emulator like procomm to talk to your device. Then, when you are writing a feature, have a way for your debugging interface to call methods in your class, that way you can specifically test your code in the device itself.

Once you have that done, you can write scripts in your terminal emulator to do the tests automatically.



来源:https://stackoverflow.com/questions/451984/testing-firmware

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!