If the module code provides callbacks to _SetHPTimerAfterNow, we'll need verify whether they can be thumb or provide them as ARM for pre-digic 6 cams.

This has turned out to be harder than expected. While there is no problem using Thumb callbacks on DryOS cameras, Vx cams do need ARM callbacks. Providing ARM callback functions (and exporting them to modules) in platform/wrappers.c doesn't seem like a good idea (one may want to use more than one timer).While I can make a suitable ARM function in module code (by using asm), I do not seem to be able to pass its address correctly to SetHPTimerAfterNow() - the address gets the thumb bit.Could there be an easy way to solve this?

int __attribute__((naked,noinline)) do_sample_on_change_ARM_(int a, int b) { asm volatile (#ifndef THUMB_FW ".code 32\n""do_sample_on_change_ARM:\n" "adr r3, dsoc_thumb+1\n" "bx r3\n" ".code 16\n""dsoc_thumb:\n"#endif "push {lr}\n" "bl do_sample_on_change\n" "pop {pc}\n" //"b do_sample_on_change\n" // no good, generates unsupported "relocation type 102" ); // just to calm down the compiler return 0;}do_sample_on_change_ARM_() can't be passed to SetHPTimerAfterNow(), because it is treated as a Thumb function. I have come up with a workaround that actually works: the do_sample_on_change_ARM label can be used correctly, probably because it's inside a .code 32 section (do_sample_on_change_ARM is of course declared as the correct type of function).The wrapper's Thumb section can't be as simple as a b <label> instruction because it generates a relocation type that can't be handled by elf2flt.

int __attribute__((naked,noinline)) do_sample_on_change_ARM_(int a, int b) { asm volatile (#ifndef THUMB_FW ".code 32\n""do_sample_on_change_ARM:\n" "adr r3, dsoc_thumb+1\n" "bx r3\n" ".code 16\n""dsoc_thumb:\n"#endif "push {lr}\n" "bl do_sample_on_change\n" "pop {pc}\n" //"b do_sample_on_change\n" // no good, generates unsupported "relocation type 102" ); // just to calm down the compiler return 0;}do_sample_on_change_ARM_() can't be passed to SetHPTimerAfterNow(), because it is treated as a Thumb function. I have come up with a workaround that actually works: the do_sample_on_change_ARM label can be used correctly, probably because it's inside a .code 32 section (do_sample_on_change_ARM is of course declared as the correct type of function).The wrapper's Thumb section can't be as simple as a b <label> instruction because it generates a relocation type that can't be handled by elf2flt.

Is 'do_sample_on_change_ARM' in a separate code file with -marm added to the build command?

Is 'do_sample_on_change_ARM' in a separate code file with -marm added to the build command?

No, that's the kind of thing I wanted to avoid. do_sample_on_change_ARM is a label inside the do_sample_on_change_ARM_() function. I'm using this declaration to make it work like a function: int do_sample_on_change_ARM(int, int)

Is 'do_sample_on_change_ARM' in a separate code file with -marm added to the build command?

No, that's the kind of thing I wanted to avoid. do_sample_on_change_ARM is a label inside the do_sample_on_change_ARM_() function. I'm using this declaration to make it work like a function: int do_sample_on_change_ARM(int, int)

Your call; but I think a C source file with -marm on the build might be easier to follow (eliminates the asm code and the label workaround).