How to define variable to external RAM?I am using K60 MQX4.1 CW10.4 GCC compiler.
intflash.ld add
exram (RW): ORIGIN = 0xA0000000, LENGTH = 0x00040000
and
.my_mram :
{
. = ALIGN (0x4);
*(.vectors_exram)
. = ALIGN (0x4);
} > exram
And then in my programs
__attribute__((section(".vectors_exram"))) uint8 test[100];
this is error!。
What do I do?
thanks
Hello:
Can you mention the specific error you receive? or share a screenshot?
The format you are using seems to be correct, so there should not be any errors, unless your program does not know uint8.
Regards!,
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Can you give me Example code? K60+CW10.4
Compiled without error.but it's error when download. If Delete this definition,it can be downloaded.
In that case, try adding the NOLOAD command to your custom section in the intflash.ld like this:
.my_mram (NOLOAD):
{
. = ALIGN (0x4);
*(.vectors_exram)
. = ALIGN (0x4);
} > exram
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you very much again!
Just to add another note to this issue...
I am using CW10.6, GCC compiler, K61, and MQX4.1.1. After changing the linker file to define an external RAM section the debugger starting giving this error:
"not allowed to access registers while running"
After adding the (NOLOAD) directive the problem went away.
Allen
Thank you very much! I have resolved
it's error in following:
.bss :
{
...
. __END_BSS = .;
__bss_end__ = __END_BSS;
. = ALIGN(0x10);
} > ram
.my_mram(NOLOAD):
{
. = ALIGN (0x4);
*(.vectors_exram)
. = ALIGN (0x4);
} > exram
/* move "location counter" to next relocated address */
. = ALIGN(0x10);
.kernel_data :
{
__KERNEL_DATA_START = ALIGN(0x10);
}
.end_of_kernel_data :
{
__KERNEL_DATA_END = .;
__KERNEL_AREA_END = .;
} > end_of_kd
“ .my_mram(NOLOAD):
{
. = ALIGN (0x4);
*(.vectors_exram)
. = ALIGN (0x4);
} > exram
”
It should be placed at the end;
.bss :
{
...
. __END_BSS = .;
__bss_end__ = __END_BSS;
. = ALIGN(0x10);
} > ram
/* move "location counter" to next relocated address */
. = ALIGN(0x10);
.kernel_data :
{
__KERNEL_DATA_START = ALIGN(0x10);
}
.end_of_kernel_data :
{
__KERNEL_DATA_END = .;
__KERNEL_AREA_END = .;
} > end_of_kd
.my_mram(NOLOAD):
{
. = ALIGN (0x4);
*(.vectors_exram)
. = ALIGN (0x4);
} > exram