samples: logging/dictionary: fix long double compilation error
The cbprintf packaging needs CONFIG_CBPRINTF_PACKAGE_LONGDOUBLE to be enabled to work with long double. So #ifdef that inside CONFIG_FPU. Also add to the sample.yaml to enable testing with FPU and long doubles. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
16f5249b26
commit
2c5cf6b243
2 changed files with 28 additions and 8 deletions
|
@ -1,7 +1,26 @@
|
||||||
sample:
|
sample:
|
||||||
description: Dictionary-based Logging Sample Application
|
description: Dictionary-based Logging Sample Application
|
||||||
name: logging_dictionary
|
name: logging_dictionary
|
||||||
|
common:
|
||||||
|
integration_platforms:
|
||||||
|
- qemu_x86
|
||||||
|
- qemu_x86_64
|
||||||
|
- qemu_cortex_a53
|
||||||
|
- qemu_cortex_a53_smp
|
||||||
tests:
|
tests:
|
||||||
sample.logger.basic.dictionary:
|
sample.logger.basic.dictionary:
|
||||||
build_only: true
|
build_only: true
|
||||||
tags: logging
|
tags: logging
|
||||||
|
sample.logger.basic.dictionary.fpu:
|
||||||
|
build_only: true
|
||||||
|
tags: logging
|
||||||
|
filter: CONFIG_CPU_HAS_FPU
|
||||||
|
extra_configs:
|
||||||
|
- CONFIG_FPU=y
|
||||||
|
sample.logger.basic.dictionary.fpu.long_double:
|
||||||
|
build_only: true
|
||||||
|
tags: logging
|
||||||
|
filter: CONFIG_CPU_HAS_FPU
|
||||||
|
extra_configs:
|
||||||
|
- CONFIG_FPU=y
|
||||||
|
- CONFIG_CBPRINTF_PACKAGE_LONGDOUBLE=y
|
||||||
|
|
|
@ -31,13 +31,6 @@ void main(void)
|
||||||
char vs1[32];
|
char vs1[32];
|
||||||
void *p = s;
|
void *p = s;
|
||||||
|
|
||||||
#ifdef CONFIG_FPU
|
|
||||||
float f = 66.67;
|
|
||||||
double d = 68.69;
|
|
||||||
|
|
||||||
long double ld = 70.71;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printk("Hello World! %s\n", CONFIG_BOARD);
|
printk("Hello World! %s\n", CONFIG_BOARD);
|
||||||
|
|
||||||
LOG_ERR("error string");
|
LOG_ERR("error string");
|
||||||
|
@ -66,6 +59,14 @@ void main(void)
|
||||||
LOG_HEXDUMP_DBG(hexdump_msg, strlen(hexdump_msg), "For HeXdUmP!");
|
LOG_HEXDUMP_DBG(hexdump_msg, strlen(hexdump_msg), "For HeXdUmP!");
|
||||||
|
|
||||||
#ifdef CONFIG_FPU
|
#ifdef CONFIG_FPU
|
||||||
LOG_DBG("float %f, double %f, long double %Lf", f, d, ld);
|
float f = 66.67;
|
||||||
|
double d = 68.69;
|
||||||
|
|
||||||
|
LOG_DBG("float %f, double %f", f, d);
|
||||||
|
#ifdef CONFIG_CBPRINTF_PACKAGE_LONGDOUBLE
|
||||||
|
long double ld = 70.71;
|
||||||
|
|
||||||
|
LOG_DBG("long double %Lf", ld);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue