Patching symbol definitions using $Super$$ and $Sub$$
In this section:
Using the $Sub$$ and $Super$$ special patterns, you can patch existing symbol definitions in situations where you would otherwise not be able to modify the symbol, for example, when a symbol is located in an external library or in ROM code.
The $Super$$ special pattern identifies the original unpatched function used for calling the original function directly.
The $Sub$$ special pattern identifies the new function that is called instead of the original function. You can use the $Sub$$ special pattern to add processing before or after the original function.
An example using the $Super$$ and $Sub$$ patterns
The following example shows how to use the $Super$$ and $Sub$$ patterns to insert a call to the function ExtraFunc() before the call to the legacy function foo().
extern void ExtraFunc(void);
extern void $Super$$foo(void);
/* this function is called instead of the original foo() */
void $Sub$$foo(void)
{
ExtraFunc(); /* does some extra setup work */
$Super$$foo(); /* calls the original foo() function */
/* To avoid calling the original foo() function
* omit the $Super$$foo(); function call.
*/
}