代码:
extern int $Super$$main(void); /* re-define main function */ int $Sub$$main(void) { rt_hw_interrupt_disable(); rtthread_startup(); return 0; }
Use of $Super$$ and $Sub$$ to patch symbol definitions
There are special patterns you can use for situations where an existing symbol cannot be modified.
An existing symbol cannot be modified, for example, if it is located in an external library or in ROM code. In such cases you can use the $Super$$ and $Sub$$ patterns to patch an existing symbol.To patch the definition of the function foo():
$Super$$foo
Identifies the original unpatched function foo(). Use this to call the original function directly.
$Sub$$foo
Identifies the new function that is called instead of the original function foo(). Use this to add processing before or after the original function.
-----Note-----
The $Sub$$ and $Super$$ mechanism only works at static link time, $Super$$ references cannot be imported or exported into the dynamic symbol table.
详见参考手册:ARM® Compiler v5.06 for µVision® Version 5 armlink User Guide
链接:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0377g/pge1362065967698.html