GP2X Using The 940 Easily


Trenki

Member
Joined
Jun 15, 2006
Messages
114
Age
41
Location
South Tyrol, Italy
Website
www.trenki.net
Hi all!

I am currently working on a framework called "cmd940" which will make using the second CPU a childs play!
You basically define and implement the functions on the 940 and a script will generate a library which you can use in the program for the 920.
From the 920 you then can just call those defined functions as if they would reside on the 920 but they will be executed on the 940.

The following is an example program showing the usage of the library:

CODE

#include "../cmd940/include/cmd940.h"
#include <iostream>

using namespace std;

int main()
{
// initialize framework
if (!cmd940_init("cmd940/bin/code940.bin")) {
cout << "error initializing cmd940" << endl;
return 1;
}

// use framework
int n = 25;
cout << "fibonacci(" << n << ") = " << cmd940::fibonacci(n) << endl;

// deinitialize framework
cmd940_deinit();
}



Isn't that easy?

I'm looking for some beta testers as the framework might still contain unknown bug.
Once it's stable i will release it on my homepage.

I have now published my framework on my homepage here.
 
sounds great, but I wonder, how much speedup will this give? cause if the main CPU has to wait for the second CPU to execute the function, wouldn't it be equally fast to execute that function on the main CPU? In other words, shoudn't the second CPU be doing tasks in the background, so the main CPU can do something else?
 
I would imagine it depends on how you code your functions?

i.e. You start a command going using this method and it will run independantly on the 940?

And carry right on with the next instruction on the 920?
 
STTrife said:
sounds great, but I wonder, how much speedup will this give? cause if the main CPU has to wait for the second CPU to execute the function, wouldn't it be equally fast to execute that function on the main CPU? In other words, shoudn't the second CPU be doing tasks in the background, so the main CPU can do something else?
The example might be a bit misleading in this context. Since the function has a return value other than void it waits for the 940 to complete and return the result.
The other case is where the function has void as the "return value". In this case the function is executed asynchronously.
 
Last edited by a moderator:
Ok, I've fixed some issues with region and cache setup and with enabling the protection unit and stuff. Region setup was incorrect for the 1M Ringbuffer and GCC had a compiler but which caused the program not to work when optimization was disabled. The newest framework is now online! Please redownload if you already got this.
 
Looks interesting, I'll definitely use this if I code anything that needs the 940.
 
I worked on this for some more as there still were issuse with release vs. debug build. Now it finally seems fixed (at least I hope so). Please redownload to get the newest version.
 
Back
Top