This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Placing C++ member functions at specific region

Is there a way to specify that all member functions for a class or template are placed in a specific region? Specifying a section for each member function works, but makes maintenance of large classes more tedious. Ideally there should be a way to do this for all functions in a class or template. In the example below square() is placed in "sram2" but cube() is not. Thanks.

#pragma arm section code = "sram2"
class foo
{
public:
    int __attribute__((section("sram2"))) square(int x) { return x * x; }
    int cube(int x) { return x * x * x; }
};
#pragma arm section code

Parents
  • Wouldn't it be a good solution to put this class in a separate source file and have that object file tagged for a specific memory region?

    If you want the code inlined, then you would normally not want it in a specific memory region, but in the currrent memory region used for the code that makes use of the inlined functionality.

Reply
  • Wouldn't it be a good solution to put this class in a separate source file and have that object file tagged for a specific memory region?

    If you want the code inlined, then you would normally not want it in a specific memory region, but in the currrent memory region used for the code that makes use of the inlined functionality.

Children
No data