You must implement a function that copies the code from ROM to RAM.
To place the application code at address 0x800 in ROM and copy it to address 0x7000 in RAM, implement a copy function (refer to the following listing).
/* Start address of the application code in ROM. */ #define CODE_SRC 0x800 /* Destination address of the application code in RAM. */ #define CODE_DEST 0x7000 #define CODE_SIZE 0x90 /* Size of the code which must be copied.*/ void CopyCode(void) { unsigned char *ptrSrc, *ptrDest; ptrSrc = (unsigned char *)CODE_SRC; ptrDest = (unsigned char *)CODE_DEST; memcpy (ptrDest, ptrSrc, CODE_SIZE); }
The following topics are covered in this section: