This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

#pragma DATA_SECTION on string literal

Hi Champs,

is there a method to control the memory location of a string literal inside c++?

Example:

#pragma DATA_SECTION(".stringSection")

const char* string = "this string should be placed in .stringSection";

Only the pointer of the string goes into the.stringSection using the #pragma DATA_SECTION.

Is there a way to control the placement of the string as well in today's CGT's?

The only 2 workarounds I found are:

1. Steering the placement in the linker command file ( .const:.string > SpecialMemmoryArea) which has the limitation that control is only on file level.

2. Use arrays instead.

Kind regards,

one and zero