Skip to content

Commit 4878516

Browse files
committed
add: qfplib替换默认的fplib,节省空间
1 parent 27f44a8 commit 4878516

File tree

7 files changed

+7452
-2
lines changed

7 files changed

+7452
-2
lines changed

platform.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ compiler.extra_flags=-mcpu={build.mcu} {build.fpu} {build.float-abi} -DUSE_FULL_
3131
# 汇编编译器参数
3232
compiler.S.flags={compiler.extra_flags} -c -x assembler-with-cpp {compiler.air.extra_include}
3333

34-
compiler.c.flags={compiler.extra_flags} -c {build.flags.optimize} {build.flags.debug} {compiler.warning_flags} -std={compiler.c.std} -fsingle-precision-constant -ffunction-sections -fdata-sections --param max-inline-insns-single=500 -MMD {compiler.air.extra_include}
34+
compiler.c.flags={compiler.extra_flags} -c {build.flags.optimize} {build.flags.debug} {compiler.warning_flags} -std={compiler.c.std} -ffreestanding -fsingle-precision-constant -ffunction-sections -fdata-sections --param max-inline-insns-single=500 -MMD {compiler.air.extra_include}
3535

36-
compiler.cpp.flags={compiler.extra_flags} -c {build.flags.optimize} {build.flags.debug} {compiler.warning_flags} -std={compiler.cpp.std} -fsingle-precision-constant -ffunction-sections -fdata-sections -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -MMD {compiler.air.extra_include}
36+
compiler.cpp.flags={compiler.extra_flags} -c {build.flags.optimize} {build.flags.debug} {compiler.warning_flags} -std={compiler.cpp.std} -ffreestanding -fsingle-precision-constant -ffunction-sections -fdata-sections -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -fno-use-cxa-atexit -MMD {compiler.air.extra_include}
3737

3838
compiler.ar.flags=rcs
3939

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#include "stdint.h"
2+
3+
#include "qfplib-m0-full.h"
4+
5+
//__aeabi_frsub 2 float float 返回 y 减去 x
6+
float __aeabi_frsub(float x, float y)
7+
{
8+
return __aeabi_fsub(y,x);
9+
}
10+
//_frdiv 2 float float 返回 y 除以 x
11+
float _frdiv(float x, float y)
12+
{
13+
return __aeabi_fdiv(y,x);
14+
}
15+
//__aeabi_drsub 2 double double 返回 y 减去 x
16+
double __aeabi_drsub(double x, double y)
17+
{
18+
return __aeabi_dsub(y,x);
19+
}
20+
//_drdiv 2 double double 返回 y 除以 x
21+
double _drdiv(double x, double y)
22+
{
23+
return __aeabi_ddiv(y,x);
24+
}
25+
26+
/*
27+
_frem 2 float float 返回 x 除以 y 的余数(参见注释 a)
28+
_frnd float float 返回 x 四舍五入为整数(参见注释 b)
29+
_drem 2 double double 返回 x 除以 y 的余数(参见注释 a 和 c)
30+
_drnd double double 返回 x 四舍五入为整数(参见注释 b)
31+
32+
_ffix_r float int
33+
_ffixu_r float unsigned int
34+
_dfix_r double int
35+
_dfixu_r double unsigned int
36+
_ll_sfrom_f_r float long long
37+
_ll_ufrom_f_r float unsigned long long
38+
_ll_sfrom_d_r double long long
39+
_ll_ufrom_d_r double unsigned long long
40+
41+
https://developer.arm.com/documentation/dui0475/m/floating-point-support/the-software-floating-point-library--fplib/fplib-comparisons-between-floats-and-doubles?lang=en
42+
https://developer.arm.com/documentation/dui0475/m/floating-point-support/the-software-floating-point-library--fplib/fplib-c99-functions?lang=en
43+
*/
44+
45+
//These functions return zero if neither argument is NaN, and a and b are equal.
46+
int __eqsf2(float a, float b) { return qfp_fcmp(a,b);}
47+
int __eqdf2(double a, double b) { return qfp_dcmp(a,b);}
48+
//These functions return a nonzero value if either argument is NaN, or if a and b are unequal.
49+
int __nesf2(float a, float b) { return qfp_fcmp(a,b);}
50+
int __nedf2(double a, double b) { return qfp_dcmp(a,b);}
51+
//These functions return a value greater than or equal to zero if neither argument is NaN, and a is greater than or equal to b.
52+
int __gesf2(float a, float b) { return qfp_fcmp(a,b);}
53+
int __gedf2(double a, double b) { return qfp_dcmp(a,b);}
54+
//These functions return a value less than zero if neither argument is NaN, and a is strictly less than b.
55+
int __ltsf2(float a, float b) { return qfp_fcmp(a,b);}
56+
int __ltdf2(double a, double b) { return qfp_dcmp(a,b);}
57+
//These functions return a value less than or equal to zero if neither argument is NaN, and a is less than or equal to b.
58+
int __lesf2(float a, float b) { return qfp_fcmp(a,b);}
59+
int __ledf2(double a, double b) { return qfp_dcmp(a,b);}
60+
//These functions return a value greater than zero if neither argument is NaN, and a is strictly greater than b.
61+
int __gtsf2(float a, float b) { return qfp_fcmp(a,b);}
62+
int __gtdf2(double a, double b) { return qfp_dcmp(a,b);}
63+

0 commit comments

Comments
 (0)