Hi,
I want to initialize global variables from ROM,
my crt0.s is same as :
[...] start: _start: /* select user mode */ mrs r0, cpsr bic r0, r0, #0x1F /* clear mode flags */ orr r0, r0, #0x10 /* set user mode */ msr cpsr, r0/* init stack */ ldr sp,_Lstack_end
/* copy data */ _Lcopy_data: ldr r0, _Linit_data_start ldr r1, _Ldata_start ldr r2, _Ldata_end cmp r1,r2 beq _Lzero_bss
/* copy byte by byte if not aligned */ tst r0, #0x3 bne _Lcopy_bytes tst r1, #0x3 bne _Lcopy_bytes tst r2, #0x3 bne _Lcopy_bytes _Lcopy_words: ldr r3, [r0], #0x4 str r3, [r1], #0x4 cmp r1,r2 bne _Lcopy_words b _Lzero_bss _Lcopy_bytes: ldr r3, [r0], #0x1 str r3, [r1], #0x1 cmp r1,r2 bne _Lcopy_bytes
/* zero bss */ _Lzero_bss: ldr r0, _Lbss_start ldr r1, _Lbss_end [...]
at present my linker script is :
---------------------------------------------------- __TEXT_START__ = 0x00000400; __DATA_START__ = 0x40003000; __STACK_END__ = 0x40004000;
SECTIONS { /* Read-only sections, merged into text segment */
.text0 0x0: { *intvec.o(.text) }
.text2 __TEXT_START__ : { *(.text) *(.text.*) }
PROVIDE (__etext = .);
.rodata : { *(.rodata) *(.rodata.*) }
/* append .data; it will be copied by crt0 to final __DATA_START__ */ . = ALIGN(4); __INIT_DATA_START__ = .; .data __DATA_START__ : AT ( __INIT_DATA_START__ ) { *(.data) *(.data.*) SORT(CONSTRUCTORS) } . = ALIGN(4); __DATA_END__ = .;
/* noninitialized data; will be zeroed by crt0*/ __bss_start__ = .; .bss : { *(.bss) *(.bss.*) *(COMMON) . = ALIGN(4); } . = ALIGN(4); __bss_end__ = . ; PROVIDE (end = .); }
----------------------------------------------------
how to modify this script for initialize global variables from ROM ?
Thanks a lot .
--
-Stan