Hi Everyone.
I've written Base Operating System functionality, and now have to apply patches(using Memory Management Unit which allows me to reassign some CODE memory space to XDATA or EEPROM), which uses functions implemented in Base OS.
But i found that if i declare OS function handler like this:
#define OS_FUNCTION_ADDRESS_FROM_MAP 0x80abcd code void(* func_hndl) (void) = OS_FUNCTION_ADDRESS_FROM_MAP
and then simply do in my patch
func_hndl();
the hex files of the patch contains indirect ECALL, not direct ECALL which results in NMI when patch is applied and called.
If i simply do in my patch
#define OS_FUNCTION_ADDRESS_FROM_MAP 0x80abcd void func_hndl() { #asm ECALL OS_FUNCTION_ADDRESS_FROM_MAP #endasm } .... func_hndl(); ....
it works fine.
Any suggestion why this happens, or how to generate direct ECALL, not indirect one?