Skip to content

Problems with MIG for Python in new Make System #352

@zang3t5u

Description

@zang3t5u

Hi. Since I am not good at Java, I was trying to work with MIG and Python for Serial Interfacing with the XM1000 motes.

In the tinyos-release I had enabled support for XM1000 (steps here)

ISSUES

  • Recipes for new targets do not get executed everywhere
  • Attribute -fnesc-target does not work for nescc-mig

Description

  1. I have a header file SerialInteract.h that contains an nx_struct type message construct and defines the AM_RADIO_TYPE
  2. To create a usable Python Class File named TestSerialMsg.py with the class TestSerialMsg , I added the following lines to my Makefile:
TestSerialMsg.py: SerialInteract.h
    @mig python -target=$(TARGET) $(CFLAGS) -python-classname=TestSerialMsg SerialInteract.h test_serial_msg -o TestSerialMsg.py

Here, MIG perfectly created a working Python Class with Definitions. (I used it later by creating a Python file on my own and copying the content, so I know it was working)

But after trying several workarounds, I was facing some issues with Serial interfacing for Python in the tinyos-release.

  1. So, I went ahead and downloaded the tinyos-main, enabled support for XM1000 again after making the changes advised here: https://github.com/tinyos/tinyos-main/tree/master/support/make
  2. I got the Blink example working and running on my motes.
  3. When I went ahead with the Serial Interacing example with my edited makefile using mig... It didn't create the TestSerialMsg Python Class File.
  4. I replaced mig with nescc-mig -nescc=ncc as well, but no dice.

    Hints to the problem

  5. Finally after some scavenging, I found that the recipe for build_dir in $(TINYOS_ROOT_DIR)/support/make/Makerules (line 375) always worked.

When I added the command to the build_dir recipe:

@mig python -target=$(TARGET) $(CFLAGS) -python-classname=TestSerialMsg SerialInteract.h test_serial_msg -o TestSerialMsg.py

and did make xm1000 in my Project/src directory, it created the required Python Class file.

  • When I replaced mig with nescc-mig -nescc=ncc, it still worked. Though replacing -target with -fnesc-target shot an error parsing the SerialInteract.h headerfile

Conclusion

I have no idea why Make is not accepting Recipes and Dependencies in the rest of the Makefile or Makerules or Makerules.include

As we can see, it might not be an issue with mig at all. Since if I deleted the Python Class file, tried adding the following lines right after the build_dir recipe:

TestSerialMsg.py: SerialInteract.h FORCE
    @mig python -target=$(TARGET) $(CFLAGS) -python-classname=TestSerialMsg SerialInteract.h test_serial_msg -o TestSerialMsg.py

FORCE:

And used make xm1000, it built the project but it did not create the Python Class File.
Please help me out here.

Finally, if anyone has a better solution to get Serial, Python/C++ and TinyOS-release or TinyOS-main working together, please let me know

TLDR:

Recipes for targets not working everywhere in new Make system

Thanking you in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions