summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Shockley <benjaminshockley@hotmail.com>2020-08-20 13:48:15 -0500
committerGitHub <noreply@github.com>2020-08-20 13:48:15 -0500
commit0084f0af24e4e219bc040c52ee723959423de6e2 (patch)
tree1aebdb362f08bf6417caa87836e3e4e739afc964 /lib
parent9aebe2f1efc99871fcf283c304e3a8700050d736 (diff)
parent4d7b9cde33934a44c4c905a49d2f831339fc8bd2 (diff)
Merge pull request #2 from adafruit/master
Master
Diffstat (limited to 'lib')
-rw-r--r--lib/libm/ef_rem_pio2.c50
-rw-r--r--lib/libm/ef_sqrt.c14
-rw-r--r--lib/libm/erf_lgamma.c15
-rw-r--r--lib/libm/fdlibm.h20
-rw-r--r--lib/libm/kf_cos.c8
-rw-r--r--lib/libm/kf_rem_pio2.c32
-rw-r--r--lib/libm/kf_sin.c6
-rw-r--r--lib/libm/kf_tan.c8
-rw-r--r--lib/libm/log1pf.c2
-rw-r--r--lib/libm/math.c3
-rw-r--r--lib/libm/sf_cos.c2
-rw-r--r--lib/libm/sf_erf.c16
-rw-r--r--lib/libm/sf_frexp.c2
-rw-r--r--lib/libm/sf_ldexp.c2
-rw-r--r--lib/libm/sf_modf.c2
-rw-r--r--lib/libm/sf_sin.c2
-rw-r--r--lib/libm/sf_tan.c2
-rw-r--r--lib/libm/wf_lgamma.c8
-rw-r--r--lib/libm_dbl/__signbit.c2
-rw-r--r--lib/libm_dbl/pow.c12
m---------lib/lwip0
-rw-r--r--lib/memzip/README.md1
-rw-r--r--lib/memzip/lexermemzip.c1
-rwxr-xr-xlib/memzip/make-memzip.py1
-rw-r--r--lib/mp-readline/readline.c2
m---------lib/mp30
-rw-r--r--lib/oofatfs/ff.c2
-rw-r--r--lib/oofatfs/ffconf.h2
-rw-r--r--lib/oofatfs/option/ccsbcs.c1
m---------lib/protomatter0
m---------lib/stm32lib0
-rw-r--r--lib/tinytest/README1
-rw-r--r--lib/tinytest/tinytest.c1
m---------lib/tinyusb0
-rw-r--r--lib/utils/buffer_helper.c4
-rw-r--r--lib/utils/buffer_helper.h3
-rw-r--r--lib/utils/interrupt_char.c2
-rw-r--r--lib/utils/printf.c4
-rwxr-xr-xlib/utils/pyexec.c7
-rw-r--r--lib/utils/sys_stdio_mphal.c22
40 files changed, 142 insertions, 120 deletions
diff --git a/lib/libm/ef_rem_pio2.c b/lib/libm/ef_rem_pio2.c
index 601f3bac4..bbb73097d 100644
--- a/lib/libm/ef_rem_pio2.c
+++ b/lib/libm/ef_rem_pio2.c
@@ -17,22 +17,22 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*
*/
/* __ieee754_rem_pio2f(x,y)
- *
- * return the remainder of x rem pi/2 in y[0]+y[1]
+ *
+ * return the remainder of x rem pi/2 in y[0]+y[1]
* use __kernel_rem_pio2f()
*/
#include "fdlibm.h"
/*
- * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
+ * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
*/
#ifdef __STDC__
static const __int32_t two_over_pi[] = {
@@ -40,27 +40,27 @@ static const __int32_t two_over_pi[] = {
static __int32_t two_over_pi[] = {
#endif
0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC,
-0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62,
+0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62,
0x95, 0x99, 0x3C, 0x43, 0x90, 0x41, 0xFE, 0x51, 0x63,
-0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A,
+0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A,
0x42, 0x4D, 0xD2, 0xE0, 0x06, 0x49, 0x2E, 0xEA, 0x09,
-0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29,
+0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29,
0xA7, 0x3E, 0xE8, 0x82, 0x35, 0xF5, 0x2E, 0xBB, 0x44,
-0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41,
+0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41,
0x39, 0x91, 0xD6, 0x39, 0x83, 0x53, 0x39, 0xF4, 0x9C,
-0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8,
+0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8,
0x97, 0xFF, 0xDE, 0x05, 0x98, 0x0F, 0xEF, 0x2F, 0x11,
-0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF,
+0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF,
0x27, 0xCB, 0x09, 0xB7, 0x4F, 0x46, 0x3F, 0x66, 0x9E,
-0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5,
+0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5,
0xF1, 0x7B, 0x3D, 0x07, 0x39, 0xF7, 0x8A, 0x52, 0x92,
-0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08,
+0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08,
0x56, 0x03, 0x30, 0x46, 0xFC, 0x7B, 0x6B, 0xAB, 0xF0,
-0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3,
+0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3,
0x91, 0x61, 0x5E, 0xE6, 0x1B, 0x08, 0x65, 0x99, 0x85,
-0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80,
+0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80,
0x4D, 0x73, 0x27, 0x31, 0x06, 0x06, 0x15, 0x56, 0xCA,
-0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B,
+0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B,
};
/* This array is like the one in e_rem_pio2.c, but the numbers are
@@ -89,9 +89,9 @@ static __int32_t npio2_hw[] = {
*/
#ifdef __STDC__
-static const float
+static const float
#else
-static float
+static float
#endif
zero = 0.0000000000e+00, /* 0x00000000 */
half = 5.0000000000e-01, /* 0x3f000000 */
@@ -121,7 +121,7 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */
{y[0] = x; y[1] = 0; return 0;}
if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */
- if(hx>0) {
+ if(hx>0) {
z = x - pio2_1;
if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */
y[0] = z - pio2_1t;
@@ -151,27 +151,27 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
fn = (float)n;
r = t-fn*pio2_1;
w = fn*pio2_1t; /* 1st round good to 40 bit */
- if(n<32&&(__int32_t)(ix&0xffffff00)!=npio2_hw[n-1]) {
+ if(n<32&&(__int32_t)(ix&0xffffff00)!=npio2_hw[n-1]) {
y[0] = r-w; /* quick check no cancellation */
} else {
__uint32_t high;
j = ix>>23;
- y[0] = r-w;
+ y[0] = r-w;
GET_FLOAT_WORD(high,y[0]);
i = j-((high>>23)&0xff);
if(i>8) { /* 2nd iteration needed, good to 57 */
t = r;
- w = fn*pio2_2;
+ w = fn*pio2_2;
r = t-w;
- w = fn*pio2_2t-((t-r)-w);
+ w = fn*pio2_2t-((t-r)-w);
y[0] = r-w;
GET_FLOAT_WORD(high,y[0]);
i = j-((high>>23)&0xff);
if(i>25) { /* 3rd iteration need, 74 bits acc */
t = r; /* will cover all possible cases */
- w = fn*pio2_3;
+ w = fn*pio2_3;
r = t-w;
- w = fn*pio2_3t-((t-r)-w);
+ w = fn*pio2_3t-((t-r)-w);
y[0] = r-w;
}
}
@@ -180,7 +180,7 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
else return n;
}
- /*
+ /*
* all other (large) arguments
*/
if(!FLT_UWORD_IS_FINITE(ix)) {
diff --git a/lib/libm/ef_sqrt.c b/lib/libm/ef_sqrt.c
index 87484d0bf..8615dfc17 100644
--- a/lib/libm/ef_sqrt.c
+++ b/lib/libm/ef_sqrt.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -74,12 +74,12 @@ float sqrtf(float x)
r = 0x01000000L; /* r = moving bit from right to left */
while(r!=0) {
- t = s+r;
- if(t<=ix) {
- s = t+r;
- ix -= t;
- q += r;
- }
+ t = s+r;
+ if(t<=ix) {
+ s = t+r;
+ ix -= t;
+ q += r;
+ }
ix += ix;
r>>=1;
}
diff --git a/lib/libm/erf_lgamma.c b/lib/libm/erf_lgamma.c
index 877816a0c..5116e3c1b 100644
--- a/lib/libm/erf_lgamma.c
+++ b/lib/libm/erf_lgamma.c
@@ -17,20 +17,21 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*
*/
#include "fdlibm.h"
+#pragma GCC diagnostic ignored "-Wfloat-equal"
#define __ieee754_logf logf
#ifdef __STDC__
-static const float
+static const float
#else
-static float
+static float
#endif
two23= 8.3886080000e+06, /* 0x4b000000 */
half= 5.0000000000e-01, /* 0x3f000000 */
@@ -143,9 +144,9 @@ static float zero= 0.0000000000e+00;
}
switch (n) {
case 0: y = __kernel_sinf(pi*y,zero,0); break;
- case 1:
+ case 1:
case 2: y = __kernel_cosf(pi*((float)0.5-y),zero); break;
- case 3:
+ case 3:
case 4: y = __kernel_sinf(pi*(one-y),zero,0); break;
case 5:
case 6: y = -__kernel_cosf(pi*(y-(float)1.5),zero); break;
@@ -218,7 +219,7 @@ static float zero= 0.0000000000e+00;
p3 = t2+w*(t5+w*(t8+w*(t11+w*t14)));
p = z*p1-(tt-w*(p2+y*p3));
r += (tf + p); break;
- case 2:
+ case 2:
p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5)))));
p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5))));
r += (-(float)0.5*y + p1/p2);
@@ -247,7 +248,7 @@ static float zero= 0.0000000000e+00;
y = z*z;
w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6)))));
r = (x-half)*(t-one)+w;
- } else
+ } else
/* 2**58 <= x <= inf */
r = x*(__ieee754_logf(x)-one);
if(hx<0) r = nadj - r;
diff --git a/lib/libm/fdlibm.h b/lib/libm/fdlibm.h
index ace3b2da2..67bc622ea 100644
--- a/lib/libm/fdlibm.h
+++ b/lib/libm/fdlibm.h
@@ -15,7 +15,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -136,12 +136,12 @@
#define __P(p) ()
#endif
-/*
+/*
* set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
* (one may replace the following line by "#include <values.h>")
*/
-#define X_TLOSS 1.41484755040568800000e+16
+#define X_TLOSS 1.41484755040568800000e+16
/* Functions that are not documented, and are not in <math.h>. */
@@ -154,13 +154,13 @@ extern float scalbf __P((float, float));
extern float significandf __P((float));
/* ieee style elementary float functions */
-extern float __ieee754_sqrtf __P((float));
-extern float __ieee754_acosf __P((float));
-extern float __ieee754_acoshf __P((float));
-extern float __ieee754_logf __P((float));
-extern float __ieee754_atanhf __P((float));
-extern float __ieee754_asinf __P((float));
-extern float __ieee754_atan2f __P((float,float));
+extern float __ieee754_sqrtf __P((float));
+extern float __ieee754_acosf __P((float));
+extern float __ieee754_acoshf __P((float));
+extern float __ieee754_logf __P((float));
+extern float __ieee754_atanhf __P((float));
+extern float __ieee754_asinf __P((float));
+extern float __ieee754_atan2f __P((float,float));
extern float __ieee754_expf __P((float));
extern float __ieee754_coshf __P((float));
extern float __ieee754_fmodf __P((float,float));
diff --git a/lib/libm/kf_cos.c b/lib/libm/kf_cos.c
index 691f9842f..518166490 100644
--- a/lib/libm/kf_cos.c
+++ b/lib/libm/kf_cos.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -25,9 +25,9 @@
#include "fdlibm.h"
#ifdef __STDC__
-static const float
+static const float
#else
-static float
+static float
#endif
one = 1.0000000000e+00, /* 0x3f800000 */
C1 = 4.1666667908e-02, /* 0x3d2aaaab */
@@ -53,7 +53,7 @@ C6 = -1.1359647598e-11; /* 0xad47d74e */
}
z = x*x;
r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))));
- if(ix < 0x3e99999a) /* if |x| < 0.3 */
+ if(ix < 0x3e99999a) /* if |x| < 0.3 */
return one - ((float)0.5*z - (z*r - x*y));
else {
if(ix > 0x3f480000) { /* x > 0.78125 */
diff --git a/lib/libm/kf_rem_pio2.c b/lib/libm/kf_rem_pio2.c
index 3b09de5fd..62aa242bc 100644
--- a/lib/libm/kf_rem_pio2.c
+++ b/lib/libm/kf_rem_pio2.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -30,7 +30,7 @@
#ifdef __STDC__
static const int init_jk[] = {4,7,9}; /* initial value for jk */
#else
-static int init_jk[] = {4,7,9};
+static int init_jk[] = {4,7,9};
#endif
#ifdef __STDC__
@@ -52,9 +52,9 @@ static float PIo2[] = {
};
#ifdef __STDC__
-static const float
+static const float
#else
-static float
+static float
#endif
zero = 0.0,
one = 1.0,
@@ -62,9 +62,9 @@ two8 = 2.5600000000e+02, /* 0x43800000 */
twon8 = 3.9062500000e-03; /* 0x3b800000 */
#ifdef __STDC__
- int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __int32_t *ipio2)
+ int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __int32_t *ipio2)
#else
- int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2)
+ int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2)
float x[], y[]; int e0,nx,prec; __int32_t ipio2[];
#endif
{
@@ -109,7 +109,7 @@ recompute:
i = (iq[jz-1]>>(8-q0)); n += i;
iq[jz-1] -= i<<(8-q0);
ih = iq[jz-1]>>(7-q0);
- }
+ }
else if(q0==0) ih = iq[jz-1]>>8;
else if(z>=(float)0.5) ih=2;
@@ -141,7 +141,7 @@ recompute:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
if(z==zero) {
-#pragma GCC diagnostic pop
+#pragma GCC diagnostic pop
j = 0;
for (i=jz-1;i>=jk;i--) j |= iq[i];
if(j==0) { /* need recomputation */
@@ -166,7 +166,7 @@ recompute:
while(iq[jz]==0) { jz--; q0-=8;}
} else { /* break z into 8-bit if necessary */
z = scalbnf(z,-(int)q0);
- if(z>=two8) {
+ if(z>=two8) {
fw = (float)((__int32_t)(twon8*z));
iq[jz] = (__int32_t)(z-two8*fw);
jz += 1; q0 += 8;
@@ -191,29 +191,29 @@ recompute:
case 0:
fw = 0.0;
for (i=jz;i>=0;i--) fw += fq[i];
- y[0] = (ih==0)? fw: -fw;
+ y[0] = (ih==0)? fw: -fw;
break;
case 1:
case 2:
fw = 0.0;
- for (i=jz;i>=0;i--) fw += fq[i];
- y[0] = (ih==0)? fw: -fw;
+ for (i=jz;i>=0;i--) fw += fq[i];
+ y[0] = (ih==0)? fw: -fw;
fw = fq[0]-fw;
for (i=1;i<=jz;i++) fw += fq[i];
- y[1] = (ih==0)? fw: -fw;
+ y[1] = (ih==0)? fw: -fw;
break;
case 3: /* painful */
for (i=jz;i>0;i--) {
- fw = fq[i-1]+fq[i];
+ fw = fq[i-1]+fq[i];
fq[i] += fq[i-1]-fw;
fq[i-1] = fw;
}
for (i=jz;i>1;i--) {
- fw = fq[i-1]+fq[i];
+ fw = fq[i-1]+fq[i];
fq[i] += fq[i-1]-fw;
fq[i-1] = fw;
}
- for (fw=0.0,i=jz;i>=2;i--) fw += fq[i];
+ for (fw=0.0,i=jz;i>=2;i--) fw += fq[i];
if(ih==0) {
y[0] = fq[0]; y[1] = fq[1]; y[2] = fw;
} else {
diff --git a/lib/libm/kf_sin.c b/lib/libm/kf_sin.c
index 07ea99344..6ef8903ca 100644
--- a/lib/libm/kf_sin.c
+++ b/lib/libm/kf_sin.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -25,9 +25,9 @@
#include "fdlibm.h"
#ifdef __STDC__
-static const float
+static const float
#else
-static float
+static float
#endif
half = 5.0000000000e-01,/* 0x3f000000 */
S1 = -1.6666667163e-01, /* 0xbe2aaaab */
diff --git a/lib/libm/kf_tan.c b/lib/libm/kf_tan.c
index 6da9bd817..f0ff94c88 100644
--- a/lib/libm/kf_tan.c
+++ b/lib/libm/kf_tan.c
@@ -17,16 +17,16 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include "libm.h"
#ifdef __STDC__
-static const float
+static const float
#else
-static float
+static float
#endif
one = 1.0000000000e+00, /* 0x3f800000 */
pio4 = 7.8539812565e-01, /* 0x3f490fda */
@@ -87,7 +87,7 @@ T[] = {
return (float)(1-((hx>>30)&2))*(v-(float)2.0*(x-(w*w/(w+v)-r)));
}
if(iy==1) return w;
- else { /* if allow error up to 2 ulp,
+ else { /* if allow error up to 2 ulp,
simply return -1.0/(x+r) here */
/* compute -1.0/(x+r) accurately */
float a,t;
diff --git a/lib/libm/log1pf.c b/lib/libm/log1pf.c
index 0d32b0a2f..89ed250b0 100644
--- a/lib/libm/log1pf.c
+++ b/lib/libm/log1pf.c
@@ -18,6 +18,8 @@
#include "libm.h"
+#pragma GCC diagnostic ignored "-Wfloat-equal"
+
static const float
ln2_hi = 6.9313812256e-01, /* 0x3f317180 */
ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */
diff --git a/lib/libm/math.c b/lib/libm/math.c
index 39c6a68a5..0e53563bc 100644
--- a/lib/libm/math.c
+++ b/lib/libm/math.c
@@ -50,6 +50,9 @@ float copysignf(float x, float y) {
static const float _M_LN10 = 2.30258509299404; // 0x40135d8e
float log10f(float x) { return logf(x) / (float)_M_LN10; }
+#undef _M_LN2
+static const float _M_LN2 = 0.6931472;
+float log2f(float x) { return logf(x) / (float)_M_LN2; }
float tanhf(float x) {
if (isinf(x)) {
diff --git a/lib/libm/sf_cos.c b/lib/libm/sf_cos.c
index fabb129cd..0fe7c8ce6 100644
--- a/lib/libm/sf_cos.c
+++ b/lib/libm/sf_cos.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
diff --git a/lib/libm/sf_erf.c b/lib/libm/sf_erf.c
index 3f0172c6e..a6aec096f 100644
--- a/lib/libm/sf_erf.c
+++ b/lib/libm/sf_erf.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
@@ -57,7 +57,7 @@ qq3 = 5.0813062117e-03, /* 0x3ba68116 */
qq4 = 1.3249473704e-04, /* 0x390aee49 */
qq5 = -3.9602282413e-06, /* 0xb684e21a */
/*
- * Coefficients for approximation to erf in [0.84375,1.25]
+ * Coefficients for approximation to erf in [0.84375,1.25]
*/
pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */
pa1 = 4.1485610604e-01, /* 0x3ed46805 */
@@ -110,9 +110,9 @@ sb6 = 4.7452853394e+02, /* 0x43ed43a7 */
sb7 = -2.2440952301e+01; /* 0xc1b38712 */
#ifdef __STDC__
- float erff(float x)
+ float erff(float x)
#else
- float erff(x)
+ float erff(x)
float x;
#endif
{
@@ -127,7 +127,7 @@ sb7 = -2.2440952301e+01; /* 0xc1b38712 */
if(ix < 0x3f580000) { /* |x|<0.84375 */
if(ix < 0x31800000) { /* |x|<2**-28 */
- if (ix < 0x04000000)
+ if (ix < 0x04000000)
/*avoid underflow */
return (float)0.125*((float)8.0*x+efx8*x);
return x + efx*x;
@@ -167,9 +167,9 @@ sb7 = -2.2440952301e+01; /* 0xc1b38712 */
}
#ifdef __STDC__
- float erfcf(float x)
+ float erfcf(float x)
#else
- float erfcf(x)
+ float erfcf(x)
float x;
#endif
{
@@ -202,7 +202,7 @@ sb7 = -2.2440952301e+01; /* 0xc1b38712 */
P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6)))));
Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6)))));
if(hx>=0) {
- z = one-erx; return z - P/Q;
+ z = one-erx; return z - P/Q;
} else {
z = erx+P/Q; return one+z;
}
diff --git a/lib/libm/sf_frexp.c b/lib/libm/sf_frexp.c
index df50fb773..92cedb8bc 100644
--- a/lib/libm/sf_frexp.c
+++ b/lib/libm/sf_frexp.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
diff --git a/lib/libm/sf_ldexp.c b/lib/libm/sf_ldexp.c
index 75cb8b727..c177160a3 100644
--- a/lib/libm/sf_ldexp.c
+++ b/lib/libm/sf_ldexp.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
diff --git a/lib/libm/sf_modf.c b/lib/libm/sf_modf.c
index 410db2a37..8bad5d2e2 100644
--- a/lib/libm/sf_modf.c
+++ b/lib/libm/sf_modf.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
diff --git a/lib/libm/sf_sin.c b/lib/libm/sf_sin.c
index d27050778..b9d4049b3 100644
--- a/lib/libm/sf_sin.c
+++ b/lib/libm/sf_sin.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
diff --git a/lib/libm/sf_tan.c b/lib/libm/sf_tan.c
index 148b16d61..42d2df9c9 100644
--- a/lib/libm/sf_tan.c
+++ b/lib/libm/sf_tan.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
diff --git a/lib/libm/wf_lgamma.c b/lib/libm/wf_lgamma.c
index d86ede790..8a7fb822d 100644
--- a/lib/libm/wf_lgamma.c
+++ b/lib/libm/wf_lgamma.c
@@ -17,7 +17,7 @@
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
+ * software is freely granted, provided that this notice
* is preserved.
* ====================================================
*
@@ -44,7 +44,7 @@
y = __ieee754_lgammaf_r(x,&(_REENT_SIGNGAM(_REENT)));
if(_LIB_VERSION == _IEEE_) return y;
if(!finitef(y)&&finitef(x)) {
-#ifndef HUGE_VAL
+#ifndef HUGE_VAL
#define HUGE_VAL inf
double inf = 0.0;
@@ -77,11 +77,11 @@
}
if (exc.err != 0)
errno = exc.err;
- return (float)exc.retval;
+ return (float)exc.retval;
} else
return y;
#endif
-}
+}
#ifdef _DOUBLE_IS_32BITS
diff --git a/lib/libm_dbl/__signbit.c b/lib/libm_dbl/__signbit.c
index 18c6728a5..f1f1ae810 100644
--- a/lib/libm_dbl/__signbit.c
+++ b/lib/libm_dbl/__signbit.c
@@ -8,5 +8,3 @@ int __signbitd(double x)
} y = { x };
return y.i>>63;
}
-
-
diff --git a/lib/libm_dbl/pow.c b/lib/libm_dbl/pow.c
index 3ddc1b6ff..4aef8a5b3 100644
--- a/lib/libm_dbl/pow.c
+++ b/lib/libm_dbl/pow.c
@@ -125,13 +125,13 @@ double pow(double x, double y)
else if (iy >= 0x3ff00000) {
k = (iy>>20) - 0x3ff; /* exponent */
if (k > 20) {
- uint32_t j = ly>>(52-k);
- if ((j<<(52-k)) == ly)
- yisint = 2 - (j&1);
+ uint32_t j2 = ly>>(52-k);
+ if ((j2<<(52-k)) == ly)
+ yisint = 2 - (j2&1);
} else if (ly == 0) {
- uint32_t j = iy>>(20-k);
- if ((j<<(20-k)) == iy)
- yisint = 2 - (j&1);
+ uint32_t j2 = iy>>(20-k);
+ if ((j2<<(20-k)) == (uint32_t)iy)
+ yisint = 2 - (j2&1);
}
}
}
diff --git a/lib/lwip b/lib/lwip
deleted file mode 160000
-Subproject 5b8b5d459e7dd890724515bbfad86c705234f9e
diff --git a/lib/memzip/README.md b/lib/memzip/README.md
index 287d0fc48..c4e31a117 100644
--- a/lib/memzip/README.md
+++ b/lib/memzip/README.md
@@ -25,4 +25,3 @@ $(BUILD)/memzip-files.c: $(shell find ${MEMZIP_DIR} -type f)
@$(ECHO) "Creating $@"
$(Q)$(PYTHON) $(MAKE_MEMZIP) --zip-file $(BUILD)/memzip-files.zip --c-file $@ $(MEMZIP_DIR)
```
-
diff --git a/lib/memzip/lexermemzip.c b/lib/memzip/lexermemzip.c
index 6b26961bd..c1f21c1ca 100644
--- a/lib/memzip/lexermemzip.c
+++ b/lib/memzip/lexermemzip.c
@@ -16,4 +16,3 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename)
return mp_lexer_new_from_str_len(qstr_from_str(filename), (const char *)data, (mp_uint_t)len, 0);
}
-
diff --git a/lib/memzip/make-memzip.py b/lib/memzip/make-memzip.py
index 9730f5e00..dd1ac93da 100755
--- a/lib/memzip/make-memzip.py
+++ b/lib/memzip/make-memzip.py
@@ -76,4 +76,3 @@ def main():
if __name__ == "__main__":
main()
-
diff --git a/lib/mp-readline/readline.c b/lib/mp-readline/readline.c
index 9d254d8cf..0edaebbfa 100644
--- a/lib/mp-readline/readline.c
+++ b/lib/mp-readline/readline.c
@@ -206,7 +206,7 @@ int readline_process_char(int c) {
redraw_step_forward = compl_len;
}
#endif
- } else if (32 <= c && c <= 126) {
+ } else if (32 <= c ) {
// printable character
vstr_ins_char(rl.line, rl.cursor_pos, c);
// set redraw parameters
diff --git a/lib/mp3 b/lib/mp3
new file mode 160000
+Subproject c3c664bf4db6a36d11808dfcbb5dbf7cff1715b
diff --git a/lib/oofatfs/ff.c b/lib/oofatfs/ff.c
index b0984756b..e961c789d 100644
--- a/lib/oofatfs/ff.c
+++ b/lib/oofatfs/ff.c
@@ -3382,7 +3382,7 @@ FRESULT f_read (
if (!sect) ABORT(fs, FR_INT_ERR);
sect += csect;
cc = btr / SS(fs); /* When remaining bytes >= sector size, */
- if (cc) { /* Read maximum contiguous sectors directly */
+ if (cc) {/* Read maximum contiguous sectors directly */
if (csect + cc > fs->csize) { /* Clip at cluster boundary */
cc = fs->csize - csect;
}
diff --git a/lib/oofatfs/ffconf.h b/lib/oofatfs/ffconf.h
index 315101f0e..214311b4c 100644
--- a/lib/oofatfs/ffconf.h
+++ b/lib/oofatfs/ffconf.h
@@ -74,7 +74,7 @@
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
-#define _USE_FASTSEEK 0
+#define _USE_FASTSEEK 1
/* This option switches fast seek function. (0:Disable or 1:Enable) */
diff --git a/lib/oofatfs/option/ccsbcs.c b/lib/oofatfs/option/ccsbcs.c
index fdded968d..f0c7e90a5 100644
--- a/lib/oofatfs/option/ccsbcs.c
+++ b/lib/oofatfs/option/ccsbcs.c
@@ -385,4 +385,3 @@ WCHAR ff_wtoupper ( /* Returns upper converted character */
return chr;
}
-
diff --git a/lib/protomatter b/lib/protomatter
new file mode 160000
+Subproject 9f71088d2c32206c6f0495704ae0c040426d576
diff --git a/lib/stm32lib b/lib/stm32lib
deleted file mode 160000
-Subproject d2bcfda543d3b99361e44112aca929225bdcc07
diff --git a/lib/tinytest/README b/lib/tinytest/README
index 902c4a2e0..28165d8bc 100644
--- a/lib/tinytest/README
+++ b/lib/tinytest/README
@@ -15,4 +15,3 @@ You can get the latest version using Git, by pulling from
Patches are welcome. Patches that turn this from tinytest to hugetest
will not be applied. If you want a huge test framework, use CUnit.
-
diff --git a/lib/tinytest/tinytest.c b/lib/tinytest/tinytest.c
index 01772f3f8..be2ebd495 100644
--- a/lib/tinytest/tinytest.c
+++ b/lib/tinytest/tinytest.c
@@ -474,4 +474,3 @@ tinytest_set_test_skipped_(void)
if (cur_test_outcome==OK)
cur_test_outcome = SKIP;
}
-
diff --git a/lib/tinyusb b/lib/tinyusb
-Subproject 47fabe42edaae4a5da6aa0d48c664a918457875
+Subproject dc5445e2f45cb348a44fe24fc1be4bc8b5ba5ba
diff --git a/lib/utils/buffer_helper.c b/lib/utils/buffer_helper.c
index f6eb8bf1e..694952e3d 100644
--- a/lib/utils/buffer_helper.c
+++ b/lib/utils/buffer_helper.c
@@ -26,10 +26,10 @@
#include "lib/utils/buffer_helper.h"
-void normalize_buffer_bounds(int32_t* start, int32_t end, uint32_t* length) {
+void normalize_buffer_bounds(int32_t* start, int32_t end, size_t* length) {
if (end < 0) {
end += *length;
- } else if (((uint32_t) end) > *length) {
+ } else if (((size_t) end) > *length) {
end = *length;
}
if (*start < 0) {
diff --git a/lib/utils/buffer_helper.h b/lib/utils/buffer_helper.h
index 47042e7ef..7487b9df5 100644
--- a/lib/utils/buffer_helper.h
+++ b/lib/utils/buffer_helper.h
@@ -28,7 +28,8 @@
#define MICROPY_INCLUDED_LIB_UTILS_BUFFER_HELPER_H
#include <stdint.h>
+#include <string.h>
-void normalize_buffer_bounds(int32_t* start, int32_t end, uint32_t* length);
+void normalize_buffer_bounds(int32_t* start, int32_t end, size_t* length);
#endif // MICROPY_INCLUDED_LIB_UTILS_BUFFER_HELPER_H
diff --git a/lib/utils/interrupt_char.c b/lib/utils/interrupt_char.c
index 91ee5c80e..da7f70254 100644
--- a/lib/utils/interrupt_char.c
+++ b/lib/utils/interrupt_char.c
@@ -49,7 +49,7 @@ void mp_keyboard_interrupt(void) {
// Check to see if we've been CTRL-C'ed by autoreload or the user.
bool mp_hal_is_interrupted(void) {
- return MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception));
+ return MP_STATE_VM(mp_pending_exception) != NULL;
}
#endif
diff --git a/lib/utils/printf.c b/lib/utils/printf.c
index e19da2dc0..3a4cc2549 100644
--- a/lib/utils/printf.c
+++ b/lib/utils/printf.c
@@ -103,9 +103,11 @@ STATIC void strn_print_strn(void *data, const char *str, size_t len) {
strn_print_env->remain -= len;
}
-#if defined(__GNUC__) && !defined(__clang__)
+#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 9
// uClibc requires this alias to be defined, or there may be link errors
// when linkings against it statically.
+// GCC 9 gives a warning about missing attributes so it's excluded until
+// uClibc+GCC9 support is needed.
int __GI_vsnprintf(char *str, size_t size, const char *fmt, va_list ap) __attribute__((weak, alias ("vsnprintf")));
#endif
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c
index e637fe544..c8e369e79 100755
--- a/lib/utils/pyexec.c
+++ b/lib/utils/pyexec.c
@@ -89,6 +89,9 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
}
// source is a lexer, parse and compile the script
qstr source_name = lex->source_name;
+ if (input_kind == MP_PARSE_FILE_INPUT) {
+ mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
+ }
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL);
// Clear the parse tree because it has a heap pointer we don't need anymore.
@@ -128,7 +131,9 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
// at the moment, the value of SystemExit is unused
ret = pyexec_system_exit;
} else {
- mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
+ if ((mp_obj_t) nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
+ mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
+ }
ret = PYEXEC_EXCEPTION;
}
}
diff --git a/lib/utils/sys_stdio_mphal.c b/lib/utils/sys_stdio_mphal.c
index fc8a74e7d..c1607dfe8 100644
--- a/lib/utils/sys_stdio_mphal.c
+++ b/lib/utils/sys_stdio_mphal.c
@@ -53,12 +53,12 @@ STATIC const sys_stdio_obj_t stdio_buffer_obj;
#endif
void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
- sys_stdio_obj_t *self = self_in;
+ sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<io.FileIO %d>", self->fd);
}
STATIC mp_uint_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
- sys_stdio_obj_t *self = self_in;
+ sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->fd == STDIO_FD_IN) {
for (uint i = 0; i < size; i++) {
int c = mp_hal_stdin_rx_chr();
@@ -75,7 +75,7 @@ STATIC mp_uint_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *er
}
STATIC mp_uint_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
- sys_stdio_obj_t *self = self_in;
+ sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->fd == STDIO_FD_OUT || self->fd == STDIO_FD_ERR) {
mp_hal_stdout_tx_strn_cooked(buf, size);
return size;
@@ -85,6 +85,19 @@ STATIC mp_uint_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size,
}
}
+STATIC mp_uint_t stdio_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
+ sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ (void) self;
+
+ // For now, pretend we actually flush the stdio stream.
+ if (request == MP_STREAM_FLUSH) {
+ return 0;
+ } else {
+ *errcode = MP_EINVAL;
+ return MP_STREAM_ERROR;
+ }
+}
+
STATIC mp_obj_t stdio_obj___exit__(size_t n_args, const mp_obj_t *args) {
return mp_const_none;
}
@@ -110,8 +123,10 @@ STATIC const mp_rom_map_elem_t stdio_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(stdio_locals_dict, stdio_locals_dict_table);
STATIC const mp_stream_p_t stdio_obj_stream_p = {
+ MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
.read = stdio_read,
.write = stdio_write,
+ .ioctl = stdio_ioctl,
.is_text = true,
};
@@ -144,6 +159,7 @@ STATIC mp_uint_t stdio_buffer_write(mp_obj_t self_in, const void *buf, mp_uint_t
}
STATIC const mp_stream_p_t stdio_buffer_obj_stream_p = {
+ MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
.read = stdio_buffer_read,
.write = stdio_buffer_write,
.is_text = false,