.text : { . = ALIGN(0x10); mcf52235_vectors.s (.text) *(.text) *(.rodata) . = ALIGN(0x10); ___DATA_ROM = .; } > rom .data_bss : AT(___DATA_ROM) { ___DATA_RAM = .; *(.data) *(.sdata) . = ALIGN (0x10); *(.boot) . = ALIGN (0x10); ___DATA_END = .; . = ALIGN(0x10); ___BSS_START = .; *(.sbss) *(SCOMMON) *(.bss) *(COMMON) ___BSS_END = .; . = ALIGN(0x10); ___SP_END = .; . = . + (0x800); ___SP_INIT = .; . = . + (4); ___HEAP_START = .; ___HEAP_END = ___SRAM + ___SRAM_SIZE; } > ram
#pragma define_section bootloader ".boot" far_code__declspec(bootloader) void flash_update_i2c(){ /*Some variable declarations*/ uint32 addr; uint8 i; /*Code*/
....
addr=0; i=0;
....}
... addr=0;20000528: 00042D40 ori.b #0x40,d42000052C: FEF8 dc.w 0xfef8 ; Invalid opcode i=0;2000052E: 7000 moveq #0,d020000530: 2D40FEE8 move.l d0,-280(a6) ...
... addr=0; 20000528: 00042D40 ori.b #0x40,d4 2000052C: FEF8 dc.w 0xfef8 ; Invalid opcode i=0; 2000052E: 7000 moveq #0,d0 20000530: 2D40FEE8 move.l d0,-280(a6) ...
... addr=0; 20000528: 7000 moveq #0,d0 2000052A: 2D40FEF8 move.l d0,-264(a6) i=0; 2000052E: 7000 moveq #0,d0 20000530: 2D40FEE8 move.l d0,-280(a6) ...
Source (ROM):000193ce: 66 a0 22 2e fe e8 20 2e fe f0 b2 80 65 00 fe 94 |f."... .....e...000193de: 10 3c 00 80 13 c0 40 11 00 00 60 fe 4e 71 |.<....@...`.NqDestination (RAM):20000ade: 66 a0 22 2e fe e8 20 2e fe f0 b2 80 65 00 fe 94 |f."... .....e...20000aee: 00 04 00 80 13 c0 40 11 00 00 60 fe 4e 71 |......@...`.Nq
void boot_copy(void){ extern char __START_COPY_TO_RAM[]; extern char __END_COPY_TO_RAM[]; extern char __START_COPY_ROM[]; uint32 n; uint8 *dp, *sp; dp = (uint8 *)__START_COPY_TO_RAM; sp = (uint8 *)__START_COPY_ROM; n = __END_COPY_TO_RAM - __START_COPY_TO_RAM; while (n--) { *dp = *sp; dp++; sp++; }}
About the question of being modified after copy them, I have all interrupts disabled. After calling that function, I execute the next orders:
asm {move.w #0x7700,sr}MCF_INTC0_IMRL |= MCF_INTC_IMRL_MASKALL;
What is happening has no sense... I don't know why almost all the bytes are copied OK, but there are some bytes that aren't... and not always are the same, now they are at 0x200 0AEE, and in the previous post, they where at 0x2000 0528...
Thanks in advance,
uint8 *x;x=(uint8 *)0x20000AEE;*x=10;*x=20;*x=30;
if (__DATA_ROM != __DATA_RAM) { dp = (uint8 *)__DATA_RAM; sp = (uint8 *)__DATA_ROM; n = __DATA_END - __DATA_RAM; while (n--) *dp++ = *sp++; }