Hello I am working with a C161U micro on an EASY UTAH target. Well I have two projects, startup and application, that I load on Flash with the Flash Tool. At the target reset, what it is on flash begins to run: the startup project. The startup project copies the application project from flash to RAM, and its last instruction is to jump to the beginning of the RAM, and then the application project is executed from RAM. To accomplish this, I must avoid absolute call to functions by converting the calls in relative calls thanks to the key word near before each function. For example the function void near config (void) is at address 0x20100 (this is the load address in Flash), so if the RAM start address is 0x110000, then this function is copied at address 0x110100. When this function is called, this is not with a CALLS CC_US, 0x20100 but with a CALLA CC_US, 0x00100 thanks to near. The call is then relative and the function is executed from RAM. Well, I have a problem with the library functions used in my program C_PCASTS or MEMCPY, because they are executed in Flash. I don't know how to specify that they must be called with relative calls since I can't put the near word before their declarations. How to obtain their execution in RAM and not in Flash? Thanks for your help Best regards Carmen
Another solution might be to make a local C implementation of the memcpy function that expects exactly the pointer types as they appear in your flash programming code. In this way you can avoid the CALLS instructions.