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 struct functions on specific regions

What is the proper syntax to place struct functions in specific regions? Using something like the example below appears to ignore the #pragma statement, e.g. the object code for foo::bar() is not placed in section "sram2". Using #pragma section on a block would be preferable to __at() on every function as some structs define a large number of functions. MDK version is 4.71 and target is an ARM Cortex-M4. Thanks.

#pragma arm section code = "sram2"
struct foo
{ int bar(int x) { int ret; // Some logic return ret; }
} #pragma arm section code

Parents
  • Forgot to use the pre tags in the example. It should look as follows:

    #pragma arm section code = "sram2"
    struct foo
    {
        int bar(int x)
        {
            int ret;
            // Some logic
            return ret;
        }
    }
    #pragma arm section code
    

Reply
  • Forgot to use the pre tags in the example. It should look as follows:

    #pragma arm section code = "sram2"
    struct foo
    {
        int bar(int x)
        {
            int ret;
            // Some logic
            return ret;
        }
    }
    #pragma arm section code
    

Children
No data