Fix MAIN_THREAD_ID check
Fix MAIN_THREAD_ID check

In cmsis_os.h OS_TIMERS is undefined unless the timer thread is
disabled, in which case it is defined to 0. When comparing against
an undefined value, the undefined value will evaluate as if it were
0. Because of this the MAIN_THREAD_ID was always set to 0x1.
This patch fixes that problem by checking if OS_TIMERS is defined
before comparing it to 0.

This problem only effects IAR since it has a different heap/stack
layout. GCC_ARM and ARM have a dedicated stack region so
the presence of a guard word and stack checking does not cause
problems.

This problem manifested on the NRF51_DK in the pull request
https://github.com/mbedmicro/mbed/pull/2211
as a c_strings test failure on floating point. This is because the
guard word of the main stack overlapped with standard library
data used by sprintf and corrupted it.

andreaslarssonublox/mbed,geky/mbed,pradeep-gr/mbed-os5-onsemi,arostm/mbed-os,tung7970/mbed-os,YarivCol/mbed-os,pradeep-gr/mbed-os5-onsemi,adustm/mbed,nvlsianpu/mbed,kl-cruz/mbed-os,HeadsUpDisplayInc/mbed,tung7970/mbed-os-1,andcor02/mbed-os,theotherjimmy/mbed,andreaslarssonublox/mbed,betzw/mbed-os,fvincenzo/mbed-os,netzimme/mbed-os,ryankurte/mbed-os,CalSol/mbed,catiedev/mbed-os,bcostm/mbed-os,bcostm/mbed-os,HeadsUpDisplayInc/mbed,YarivCol/mbed-os,ryankurte/mbed-os,j-greffe/mbed-os,pradeep-gr/mbed-os5-onsemi,svogl/mbed-os,fanghuaqi/mbed,nRFMesh/mbed-os,catiedev/mbed-os,nRFMesh/mbed-os,karsev/mbed-os,Archcady/mbed-os,karsev/mbed-os,adamgreen/mbed,svogl/mbed-os,andreaslarssonublox/mbed,mazimkhan/mbed-os,svogl/mbed-os,nRFMesh/mbed-os,geky/mbed,catiedev/mbed-os,karsev/mbed-os,ryankurte/mbed-os,monkiineko/mbed-os,tung7970/mbed-os-1,catiedev/mbed-os,j-greffe/mbed-os,cvtsi2sd/mbed-os,betzw/mbed-os,arostm/mbed-os,nvlsianpu/mbed,infinnovation/mbed-os,geky/mbed,adustm/mbed,kl-cruz/mbed-os,infinnovation/mbed-os,mikaleppanen/mbed-os,bulislaw/mbed-os,tung7970/mbed-os-1,cvtsi2sd/mbed-os,Archcady/mbed-os,svastm/mbed,NXPmicro/mbed,mmorenobarm/mbed-os,karsev/mbed-os,bulislaw/mbed-os,jeremybrodt/mbed,mmorenobarm/mbed-os,netzimme/mbed-os,screamerbg/mbed,kjbracey-arm/mbed,NXPmicro/mbed,cvtsi2sd/mbed-os,infinnovation/mbed-os,RonEld/mbed,theotherjimmy/mbed,nRFMesh/mbed-os,radhika-raghavendran/mbed-os5.1-onsemi,fvincenzo/mbed-os,mazimkhan/mbed-os,bulislaw/mbed-os,theotherjimmy/mbed,fahhem/mbed-os,monkiineko/mbed-os,svastm/mbed,maximmbed/mbed,radhika-raghavendran/mbed-os5.1-onsemi,fahhem/mbed-os,mazimkhan/mbed-os,c1728p9/mbed-os,CalSol/mbed,radhika-raghavendran/mbed-os5.1-onsemi,Archcady/mbed-os,screamerbg/mbed,c1728p9/mbed-os,betzw/mbed-os,svastm/mbed,tung7970/mbed-os-1,bcostm/mbed-os,cvtsi2sd/mbed-os,RonEld/mbed,monkiineko/mbed-os,svogl/mbed-os,betzw/mbed-os,maximmbed/mbed,nRFMesh/mbed-os,maximmbed/mbed,arostm/mbed-os,kjbracey-arm/mbed,monkiineko/mbed-os,mbedmicro/mbed,adustm/mbed,infinnovation/mbed-os,arostm/mbed-os,adustm/mbed,adamgreen/mbed,adustm/mbed,andcor02/mbed-os,j-greffe/mbed-os,theotherjimmy/mbed,andreaslarssonublox/mbed,betzw/mbed-os,mikaleppanen/mbed-os,mazimkhan/mbed-os,theotherjimmy/mbed,c1728p9/mbed-os,netzimme/mbed-os,nvlsianpu/mbed,adamgreen/mbed,NXPmicro/mbed,fvincenzo/mbed-os,Archcady/mbed-os,svogl/mbed-os,tung7970/mbed-os,RonEld/mbed,screamerbg/mbed,maximmbed/mbed,kl-cruz/mbed-os,tung7970/mbed-os-1,nvlsianpu/mbed,screamerbg/mbed,fanghuaqi/mbed,jeremybrodt/mbed,mazimkhan/mbed-os,CalSol/mbed,YarivCol/mbed-os,j-greffe/mbed-os,YarivCol/mbed-os,HeadsUpDisplayInc/mbed,Archcady/mbed-os,adamgreen/mbed,monkiineko/mbed-os,adamgreen/mbed,kl-cruz/mbed-os,kl-cruz/mbed-os,netzimme/mbed-os,j-greffe/mbed-os,tung7970/mbed-os,tung7970/mbed-os,betzw/mbed-os,bcostm/mbed-os,fanghuaqi/mbed,mbedmicro/mbed,andcor02/mbed-os,andcor02/mbed-os,maximmbed/mbed,CalSol/mbed,andcor02/mbed-os,netzimme/mbed-os,catiedev/mbed-os,mbedmicro/mbed,jeremybrodt/mbed,fanghuaqi/mbed,fahhem/mbed-os,HeadsUpDisplayInc/mbed,geky/mbed,svogl/mbed-os,mmorenobarm/mbed-os,fahhem/mbed-os,ryankurte/mbed-os,karsev/mbed-os,pradeep-gr/mbed-os5-onsemi,tung7970/mbed-os,catiedev/mbed-os,fvincenzo/mbed-os,mmorenobarm/mbed-os,andcor02/mbed-os,fanghuaqi/mbed,nvlsianpu/mbed,HeadsUpDisplayInc/mbed,ryankurte/mbed-os,RonEld/mbed,kl-cruz/mbed-os,ryankurte/mbed-os,c1728p9/mbed-os,svastm/mbed,NXPmicro/mbed,jeremybrodt/mbed,arostm/mbed-os,kjbracey-arm/mbed,NXPmicro/mbed,YarivCol/mbed-os,RonEld/mbed,bulislaw/mbed-os,adustm/mbed,bcostm/mbed-os,nvlsianpu/mbed,radhika-raghavendran/mbed-os5.1-onsemi,fahhem/mbed-os,HeadsUpDisplayInc/mbed,c1728p9/mbed-os,j-greffe/mbed-os,mmorenobarm/mbed-os,CalSol/mbed,cvtsi2sd/mbed-os,bulislaw/mbed-os,mmorenobarm/mbed-os,mbedmicro/mbed,RonEld/mbed,radhika-raghavendran/mbed-os5.1-onsemi,bcostm/mbed-os,Archcady/mbed-os,radhika-raghavendran/mbed-os5.1-onsemi,mikaleppanen/mbed-os,screamerbg/mbed,cvtsi2sd/mbed-os,kjbracey-arm/mbed,infinnovation/mbed-os,CalSol/mbed,monkiineko/mbed-os,mbedmicro/mbed,bulislaw/mbed-os,andreaslarssonublox/mbed,mikaleppanen/mbed-os,jeremybrodt/mbed,maximmbed/mbed,pradeep-gr/mbed-os5-onsemi,geky/mbed,mazimkhan/mbed-os,c1728p9/mbed-os,nRFMesh/mbed-os,theotherjimmy/mbed,netzimme/mbed-os,infinnovation/mbed-os,YarivCol/mbed-os,fvincenzo/mbed-os,arostm/mbed-os,screamerbg/mbed,karsev/mbed-os,mikaleppanen/mbed-os,fahhem/mbed-os,NXPmicro/mbed,svastm/mbed,pradeep-gr/mbed-os5-onsemi,adamgreen/mbed,mikaleppanen/mbed-os