-
Notifications
You must be signed in to change notification settings - Fork 6
Unit Tests
The MoMo build system includes support for automatic unit tests on both PIC24 and PIC12 architectures. This document details setting up the required environment in order for unit testing to work.
We use gpsim as the simulator for all of the 8-bit PICs that we support. Unfortunately, there are some bugs in gpsim so we use a patched version until those bugs are fixed upstream. To install gpsim you need to pull the code from svn and then patch it. In what follows we will assume that you start in the parent directory to where MoMo-Firmware is cloned. You need to have svn installed to get the gpsim source code and a decent C++ build environment to build it.
> ls
MoMo-Firmware
> mkdir gpsim
> cd gpsim
> svn checkout svn://svn.code.sf.net/p/gpsim/code/trunk .
<Lots of text as the checkout proceeds>
> patch -p0 -i ../MoMo-Firmware/support/gpsim-svn-fixes.patch
patching file src/14bit-hexdecode.cc
patching file src/14bit-instructions.h
patching file src/pic-instructions.ccIf the patch applied cleanly that you're good to go and can build and install gpsim wherever you like. It does not need to be in your PATH.
> ./configure
> make
> make installYou need to tell the MoMo build system where gpsim is by editing config/settings.local.json. Create it if it doesn't exist and edit to look like:
> cd MoMo-Firmware
> cat config/settings.local.json
{
"external_tools":
{
"eagle": "<path to EAGLE CAD editor if you want to use the circuit functionality of MoMo",
"gpsim": "<path to gpsim>",
"sim30": "<path to sim30, described in 16-bit testing>"
}
}> cd momo_modules/pic12_executive
> momo build test
<Lots of text as the unit tests are compiled and run>
> cat build/test/output/results.txt
Test Summary
## Target exec ##
30/30 tests passed (100% pass rate)If you don't get any build errors and all of the tests pass then your version of gpsim is correctly patched and you're ready to go.
TDB once we get the 16-bit simulator support up and running.