issue with timer code
I haven't declared any of the swd pins of the board for gpio


Yes you did in this line:

GPIOA-&gt;MODER=0X00000040;


SWD uses pins PA13 and PA14. These pins are initialized in alternate function mode at device reset, in order to let the debugger using them. According to the Reference Manual, GPIOA-&gt;MODER is set to 0xA8000000 at reset, alternate functions for PA13, PA14 and PA15 (PA15 is not used by SWD, but with JTAG debugging) 

The above line sets all GPIOA pins except PA3 as input. Do some masking to preserve the port mode bits:

GPIOA-&gt;MODER = (GPIOA-&gt;MODER &amp; ~0xC0) | 0x40;