hello!
How to define a section in C file in mcuxpresso IDE, which has only one function.
Then I want to initialize the section in the "LD" file, and then copy the section program to ram in the C program?
I don't know about MCUXPRESSO, however if I understand your question you want to copy a specific section of code from Flash to RAM at start up via the linker script.
This is commonly needed for Flash programming routines where the code must be run from RAM to program the flash. I've attached the code that I use.
Looking in vectors.c you will find a structurer that holds information about the sections that need copied to RAM and the function to do it. The linker script is setup to supply the information needed.
For example to get flash_kinetis_cmd.c copied to RAM at startup.
flash_kinetis.c/.h are included for completeness then don't really play a part in getting things moved to RAM.
There may be some missing headers that you'll need to fill in for your specific part and case. This code is for the KL27. The linker script technique is the same for most any GCC based part. The linker script is hopefully well enough commented to follow.