Question:
How to specify a symbol to be placed in word addressable program memory?
Answer:
Word-addressed variables and functions need to be defined in word-addressed source files, i.e. files compiled with -char-size-32. No section qualifier is required when doing that.
Such variables and functions can be referenced from a byte-addressed source file (i.e. one compiled with -char-size-8), by annotating their extern declarations with #pragma word_addressed, but they cannot be defined there.
The section qualifier is intended for placing data and code into sections with different names (and placement), but they still need to have the type the compiler expects. All variables defined in -char-size-8 source files do need to be placed into byte-addressed output sections.
In the assembly code the compiler generates with -char-size-8, data section will have the byte-addressed type (which in the .SECTION directive in assembly is expressed either with the BW qualifier or by omitting the type qualifier). Such a byte-addressed input section cannot be mapped to a word-addressed output section in the LDF. Attempts to do so will be skipped over, thus eventually resulting in the 'symbol not mapped' error.
To complicate matters though, seg_dmda_nw is an exception to this. For internal implementation reasons, this section is hardcoded to be emitted as type DM, i.e. word-addressed, in the compiler-generated assembly code. Therefore, when using '#pragma section("seg_dmda_nw")' you actually get an error saying 'The section name seg_dmda_nw is reserved for use by the compiler', but unfortunately that error is not emitted when the 'section("seg_dmda_nw")' qualifier is used instead of the #pragma. We've got an issue open for that.
While code using 'section("seg_dmda_nw")' will indeed link, it still won't work properly because the variable will be four times as big as intended and code accessing it may use incorrect address offsets.
More information on mixing byte and word addressing can be found in this section of the CCES help:
SHARC Development Tools Documentation > C/C++ Compiler Manual for SHARC Processors > Compiler > Using Byte-Addressing > Mixed Char-Size Applications