How to set up and use #pragma SECTION ?


I would to write a "aaa_func" function  for S3A7,

I want to place this part of the code (including constant values, etc.) in a designated block of Flash.

(for example: "section name"=.aaa_func  and code starting at address 0x10000)

I know to set from "s3a7.ld" file ,But I don't know how to set the "Sections" page

Please tell me how to edit~


Thanks in advance,



  • Victor,

    In the s3a7.ld add some readable executable memory at the top in the MEMORY section such as:

    MY_SEC(rx) : ORIGIN = 0x10000, LENGTH = 0x10000

    Then add your section to this memory:

    .my_sec :
    . = ALIGN(4);
    } > MY_SEC

    Then in your code use BSP_PLACE_IN_SECTION for the function you require to be in the specific section:

    uint32_t inc_test (uint32_t in) BSP_PLACE_IN_SECTION(".my_sec");