You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current API model is to have a function hook specified as part of the setup or configuration functions, for example timer_init(timer_c0,timer_norm,31999,NULL,&timer_overflow_hook); where timer_overflow_hook is a user-defined function to do something on overflow.
This means for an interrupt we do a bunch of checking at run-time if the hook is defined, and then invoke it via the function pointer.
Some APIs instead use weak bound functions to provide an "event" system that you can simply define a function to handle, and the default function is to do nothing. So instead of passing the function pointer above, you would just provide a function in your code:
void EVENT_timer_c0_ovf(void) { ... }
As the event is defined in the library as weak, it should be replaced by the user function at linking.
I am not sure, however, if the pre-compiled objects in libkakapo.a can still be weakly linked so they can be replaced when final linking happens. It may depend on LTO, which is only in recent (>=4.8) avr-gcc versions, and may be a little buggy.
The text was updated successfully, but these errors were encountered:
The current API model is to have a function hook specified as part of the setup or configuration functions, for example
timer_init(timer_c0,timer_norm,31999,NULL,&timer_overflow_hook);
wheretimer_overflow_hook
is a user-defined function to do something on overflow.This means for an interrupt we do a bunch of checking at run-time if the hook is defined, and then invoke it via the function pointer.
Some APIs instead use weak bound functions to provide an "event" system that you can simply define a function to handle, and the default function is to do nothing. So instead of passing the function pointer above, you would just provide a function in your code:
void EVENT_timer_c0_ovf(void) { ... }
As the event is defined in the library as weak, it should be replaced by the user function at linking.
I am not sure, however, if the pre-compiled objects in libkakapo.a can still be weakly linked so they can be replaced when final linking happens. It may depend on LTO, which is only in recent (>=4.8) avr-gcc versions, and may be a little buggy.
The text was updated successfully, but these errors were encountered: