Why cant I get two mex files to save their generated content in two places.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why cant I get two mex files to save their generated content in two places.

1,307 Views
anthonygarza
Contributor I

I do not get it, I have tried over and over again to get this to work but as usual it just falls.....SHORT

 

I have two .mex files I want one to create files in one directory and the other to change files in another. I have edited the xml files fifty times and the tool just comes in and stomps on it every time. No matter what I do. I have one excluded from the build and it still just always puts them in the first directory. 

 

I just do not get the limitation

 

Projects have multiple configurations why wouldnt the tool support this????????

0 Kudos
4 Replies

1,260 Views
anthonygarza
Contributor I

Using MCU Expresso

How exactly do I get the different mex files to output their board files to different directories? 

0 Kudos

1,241 Views
Petr_H
NXP Employee
NXP Employee

Hi,

it's little bit complex so I try to describe individual issues one by one.

Multiple configurations for one project

Unfortunately, in MCUXpresso IDE, there is a limitation, it's not expected to have multiple .mex files in the root of the project. However, its possible to workaround it. You can create/copy the second .mex file into the project root.

Then, anytime you would like to modify pins/clocks/peripherals of some configuration, you have to open the configuration you would like to modify using double-click it on the .mex file in the project view. 

Petr_H_0-1676630857752.png

The downside is that the config tools do not indicate, which of the .mex you are editing at the moment. There is just IDE project shown in the toolbar. That's why you should always double-click the .mex file to get to Config Tools perspective to ensure the right project is edited.

Generating code to different folders

Second limitation is the sage of 'Update code' command which is currently limited to use the default 'board' project in project.

There an option specific for each .mex file where you can override the default code generation folder by custom path (ConfigTools > Configuration Preferemces > Output path overrides). However, I have learned that there is reported a bug in this feature and these rules are currently not applied when there is  toolchain project detected (e.g. MCUXpresso IDE). After it's fixed, there will be possible to generate files to different folder from each .mex file.

The workaround for now is to use the Export command, where you can specify the target folder. The shortcut icon for the export is available in the Code preview window of each config tool:

Petr_H_1-1676631440977.png

Solution with MCUXpresso Config tools standalone 

Alternative solution for the above limitation can be to using the MCUXPresso Config tools standalone application (https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/mcuxpresso-c...).

If you are using the standalone config tools, you can move the .mex files into different folders and just open .mex file and edit them. 

The 'Update code' command will produce output to the sub-folders of the folders where you saved the .mex file, but it can be overriden via the rules in Configuration preferences mentioned above.

Downside of this solution is that it will not handle dependency checks of the SDK components in your toolchain project this way so you have to ensure you have right files (drivers, middleware) in your project.

 

We are sorry for the inconvenience, we are preparing improvements to simplify these more complex use-cases. 

best regards

Petr Hradsky

Config Tools Team

 

0 Kudos

502 Views
alonbl
Contributor III

Hello @Petr_H,

Thank you for the good explanation, was there a progress since this post?

I would like to have a project that supports multiple boards, and conditionally call the correct files that were generated out of the mex files. I could see that I can modify the mex so that it will generate files with different names, but I would like to have a common part, for example the USB settings of the two configuration is the same.

I thought of doing codegen per mex at order {common, board1, board2}, but this approach does not seems to be viable.

In your opinion what is the preferred method of supporting multiple board configurations in a single project?

Thanks,

0 Kudos

1,286 Views
Petr_H
NXP Employee
NXP Employee

Hi, 

Please add more details on your use-case. Are you using MCUXPresso IDE or stand-alone version of config tools? Do I understand it correctly that you need two .mex files generate the output to different folders? I don't know what are you editing, but this should be possible with using the "Output path overrides" in Configuration preferences.

Best regards

Petr Hradsky

Config Tools Team

0 Kudos