To reproduce, use the attached foo.c:
Multiple definition of _TR0
Observed with rev #7519 but this must have been the case for a while (at least since the introduction of cc2530.h).
This is a problem caused by the inclusion of 8051.h in printfl.c
/* just for the SP */
Including the entire 8051.h just for SP is a bit overkill, in my humble opinion. Furthermore, the only place where SP is used is in function pval, which is excluded by default.
What brings the problem to the surface in this particular case is that cc2530.h does this:
SFRX(TR0, 0x624B); // Test register 0
This is a) correct and b) totally different than TCON.TR0. I suspect different platform header files may cause similar namespace conflicts.
Perhaps only declare SP and wrap it inside the same #if guard as pval? Like so:
svn diff device/lib/printfl.c
--- device/lib/printfl.c (revision 7519)
+++ device/lib/printfl.c (working copy)
@@ -46,9 +46,11 @@
-/* just for the SP */
+SFR(SP, 0x81); /* Stack pointer */
static __data char radix ;
static __bit long_flag = 0;