Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface parameters assigned in reverse order #33

Open
mszczodrak opened this issue Sep 2, 2014 · 0 comments
Open

Interface parameters assigned in reverse order #33

mszczodrak opened this issue Sep 2, 2014 · 0 comments

Comments

@mszczodrak
Copy link

The following describes a semantic bug found in the latest version of nesc.

When a module provides a parameterized interface, with more than one parameter on the interface, the parameters in the function implementing the interface come in the reversed order.

For example, we are wiring to a module TestC implementing interface Test.

 BlinkC.Test -> TestC.Test[10, 20, 30];

then TestC provides interface as follows:

 provides interface Test[uint8_t par1, uint8_t par2, uint8_t par3];

and implements interface function bug():

    command void Test.bug[uint8_t par1, uint8_t par2, uint8_t par3]() {
            printf("Receive Parameters %d %d %d\n", par1, par2, par3);
            printfflush();
    }

At run time, we observe the following serial print output:

Receive Parameters 30 20 10
Receive Parameters 30 20 10
Receive Parameters 30 20 10
...

Parameters arrive in the reverse order (should be 10, 20, 30).

This bug can have a compile-time error, when the parameter values are heterogeneous. If we expect parameters, [uint8, uint8, uint16] and assign values [10, 20, 300] then we get

   'constant out of range for argument type'

because 300 is assigned to the first parameter of type uint8_t.

A sample test code has been uploaded to: http://www.cs.columbia.edu/~msz/wsn/nesc_interface_params/
The test code is configured for the TOSv3, tested on the latest tinyos-main branch, on telosB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant