# Using SysTick_Handler in mbed LPC1768 project

I'm trying to use SysTick_Handler in a project which uses the mbed libraries and RTOS, however on compilation, the following error is returned: Error: Symbol SysTick_Handler multiply defined (by ../../build/mbed-os/rtos/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/TARGET_M3/irq_cm3.LPC1768.o and ../../build/main.LPC1768.o). 

This leads me to believe that SysTick_Handler is used somewhere in the mbed library. Does this mean I cannot use it, and I have to resort to using the LPC1768s Timers?

The other definition appears to be in irq_cm3.0

Boiled down version of code:

#include "mbed.h"
#include "EthernetInterface.h"

extern "C" void SysTick_Handler()
{

}

// Socket demo
int main()
{
SysTick_Config(SystemCoreClock / 1000);

}

• The compiler should tell you exactly where the two definitions occur...in which files. Look at the entire error message. You also need to show us your code. – Elliot Alderson Apr 4 '19 at 18:54
• It seems likely to me that the mbed libraries will provide you with a callback/hook to allow you to link your own handler to the existing one. – brhans Apr 4 '19 at 18:58
• @ElliotAlderson, please see updated question. – 19172281 Apr 4 '19 at 19:02
• Looks like you need to either put your code in the existing function, call your code from the existing function, or remove that and substitute your own. Any of these may break compatibility with future MBED versions so you'll need to do something like use a version control system to keep careful track of what changes you make on top of the upstream. That said, it's not entirely convincing that you have found the code in use; one would expect a counter to be incremented and likely some pumping of the RTOS scheduler, unless it is operating off a different timer. – Chris Stratton Apr 4 '19 at 19:08
• For the record, it is the linker which would notice multiple definition, not the compiler. – Chris Stratton Apr 4 '19 at 19:09

As said in the comments, the SysTick timer is indeed in use by the RTOS and you should not muck with this. Use the Ticker class if you need to tick regularly, it will drive the underlying high-precision timer on the platform (and is portable code). An additional benefit is that multiple Tickers can be created and they'll all use the same hardware timer.
void tick() {