Hi,
thank you for providing the linker file. I have checked within IAR embedded workbench 8.32.3 and I do see the same error. The issue can be resolved by adding the following lines into the linker file:
initialize manually { section .m4_scst_test_shell_data };
do not initialize { section .m4_scst_test_shell_data };
initialize manually { section .m4_scst_ram_data };
do not initialize { section .m4_scst_ram_data };
initialize manually { section .m4_scst_ram_data_target0 };
do not initialize { section .m4_scst_ram_data_target0 };
initialize manually { section .m4_scst_ram_data_target1 };
do not initialize { section .m4_scst_ram_data_target1 };
initialize manually { section .m4_scst_ram_test_code };
do not initialize { section .m4_scst_ram_test_code };
Note that the section .m4_scst_test_shell_data must be initialized manually in startup code (or at the beginning of main function) before selftest is run.
Best Regards,
Frantisek
Thank you very much,i have solved this problem by using __iar_data_init3 function,but i want to know to how to create a function myself to solve it.m4_scst_test_shell_data maybe rw_data, so i must init it by copying flash to ram,but how to know the right flash location? I'm more familiar with gcc,we can set the flash address to store the rw_data,but in my link file for iar,i dont know where is the flash address to store m4_scst_test_shell_data,so how to set it?
thank you again!
The initialized data for .m4_scst_test_shell_data are automatically stored by IAR into a section .m4_scst_test_shell_data_init (name of section plus _init at the end). Then in code the address and size of the sections can be retrieved for example by this code:
#pragma section = ".m4_scst_test_shell_data"
#pragma section = ".m4_scst_test_shell_data_init"
dest = __section_begin(".m4_scst_test_shell_data");
src=__section_begin(".m4_scst_test_shell_data_init");
size = ( (uint32_t) __section_end(".m4_scst_test_shell_data_init") - (uint32_t) __section_begin(".m4_scst_test_shell_data_init"));
Then there can be used memcpy or a for loop to copy the initialized data from src to dest.
Best regards,
Frantisek
I understand now,you are very great,I can init it by myself now, thank you very much!
but i also have a problem,IAR still remind me to use __iar_data_init3,how to avoid it?
this is my code and linke file:
void init_m4_scst_test_shell_data(void)
{
uint8_t * m4_scst_test_shell_data_dest;
uint8_t * m4_scst_test_shell_data_src;
uint8_t * m4_scst_test_shell_data_src_end;
#pragma section = ".m4_scst_test_shell_data"
#pragma section = ".m4_scst_test_shell_data_init"
m4_scst_test_shell_data_dest = __section_begin(".m4_scst_test_shell_data");
m4_scst_test_shell_data_src=__section_begin(".m4_scst_test_shell_data_init");
m4_scst_test_shell_data_src_end = __section_end(".m4_scst_test_shell_data_init");
while (m4_scst_test_shell_data_src_end != m4_scst_test_shell_data_src)
{
*m4_scst_test_shell_data_dest = *m4_scst_test_shell_data_src;
m4_scst_test_shell_data_dest++;
m4_scst_test_shell_data_src++;
}
}
initialize manually
{
section .customerBootData,
section .m4_scst_ram_data,
section .m4_scst_ram_data_target0,
section .m4_scst_ram_data_target1,
section .m4_scst_ram_test_code,
section .m4_scst_test_shell_data,
};
if i set the section do not initialize
it also create a warning:1468 out of 1468 bytes from data record CODE:[0x1FFF8400,0x1FFF89BB] will not be flashed
I do see the __iar_data_init3 error (similarly for other SCST sections):
Fatal Error[Lp049]: there was no reference to __iar_data_init3, but it is needed to initialize section .m4_scst_ram_data (m4_scst_exception_wrappers.o #6)
After updating the linker file as follows:
initialize manually { section .m4_scst_test_shell_data };
do not initialize { section .m4_scst_test_shell_data };
initialize manually { section .m4_scst_ram_data };
do not initialize { section .m4_scst_ram_data };
initialize manually { section .m4_scst_ram_data_target0 };
do not initialize { section .m4_scst_ram_data_target0 };
initialize manually { section .m4_scst_ram_data_target1 };
do not initialize { section .m4_scst_ram_data_target1 };
initialize manually { section .m4_scst_ram_test_code };
do not initialize { section .m4_scst_ram_test_code };
I don't get the build errors anymore and I also do not see the errors while uploading with flash loader.
Best Regards,
Frantisek
You are right, all of "do not initialize" and "initialize manually" are necessary, I thought only "do not initialize" or "initialize manually" is necessary when i refer to the IAR manual.