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.
Hello,
I am trying to initialize a specific memory segment using _system_pre_init(). I've defined .lowram as:
.lowram : {} > RAM
in the linker script, but now am having a problem accessing that segment in _system_pre_init().
I've tried looking at every pre_init.c example I can find. What I cannot find is how to reference a self-defined memory segment. Is this possible only for the pre-defined segment names like __BSS__ ?
EDIT:
Using CCS v5.5
There's no way to refer to the address by section name from within source code, but you can refer to symbols. You'll need to add a START directive to your .lowram declaration, like so:
.lowram : {} > RAM, START(__lowram_start)
Some standard sections like .bss get this treatment automatically.
Thank you. This works. I did:
.lowram : {} > RAM, START(__lowram_start), END(__lowram_end)
and it compiles without problems. However, what is the proper way to access these symbols from 'C'? Are they pointers?
Also, could you point me to some documentation wrt these directives?
Thank you very much for your help.
It's not a pointer, it is a linker constant. Use _symval(&__lowram_start); see the MSP430 Optimizing C/C++ Compiler v 4.3 User's Guide (SLAU132I), section 6.5.3.2 "Accessing Assembly Language Constants"
For the linker command file directives, see MSP430 Assembly Language Tools v4.3 User's Guide (SLAU131I), section 8.5.9.7 "Address and Dimension Operators"
http://processors.wiki.ti.com/index.php/TI_Compiler_Information#Compiler_Manuals