copying an existing module...

New to XMOS and XCore? Get started here.
soundhound
Member
Posts: 11
Joined: Thu Mar 08, 2018 4:07 pm

copying an existing module...

Postby soundhound » Wed Mar 14, 2018 2:47 am

when I copy a system module (which I need to make modifications to), I try to put it in my project but it disallows that and insists on the workspace level.
I give it a unique name.
but when I compile my project I get
"*** Multiple copies of module_usb_audio found: ............"
so the newly named module is treated as if it were not unique.

I didn't find anything relevant in the xtc manual about to make a copy unique.
can anyone say what the correct procedure is?
User avatar
mon2
XCore Legend
Posts: 1298
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Postby mon2 » Wed Mar 14, 2018 4:02 am

I would just make a copy of the reference (original) module you wish to retain as a backup somewhere safe.

Then proceed to modify the original single module to suit. You can view the folder details for the module by right click on the module name and then selecting properties.

----

The following method appears to work ok (although there may be better ways to do the same):

1) right mouse-click on the module you wish to copy -> copy -> paste in the project tree -> the copy will be named as a copy but you should be able to rename to suit

2) now locate the original module you just copied using the right mouse click and properties -> enter that location and delete and/or copy to another location this module folder to remove the copy from the project

3) go back to your IDE -> project tree and save & refresh (to be safe) -> compile away

this worked fine to compile without raising the duplicate module error.
soundhound
Member
Posts: 11
Joined: Thu Mar 08, 2018 4:07 pm

Postby soundhound » Wed Mar 14, 2018 12:30 pm

thanks for the suggestion.
I'm confused about this:
"2) now locate the original module you just copied using the right mouse click and properties -> enter that location and delete and/or copy to another location this module folder to remove the copy from the project"

you're talking about the original module at the beginning but by the end you're are talking about the copy!
are you suggesting to, outside of xtc (explorer), move the original module directory tree from its workspace?
Last edited by soundhound on Wed Mar 14, 2018 12:39 pm, edited 1 time in total.
User avatar
mon2
XCore Legend
Posts: 1298
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Postby mon2 » Wed Mar 14, 2018 12:37 pm

1) Use the Windows file manager and make a copy of the original module so that you have it in case it needs to be restored.

2) After making this copy somewhere safe, delete the original module. Now that module will no longer be referenced in your project.

3) Like "Highlander", "there can be only one" copy of the module in the project tree. Now it should be ok to use your version of the copied module in your project tree.
soundhound
Member
Posts: 11
Joined: Thu Mar 08, 2018 4:07 pm

Postby soundhound » Wed Mar 14, 2018 5:35 pm

I need the original module for the other xmos apps.
it would be better to identify what it is about a 'module' that xtc is using as its identity...
I've had nothing but problems with xtc/eclipse in my short acquaintance with it (and trying to do the simplest of things too).
I became aware of eclipse back in my dev days at its inception and managed to resist the hype and stick with emacs.
I cannot help but think I made the right decision!
User avatar
akp
XCore Addict
Posts: 209
Joined: Thu Nov 26, 2015 11:47 pm

Postby akp » Wed Mar 14, 2018 5:55 pm

When I do this I rename the module I touch using the eclipse rename function, and make all the necessary changes to the module_build_info(s) and Makefile.. so you will probably have to rename multiple modules' module_build_info files if they depend on your renamed & touched module. Then you can re-import the old module (with its old name) for the other projects in the same workspace, and they won't know the difference.

E.g. I modified both the ethernet module and the xtcp module. I added underscore after the name, so the akp lib_ethernet is called lib_ethernet_ and the akp lib_xtcp is named lib_xtcp_ Obviously you can name them to whatever makes sense for you. I changed the module_build_info for lib_xtcp_ to reference lib_ethernet_ rather than lib_ethernet, and I updated my project Makefile to reference lib_ethernet_ and lib_xtcp_ then everything built and was very happy.
soundhound
Member
Posts: 11
Joined: Thu Mar 08, 2018 4:07 pm

Postby soundhound » Wed Mar 14, 2018 6:56 pm

the module_build_info is empty and there is no Makefile (it's a source module apparently).
I can find nothing that differentiates it.
I did try your method - it didn't work for me.
I notice that copied apps and modules, even after renaming, retain a suffix related to their origin. for instance
'my-module_usb_audio [sc_usb_audio - usb_audio6.15.2]'
that was called 'app_usb_aud_l2 [sc_usb_audio - usb_audio6.15.2]'
I cannot find any file that records this heritage nor anywhere in the project properties.
clearly there is a level of hidden metadata that xtc/eclipse does not believe the user should be able to meddle with!
soundhound
Member
Posts: 11
Joined: Thu Mar 08, 2018 4:07 pm

Postby soundhound » Wed Mar 14, 2018 10:51 pm

actually I didn't follow your instructions exactly by not adding the suffix underscore and instead adding a prefix.
it turns out a system makefile looked for matches to the end of a path.
hence it equated x/y/z/CRAP to x/y/z/MY_CRAP
and that's how it decides one module is equal to another.

Who is online

Users browsing this forum: No registered users and 13 guests