I get this when the compiler needs to have this interface in storage. When parameterised the compiler doesn't complain.
My interface goes like this. Reverting to this simple interface:
typedef interface startkit_adc_user_handle {
[[guarded]] void trigger (void);
[[clears_notification]] int read (unsigned short x[NUM_STARTKIT_ADC_INPUTS] return_adc_vals);
[[notification]] slave void complete (void);
} startkit_adc_user_handle_if;
However, this also fails:
#define NUM_STARTKIT_ADC_INPUTS 4
#define NUM_STARTKIT_ADC_NEEDED_DATA_SETS 1000
typedef struct tag_startkit_adc_vals {
unsigned short x[NUM_STARTKIT_ADC_INPUTS];
} t_startkit_adc_vals;
Even a syntax error here; but it still seems to compile (see figures):
typedef interface startkit_adc_user_handle {
[[guarded]] void trigger (void);
[[guarded]][[clears_notification]] {unsigned int, unsigned int} read (t_startkit_adc_vals return_adc_vals);
[[notification]] slave void complete (void);
} startkit_adc_user_handle_if;
In the attachments, notice the two other errors. Dont' know if any of them cause another.
Is the documentation generally so minimalistic? Why can't it calculate a size? Dynamic contents? Haven't seen all the docs?
Error: Storage size of 'my-interface' isn't known Topic is solved
-
- XCore Expert
- Posts: 512
- Joined: Wed Apr 25, 2012 8:52 pm
Error: Storage size of 'my-interface' isn't known
You do not have the required permissions to view the files attached to this post.
View Solution
-
- Experienced Member
- Posts: 104
- Joined: Fri Dec 11, 2009 8:29 pm
I think the problem is that if you create a typedef to an interface e.g.
When you declare it you should do
Not:
which will implicitly declare a new interface tag which is never fully defined.
This is the same as structs in C. If I try to compile:
GCC gives me the same error (storage size of 'k' isn't known).
Code: Select all
typedef interface my_interface {...} my_interface_if;
Code: Select all
my_interface_if i_my_interface_var;
Code: Select all
interface my_interface_if my_interface_var;
This is the same as structs in C. If I try to compile:
Code: Select all
typedef struct st { int x; } stt;
struct stt k;
-
- XCore Expert
- Posts: 512
- Joined: Wed Apr 25, 2012 8:52 pm
Thank you! However,
startkit_adc_acquire_if in startkit_adc.h is certainly typedefed (but with same name on tag and typedef), and is indeed used as
interface startkit_adc_acquire_if i_startkit_adc_acquire;
How come?
Is it because I have used a typedef'ed value in my startkit_adc_user_handle_if, and not just an array of size something?
startkit_adc_acquire_if in startkit_adc.h is certainly typedefed (but with same name on tag and typedef), and is indeed used as
interface startkit_adc_acquire_if i_startkit_adc_acquire;
How come?
Is it because I have used a typedef'ed value in my startkit_adc_user_handle_if, and not just an array of size something?
-
- XCore Expert
- Posts: 512
- Joined: Wed Apr 25, 2012 8:52 pm
By the way, I still struggle with getting it into the client side as a parameter. On the server side I now have
it's fine but at the client side this code fails to compile:
I get "Incompatible type for argument 2 of 'test_display" (at usage) and "interface declared inside the parameter list". If I try to rectify to:
then I get "parse error before 'i_startkit_adc_user_handle'" and "too many arguments to function 'test_display'" as done in main here:
I have tried several other combinations as well, like having the same name and tag of the interface typedef, with no help. And moving the param around to check that I counted correctly.
I am impressed by getting a response tonight!
Code: Select all
[[combinable]]
void startKIT_adc_user_handle (
const unsigned int Num_of_data_sets,
client startkit_adc_acquire_if i_startkit_adc_acquire,
server startkit_adc_user_handle_if i_startkit_adc_user_handle);
Code: Select all
[[combinable]]
extern void test_display (
client interface delay_if i_delay,
client interface startkit_adc_user_handle_if i_startkit_adc_user_handle,
chanend c_button_left,
chanend c_button_center,
chanend c_button_right);
Code: Select all
[[combinable]]
extern void test_display (
client interface delay_if i_delay,
client startkit_adc_user_handle_if i_startkit_adc_user_handle,
chanend c_button_left,
chanend c_button_center,
chanend c_button_right);
Code: Select all
int main () {
chan c_button_left;
chan c_button_center;
chan c_button_right;
interface delay_if i_delay;
//
chan c_analogue;
interface startkit_adc_acquire_if i_startkit_adc_acquire;
startkit_adc_user_handle_if i_startkit_adc_user_handle;
par {
on tile[0].core[0]: test_display (i_delay, i_startkit_adc_user_handle, c_button_left, c_button_center, c_button_right);
on tile[0].core[1]: inP_Button_Task (BUTTON_LEFT, inP_button_left, c_button_left);
on tile[0].core[1]: inP_Button_Task (BUTTON_CENTER, inP_button_center, c_button_center);
on tile[0].core[1]: inP_Button_Task (BUTTON_RIGHT, inP_button_right, c_button_right);
on tile[0].core[2]: startKIT_adc_user_handle (NUM_STARTKIT_ADC_NEEDED_DATA_SETS, i_startkit_adc_acquire, i_startkit_adc_user_handle);
on tile[0].core[3]: server_delay_iff(i_delay);
on tile[0].core[4]: adc_task (i_startkit_adc_acquire, c_analogue, ADC_PERIOD_TIME_USEC);
startkit_adc (c_analogue); // Declare the ADC service (this is the ADC hardware, not a task)
}
I am impressed by getting a response tonight!
-
- XCore Legend
- Posts: 1913
- Joined: Thu Jun 10, 2010 11:43 am
How about the following ?
Code: Select all
[[combinable]]
extern void test_display (
client delay_if i_delay, // removed interface keyword
client startkit_adc_user_handle_if i_startkit_adc_user_handle, // removed interface keyword
chanend c_button_left,
chanend c_button_center,
chanend c_button_right);
Code: Select all
int main () {
chan c_button_left;
chan c_button_center;
chan c_button_right;
delay_if i_delay; // removed interface keyword
//
chan c_analogue;
startkit_adc_acquire_if i_startkit_adc_acquire;
startkit_adc_user_handle_if i_startkit_adc_user_handle; // removed interface keyword
par {
on tile[0].core[0]: test_display (i_delay, i_startkit_adc_user_handle, c_button_left, c_button_center, c_button_right);
on tile[0].core[1]: inP_Button_Task (BUTTON_LEFT, inP_button_left, c_button_left);
on tile[0].core[1]: inP_Button_Task (BUTTON_CENTER, inP_button_center, c_button_center);
on tile[0].core[1]: inP_Button_Task (BUTTON_RIGHT, inP_button_right, c_button_right);
on tile[0].core[2]: startKIT_adc_user_handle (NUM_STARTKIT_ADC_NEEDED_DATA_SETS, i_startkit_adc_acquire, i_startkit_adc_user_handle);
on tile[0].core[3]: server_delay_iff(i_delay);
on tile[0].core[4]: adc_task (i_startkit_adc_acquire, c_analogue, ADC_PERIOD_TIME_USEC);
startkit_adc (c_analogue); // Declare the ADC service (this is the ADC hardware, not a task)
}
-
- XCore Expert
- Posts: 512
- Joined: Wed Apr 25, 2012 8:52 pm
Thanks. See attached file. Not solved. By the way, here's that other interface code:
I'll be back tomorrow!
Code: Select all
interface delay_if {
[[clears_notification]] // 1..N
void delay_iff (const unsigned milliseconds_iff);
[[notification]] // 1
slave void timeout (void);
void delay_control (const int enable);
};
[[combinable]]
void server_delay_iff (server interface delay_if i);
You do not have the required permissions to view the files attached to this post.
-
- XCore Expert
- Posts: 512
- Joined: Wed Apr 25, 2012 8:52 pm
I am branching this thread of to https://www.xcore.com/forum/viewtopic.php?f=47&t=4438 "interface" in headers vs. task body as that seems to be the real problem now. The theme of the header of this thread has been solved. Thanks!