How to specify that two functions must be placed in the same overlay

  • version

    1.1.1

  • scope

    Example.

    This code is provided as example code for a user to base their code on.

  • description

    How to specify that two functions must be placed in the same overlay

  • boards

    Unless otherwise specified, this example runs on the SliceKIT Core Board, but can easily be run on any XMOS device by using a different XN file.

You can associate a name with the overlay containing an overlay root by specifying the overlay name in the overlay attribute as follows:

[[overlay(overlay_name)]] void f() {}

Specify the same overlay name multiple times forces two functions into the same named overlay. For example:

[[overlay(foo)]] void g() {}
[[overlay(foo)]] void h() {}

f and g will be placed in the same overlay. All the code and read only data that is only referenced from f or g will be placed in this overlay. The overlay will be loaded into memory when either one of f and g is called.