Hi
If you download the free uTasker open source project from GitHub you will have all code.
Here is a snippet to show you how a thumb 2 call can be created in SRAM to execute a routine (here fnFlashRotine())
static void (*fnRAM_code)(void) = 0;
#define PROG_WORD_SIZE 30
int i = 0;
unsigned char *ptrThumb2 = (unsigned char *)fnFlashRoutine;
static unsigned short usProgSpace[PROG_WORD_SIZE] = {0};
ptrThumb2 = (unsigned char *)(((CAST_POINTER_ARITHMETIC)ptrThumb2) & ~0x1);
while (i < PROG_WORD_SIZE) {
usProgSpace[i++] = *(unsigned short *)ptrThumb2;
ptrThumb2 += sizeof (unsigned short);
}
ptrThumb2 = (unsigned char *)usProgSpace;
ptrThumb2++;
fnRAM_code = (void(*)(void))(ptrThumb2);
and then can be executed with
fnRAM_code(); // execute the command in SRAM
Regards
Mark