01-20-2012 06:50 AM
Hi there,
I may have found a (little) bug in the C code generation of LabVIEW for ARM 2010.
I have a project in LabVIEW for ARM with a target and build specification.
My Application information is:
disable parallel execution
Use stack variables
generate C function calls
I have deselected Optimize heap size.
when I select use stack variables I get an error on my code:
declaration may not appear after executable statement in block.
when I view at the code I see the following:
MemSet( &c_Index_Array_element, sizeof(cl_A0000), 0 ); /* c: Index Array: element */
MemSet( &c_Index_Array_element_CT, sizeof(cl_A0000), 0 ); /* c: Index Array: element: CT */
extern Array Global_2_Array_3_2;
an global array I use is declared after the MemSet functions.
If I place the extern before the MemSet's. the code is OK
this LabVIEW code creates this error:
paste this snippet in a vi.
the global array (Array 3) is the following:
paste this snippet in a vi.
this is an array of a cluster with an U32 and an U8
these array's are creating the error also:
paste this snippet in a vi.
+ use stack variables makes that any globals will be used as extern.
+ because of it's a cluster like these and there is an IF case after, makes that the MemSet is needed.
+ C code Gen places the MemSet before the extern
= Error
02-24-2012 03:22 AM
Hello,
Thank you to post on this forum. I'm not familiar with ARM application but I found the links below that related to a bug with a big cluster and think that it will help you too.
I hope it would be helpful and if you have any question don't hesitate to ask.
Hope will hear from you.
Regards,
Hossein
02-27-2012 08:58 AM - edited 02-27-2012 08:58 AM
Hi Hossein,
The link you provided is a problem in older LabVIEW for ARM versions. I know that topic (It's from the person that sits next to me 😉 ), it's a problem with typical clusters and optimatization. (Clusters that the C code can't recognize).
The problem I have here is in LabVIEW for ARM 2010, and with the settings I've posted, the code that is generated is not ANSI C.
A decleration is done after a statement.
02-27-2012 09:16 AM
Hi,
Thank yo for your reply and sorry that I couldn't help you. Can I assist you more or can I close this request?
Hear from you.
Regards,
Hossein
04-03-2012 03:55 AM
The problem is generated by an index array vi with an Global cluster array as array input.
I've tried the following and the bug introduced by CcodeGen is now gone.
I think It's because the array doesn't have to be initialized in the beginning of the Run funtion of the Vi.
My workaround:
Instead of the index array function, I'm using Array Subset vi, with a length of one.
because the output is an array, I'm indexing is it by a For loop.
Because it's an array of one element, you can assume that the for loop does one run, and so you can disable auto indexing if you are using outputs from this for loop.
Hope this can help others, It works for me.
07-23-2012 05:29 AM
Still finding this problem often, and I am sure that others will find this bug also!
keep this topic alive!
you can reproduce is yourself...