we need first specify a memory area to hold your variables/constants in Linker file .ld.
Then, in source code, use __attribute__ to place the variables/constants into this memory area.
I have created an example project for your reference.
Please note that memory section "my_section" is added in section MEMROY (line 26).
And in the follow, add placement .mydata (line53 ~ line58).
In main.c, place a const my_const into this memory area (line 9 of main.c).