From 5689c6b6b4499a51a342499e09bd58529b1d89ae Mon Sep 17 00:00:00 2001 From: pjs Date: Tue, 28 Dec 2004 21:54:28 +0000 Subject: [PATCH] Don't provide printf_fast, printf_fast_f and printf_tiny on architectures they don't support (eg, with --xstack). Don't compile shared asm float helper functions when asm float lib not enabled. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3619 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 14 ++++++++++++++ device/include/stdio.h | 2 +- device/lib/_fsget1arg.c | 4 +++- device/lib/_fsget2args.c | 3 ++- device/lib/_fsnormalize.c | 6 ++++++ device/lib/_fsreturnval.c | 5 +++++ device/lib/_fsrshift.c | 4 ++++ device/lib/_fsswapargs.c | 5 +++++ device/lib/printf_fast.c | 14 +++++++++++++- device/lib/printf_fast_f.c | 6 ++++++ device/lib/printf_tiny.c | 14 ++++++++++++++ 11 files changed, 73 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84473337..f6d03c72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2004-12-28 Paul Stoffregen + + * device/lib/printf_fast.c: only build on supported arch. + * device/lib/printf_tiny.c: only build on supported arch. + * device/lib/printf_fast_f.c: only build if asm float lib + * device/lib/_fsget1arg.c: only build if asm float lib + * device/lib/_fsget2args.c: only build if asm float lib + * device/lib/_fsnormalize.c: only build if asm float lib + * device/lib/_fsreturnval.c: only build if asm float lib + * device/lib/_fsrshift.c: only build if asm float lib + * device/lib/_fsswapargs.c: only build if asm float lib + * device/include/stdio.h: don't provide print_fast, + print_fast_f, print_tiny prototypes if --xstack used + 2004-12-28 Maarten Brock * device/lib/sincosf.c (sincosf): don't invert bit/bool by ~ diff --git a/device/include/stdio.h b/device/include/stdio.h index d96ebc28..d02c5eb1 100644 --- a/device/include/stdio.h +++ b/device/include/stdio.h @@ -58,7 +58,7 @@ extern char *gets(char *); extern char getchar(void); extern void putchar(char); -#ifdef __mcs51 +#if defined(SDCC_mcs51) && !defined(SDCC_USE_XSTACK) extern void printf_fast(code char *fmt, ...) _REENTRANT; extern void printf_fast_f(code char *fmt, ...) _REENTRANT; extern void printf_tiny(code char *fmt, ...) _REENTRANT; diff --git a/device/lib/_fsget1arg.c b/device/lib/_fsget1arg.c index abf17260..f55554b5 100644 --- a/device/lib/_fsget1arg.c +++ b/device/lib/_fsget1arg.c @@ -21,6 +21,8 @@ #include +#ifdef FLOAT_ASM_MCS51 + static void dummy(void) _naked { // input passed in a,b,dph,dpl @@ -46,6 +48,6 @@ fsgetarg: _endasm; } - +#endif diff --git a/device/lib/_fsget2args.c b/device/lib/_fsget2args.c index 404b8ad1..d386be05 100644 --- a/device/lib/_fsget2args.c +++ b/device/lib/_fsget2args.c @@ -22,7 +22,7 @@ #include - +#ifdef FLOAT_ASM_MCS51 static void dummy(void) _naked { @@ -72,6 +72,7 @@ fsgetargs: _endasm; } +#endif diff --git a/device/lib/_fsnormalize.c b/device/lib/_fsnormalize.c index f404452c..4eeeca96 100644 --- a/device/lib/_fsnormalize.c +++ b/device/lib/_fsnormalize.c @@ -21,6 +21,9 @@ #define SDCC_FLOAT_LIB #include + +#ifdef FLOAT_ASM_MCS51 + static void dummy(void) _naked { _asm @@ -70,3 +73,6 @@ fs_normalize_a: ret _endasm; } + +#endif + diff --git a/device/lib/_fsreturnval.c b/device/lib/_fsreturnval.c index 798f934b..6dfc85cf 100644 --- a/device/lib/_fsreturnval.c +++ b/device/lib/_fsreturnval.c @@ -21,6 +21,9 @@ #define SDCC_FLOAT_LIB #include + +#ifdef FLOAT_ASM_MCS51 + static void dummy(void) _naked { _asm @@ -99,3 +102,5 @@ fs_return_nan: _endasm; } +#endif + diff --git a/device/lib/_fsrshift.c b/device/lib/_fsrshift.c index 5e7e7e90..1f32f26a 100644 --- a/device/lib/_fsrshift.c +++ b/device/lib/_fsrshift.c @@ -22,6 +22,8 @@ #include +#ifdef FLOAT_ASM_MCS51 + static void dummy(void) _naked { _asm @@ -95,3 +97,5 @@ fs_rshift_a: _endasm; } +#endif + diff --git a/device/lib/_fsswapargs.c b/device/lib/_fsswapargs.c index 85404cb4..d2573b02 100644 --- a/device/lib/_fsswapargs.c +++ b/device/lib/_fsswapargs.c @@ -21,6 +21,9 @@ #define SDCC_FLOAT_LIB #include + +#ifdef FLOAT_ASM_MCS51 + static void dummy(void) _naked { _asm @@ -53,3 +56,5 @@ fs_swap_a_b: _endasm; } +#endif + diff --git a/device/lib/printf_fast.c b/device/lib/printf_fast.c index 698f9fa1..1db10082 100644 --- a/device/lib/printf_fast.c +++ b/device/lib/printf_fast.c @@ -119,6 +119,18 @@ static data unsigned int i2bcd_tmp; // slow 32 int conversion needs temp space #define PRINTF_FAST printf_fast #endif + +#if !defined(SDCC_mcs51) || defined(SDCC_USE_XSTACK) || defined(_SDCC_NO_ASM_LIB_FUNCS) +// Does printf_fast really work on ds390 and ds400? +// If it does, enable them in the line above +#if defined(SDCC_USE_XSTACK) +#warning "printf_fast not built, does not support --xstack" +#elif defined(_SDCC_NO_ASM_LIB_FUNCS) +#warning "printf_fast not built, _SDCC_NO_ASM_LIB_FUNCS defined" +#endif +#else // defines are compatible with printf_fast + + void PRINTF_FAST(code char *fmt, ...) reentrant { fmt; /* supress unreferenced variable warning */ @@ -1735,5 +1747,5 @@ static code unsigned char frac2bcd[] = { #endif // FLOAT - +#endif // defines compatible with printf_fast diff --git a/device/lib/printf_fast_f.c b/device/lib/printf_fast_f.c index eb914592..c2504a65 100644 --- a/device/lib/printf_fast_f.c +++ b/device/lib/printf_fast_f.c @@ -1,7 +1,13 @@ // Same as printf_fast, but with floating point enabled +#define SDCC_FLOAT_LIB +#include + +#ifdef FLOAT_ASM_MCS51 + #define FLOAT #define PRINTF_FAST printf_fast_f #include "printf_fast.c" +#endif diff --git a/device/lib/printf_tiny.c b/device/lib/printf_tiny.c index 4a6dfd4d..4db9fe4f 100644 --- a/device/lib/printf_tiny.c +++ b/device/lib/printf_tiny.c @@ -54,6 +54,18 @@ #define print_zero_flag PSW.5 +#if !defined(SDCC_mcs51) || defined(SDCC_USE_XSTACK) || defined(_SDCC_NO_ASM_LIB_FUNCS) +// Does printf_tiny really work on ds390 and ds400? +// If it does, enable them in the line above +#if defined(SDCC_USE_XSTACK) +#warning "printf_tiny not built, does not support --xstack" +#elif defined(_SDCC_NO_ASM_LIB_FUNCS) +#warning "printf_tiny not built, _SDCC_NO_ASM_LIB_FUNCS defined" +#endif +#else // defines are compatible with printf_tiny + + + void printf_tiny(code char *fmt, ...) reentrant { fmt; /* supress unreferenced variable warning */ @@ -273,3 +285,5 @@ printf_end: } +#endif // defines compatible with printf_tiny + -- 2.47.2