Jump to content
OMRON Forums

Max M-variable Limit


daves

Recommended Posts

I just got confused by apparently hitting the M-variable limit. Took a while to twig. The behaviour seems odd, and should definitely halt the build (not the download as it breaks the C-files with a bad pp_proj.h), reporting the error.

 

I have seen some strange things:

 

Make a new project with the following in "global definitions.pmh":

 

ptr Dave(8192)->d.user:6400000+;
ptr Blob(8192)->d.user:6465536+;
ptr Foo(8192)->d.user:6531072+;

 

Build reports OK and puts

 

,Dave=8192
,Blob=16384
,Foo=24576};

 

in pp_proj.h. But the SRM M{data} definition says M vars can only be in (0 – 16,383). Indeed RtGpShm has "#define MAX_M 16384". So is this OK? Then the SRM ptr definition states there are 65536 M variables. Which is it? How does SHM cope with Mdef over 16384?

 

If you try something like:

 

ptr Dave1(8192)->d.user:1000000+;
ptr Blob1(8192)->d.user:2000000+;
ptr Dave2(8192)->d.user:3000000+;
ptr Blob2(8192)->d.user:4000000+;
ptr Dave3(8192)->d.user:5000000+;
ptr Blob3(8192)->d.user:6000000+;
ptr Dave4(8192)->d.user:7000000+;
ptr Blob4(8192)->d.user:8000000+;
ptr Foo->d.user:9000000;

 

You end up with

 

enum ptrM {_ptrM_=-1
,Foo=73728};

 

which is bigger than both stated limits.

 

However my error manifested itself slightly differently and if you change the pmh to the following you see something similar (I can't quite figure out what caused mine but it was adding an 8192 array)

 

ptr Dave1(16400)->d.user:1000000+;
ptr Blob1(8192)->d.user:5000000+;
ptr Foo->d.user:9000000;

 

pp_proj.h just gives you

 

enum ptrM {_ptrM_=-1
,Foo=16384};
enum ptrMarray {_ptrMarray_=-1
,Blob1=8192};

 

Here Dave1 doesn't appear and there are no error messages. The SRM definition of an array says the size must be "either a positive integer constant or a previously defined identifier for a positive integer constant". In my real project thousands of variables didn't make it into pp_proj.h. Then the IDE has thousands of errors on the build of the 10s of CPLCs etc. There is no way to interrupt or to see what caused it. I had to End Task after 30 minutes (the reporting of each error in the IDE listview is very slow)

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

OK, thanks for clearing that up. Trapping this in the IDE would be great! Also the SRM section for "ptr" needs fixing (p1156 in Jan 6, 2015 version).

 

Something to consider, 16384 is not a large number when you have GB of RAM available . It seems I am using ~7000 before wanting two arrays in memory of 8192 elements (agreed, probably not the best way to do what I need). I am aware of the alternatives and will have to look at them (just reserving user shared memory and using pushm+0xNNNNNNNN, dropping below the M8192 start, using Sys.DData, etc).

 

But... your programmers won't like this... it seems wasteful to allocate a precious M variable for each element of a ptr array. Could there be some cunning way to free them up? Or add more? I understand there would be compatibility issues.

Link to comment
Share on other sites

I have tested “over-running” the number of M-variable declarations on my setup and I do get an error message:

(I already have a few declarations before this one ...)

Error : ( Preprocessing Error) Exceeded Maximum Available Variables : on string ("ptr Dave(8192)->d.user)

 

I’m not sure why yours does not. If you want to email me you full project I could try it here and see what I get.

 

We will be fixing the 65K M-variable reference in the manual shortly.

Link to comment
Share on other sites

Thanks Steve, I've just upgraded and with IDE 2.1.0.107, FW 2.1.0.39 I do seem to get the same error report as you on the test program now.

 

However, the error comes after download, I really need it to be at the start, or the first time pp_proj.h is generated, as my issue was in the C-code (i.e. the Build process, way before the download and post-process).

 

In our main project we use _PPScriptMode_. The first build of pp_proj.h is incomplete. Due to the overrun of M-vars and large number of other variables it seems to not completely define all the ptr and globals in the _PPScriptMode_ section. Then during the build of the 10s of C modules, I get hundreds of

 

"Error : 'FLHWPMSEnc04' undeclared (first use in this function)"

 

messages which take forever (I killed after 15mins).

 

It is hard to recreate the conditions causing it. I will email you a test project with our pmh header an a c app which demonstrates it.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...