Add Defines Component; correct syntax
Posted: Tue Dec 12, 2006 11:15 am
Hi,
I am starting to use the Add Defines component in Flowcode 3 and seem to be generating all sorts of compilation errors depending upon how the data is defined, though the errors are not related to the data lines themselves.
I can probably work it through myself, but some pointers would help:
In a previous post (on v2.2) the following code works fine
Defines component (called in a flowcode macro)
const char table[] = {1,2,3,4};
and retrieval of the table values in a further C block.
FCV_DATA = table[FCV_INDEX];
Steve pointed out that 'rom' should replace 'const' in v3 as this is BoostC. (though const seems to work also in Flowcode 3), it just seems to generate a load W and compare table rather than RETFIE instructions).
However:
The boost C manual requires the defines coding as
rom char *table = {1,2,3,4};
however the * seems optional (what does it do?)
You will also see that there are no square btackets [].
for strings Boost C requires
rom char *table = "My String";
does this port to Flowcode? If so should I call the string data back into flowcode with a byte variable or a string variable type? The array is a char (byte array), but the data is string data?
I have tried many combinations of features but when compiled to assembler various errors appear (not least 'missing semicolon' where the line the error is on a line clearly having a semicolon).
Any general pointers as to how to read the BoostC manual when using the Defines component will help.
Thanks again.
I am starting to use the Add Defines component in Flowcode 3 and seem to be generating all sorts of compilation errors depending upon how the data is defined, though the errors are not related to the data lines themselves.
I can probably work it through myself, but some pointers would help:
In a previous post (on v2.2) the following code works fine
Defines component (called in a flowcode macro)
const char table[] = {1,2,3,4};
and retrieval of the table values in a further C block.
FCV_DATA = table[FCV_INDEX];
Steve pointed out that 'rom' should replace 'const' in v3 as this is BoostC. (though const seems to work also in Flowcode 3), it just seems to generate a load W and compare table rather than RETFIE instructions).
However:
The boost C manual requires the defines coding as
rom char *table = {1,2,3,4};
however the * seems optional (what does it do?)
You will also see that there are no square btackets [].
for strings Boost C requires
rom char *table = "My String";
does this port to Flowcode? If so should I call the string data back into flowcode with a byte variable or a string variable type? The array is a char (byte array), but the data is string data?
I have tried many combinations of features but when compiled to assembler various errors appear (not least 'missing semicolon' where the line the error is on a line clearly having a semicolon).
Any general pointers as to how to read the BoostC manual when using the Defines component will help.
Thanks again.