this is the third attempt to make a pull request. Sorry for spam. :)
This CL adds hal/interface/user_time.h with uint64_t usecTimestamp(void) implemented.
It uses TIM1, which is now initialized at startup with 1 microsecond interval. hal/src/freeRTOSdebug.c now uses usecTimestamp, instead of a raw access to the counters.
Also, fixed a race condition, where an TIM1 interrupt could happen in the middle of evaluating the expression in freeRTOSdebug which would result in a wrong timestamp. Use atomic load and write helpers provided by CMSIS library.
Only proper handling of timer overflow and scaling to stay in integer land will be necessary.
There could be race condition in your code if usecTimestamp() is called with interrupts disabled (when TIM1_UP_IRQHandler can't run) - the value may overflow, but interrupt routine is not called. NVIC_GetPendingIRQ in critical section with overflow handler disabled is probably way to solve this; reading counter twice won't be necessary)
It's from vTaskIncrementTick in tasks.c. When there is critical section (uxSchedulerSuspended is nonzero after vTaskSuspendAll), the timer ticks are counted into uxMissedTicks and replayed in when xTaskResumeAll is called.