Syncor Unit Testing Framework, SB700EX, BspGetTickFraction

Discussion to talk about software related topics only.
Post Reply
ssmethurst
Posts: 4
Joined: Tue Jun 29, 2010 2:25 pm

Syncor Unit Testing Framework, SB700EX, BspGetTickFraction

Post by ssmethurst »

Hello

I am attempting to get the "Syncor Unit Testing Framework" working on the SB700EX hardware. I followed the instructions in the screencast and this post "Porting the Syncor Unit Test Framework to a new platform"

But I am getting the following errors

Code: Select all

X:\nburn\NBEclipse\workspace\SyncorUnitTest_Framework\lib\UnitTest++.a(TimeHelpers.o): In function `UnitTest::Timer::GetTimeInTicks() const':
C:\SW_DEV\NBEclipse\NBEclipse_CurrentProjects\UnitTest++\Release/..\src\NetBurner/TimeHelpers.cpp:39: undefined reference to `BspGetTickFraction'
X:\nburn\NBEclipse\workspace\SyncorUnitTest_Framework\lib\UnitTest++.a(TimeHelpers.o): In function `UnitTest::Timer::SetMaxFractionalCount()':
C:\SW_DEV\NBEclipse\NBEclipse_CurrentProjects\UnitTest++\Release/..\src\NetBurner/TimeHelpers.cpp:50: undefined reference to `BspGetTickFraction'
* Note: My nburn directory is on my X drive.
* Note: I do NOT have the source code for TimeHelpers.cpp it is included from a library.

I have attempted a few things to fix this problem, such as adding

Code: Select all

#include <Bsp.h> 
to the "TimeHelpers.h" file. ect...
I am running out of ideas.

* Cross posted to a few different locations *
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: Syncor Unit Testing Framework, SB700EX, BspGetTickFracti

Post by tod »

I am not that familiar with the SB7x family but it most likely uses a different system build (the folders with the _sc suffix). I would have to surmise that in that version the BspGetTickFraction() method does not exist. If that is the case, the fastest fix would be for me to send you the source code to my modified version of the UnitTest++ library. I would ask that you modify it and then upload a working copy of the test framework for the SB7x family.

The original UnitTest++ code assumed Linux functions for timing would be available. When I rewrote it I wanted better than 1 tick resolution for the test runner times, but in 99% of the cases I imagine most folks aren't unit testing time performance. These calls could probably be removed to have no effect, leaving the system with 1 tick resolution. I could have used a timer but that struck me as more system dependent than the approach I took.

If you want the source code use the email link of this forum (click on my hyperlinked name) and let me know and I'll email it to you. In case you want to know what you're getting into; here are the two methods that use BspGetTickFraction(). (The entire Timer class is only 66 lines long and that includes blank lines, comments and includes so it's not too daunting a task. ) SetMaxFractionalCount() was just my crude brute-force way of approximating the max value for the current platform. I apologize for committing the sin of using a "magic number" instead of a named constant but 100000 is just a "big" number and I was being lazy that day.

Code: Select all

	float Timer::GetTimeInTicks() const
	{
		float fract_tick_count = BspGetTickFraction();
		float tick_fraction = fract_tick_count / _maxFractionalCount;
		float real_tick_count = static_cast<float> (TimeTick) + tick_fraction;
		return real_tick_count;
	}

	uint32_t Timer::SetMaxFractionalCount()
	{
		int max_frac = 0;
		for (int i = 0; i < 100000; ++i)
		{
			WORD fract_tick_count = BspGetTickFraction();
			if (fract_tick_count > max_frac) max_frac = fract_tick_count;
		}
		cout << "Max fractional count:" << max_frac << endl;
		_maxFractionalCount = max_frac;
		return max_frac;

	}
ssmethurst
Posts: 4
Joined: Tue Jun 29, 2010 2:25 pm

Re: Syncor Unit Testing Framework, SB700EX, BspGetTickFracti

Post by ssmethurst »

Hello

With the help of Tod I was able to recompile the UnitTest++.a lib for SB700EX
I have updated his example code.

You can download the updated example here
http://s.chipkin.com/files/SyncorUnitTe ... 112013.zip
or
http://goo.gl/iQ8uG


Note: My paths to the nburn directory are based of my X drive or virtual drive.
You my need update the paths to get this example working.

Thank you Tod,
Enjoy.
Post Reply