Download DSC56800EX Quick Start User Guide

Transcript
bne <loop_clearbss2;
end_clearbss2:
And again the process is repeated for the Program RAM-based variables. In the startup code, this
.bss.pmem segment is referenced as bssp. Note that the move instruction accesses the P (program) space.
/* clear BSSP (program RAM) segment (can't use 'do' and its 16 bit loop counter) */
move.l #>>_Lbssp_size,r2
tsta.l r2
beq <end_clearbssp;
move.l #>>_Lbssp_start,r1
move.w #0,x0
loop_clearbssp:
move.w C1,X:(R5)
move.w D1,X:(R5)
move.w x0,p:(r1)+
dectsta r2;
bne <loop_clearbssp;
end_clearbssp:
2.7.2.2.9
/* bssp size */
/* skip if size is 0 */
/* dest address */
/* clear COP watchdog counter */
/* clear value at r1 */
/* long loop counter */
Initializing Global Variables
The C variables to which are assigned a non-zero initial values must be initialized using the data from a
non-volatile memory. Using the directives in the linker command file, the initial data are stored in the
internal Flash memory. The source and destination addresses are calculated by the linker and exported as
symbols. The P-Flash memory is used and the appropriate code is compiled.
Note that the COP counter is periodically cleared in all loops below.
/* copy variable initialization data from pFlash to destination (long loop) */
#ifdef TARGET_INITDATA_PFLASH
move.l #>>_Ldata_size,r2/* set
tsta.l r2
beq <end_prom2xram
move.l #>>_Ldata_ROM_addr,r3/*
move.l #>>_Ldata_RAM_addr,r1/*
loop_prom2xram:
move.w C1,X:(R5)
move.w D1,X:(R5)
move.w p:(r3)+,x0
move.w x0,x:(r1)+
dectsta r2
bne <loop_prom2xram
end_prom2xram:
data size */
src address -- xROM data start */
dest address -- xRAM data start */
/* clear COP watchdog counter */
/* fetch value at address r3 */
/* stash value at address r1 */
Next, the initialized program-RAM variables (those not in .bss.pmem section) and also the
program-RAM-based code (from the Quick_Start-specific pramcode section) is initialized using the
values from the program Flash.
/* in any flash-based target, do copy pram-variable initialization data
(and ram-based code) from pFlash storage to destination in program-ram */
#ifdef TARGET_CODE_PFLASH
move.l #>>_Ldatap_size,r2/* set data size */
DSC56800EX Quick Start User’s Guide, Rev. 2, 04/2015
2-56
Freescale Semiconductor, Inc.