LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV for ARM cluster array compile error

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:

snippet.png  paste this snippet in a vi.

 

the global array (Array 3) is the following:

 

snippet2.png   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:

 

snippet3.png   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

Wouter.
"LabVIEW for ARM guru and bug destroyer"
0 Kudos
Message 1 of 6
(3,384 Views)

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.

http://forums.ni.com/t5/LabVIEW-Embedded/Bug-when-using-Big-cluster-and-quot-optimize-for-speed-quot...

 

I hope it would be helpful and if you have any question don't hesitate to ask.

 

Hope will hear from you.

 

Regards,

 

Hossein

 

0 Kudos
Message 2 of 6
(3,291 Views)

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.

Wouter.
"LabVIEW for ARM guru and bug destroyer"
0 Kudos
Message 3 of 6
(3,280 Views)

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

0 Kudos
Message 4 of 6
(3,277 Views)

The problem is generated by an index array vi with an Global cluster array as array input.

 

fout.png

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:

Workaround.png

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.

Wouter.
"LabVIEW for ARM guru and bug destroyer"
0 Kudos
Message 5 of 6
(3,261 Views)

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...

 

Wouter.
"LabVIEW for ARM guru and bug destroyer"
0 Kudos
Message 6 of 6
(3,208 Views)