Skip to content

Firmware size savings #3236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extmod/moductypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
uint val_type = GET_TYPE(arr_sz, VAL_TYPE_BITS);
arr_sz &= VALUE_MASK(VAL_TYPE_BITS);
if (index >= arr_sz) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, translate("struct: index out of range")));
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_struct);
}

if (t->len == 2) {
Expand Down
2 changes: 1 addition & 1 deletion extmod/vfs_fat_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const byte fresult_to_errno_table[20] = {

STATIC void file_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_printf(print, "<io.%s %p>", mp_obj_get_type_str(self_in), MP_OBJ_TO_PTR(self_in));
mp_printf(print, "<io.%q %p>", mp_obj_get_type_qstr(self_in), MP_OBJ_TO_PTR(self_in));
}

STATIC mp_uint_t file_obj_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
Expand Down
2 changes: 1 addition & 1 deletion extmod/vfs_posix_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ STATIC void check_fd_is_open(const mp_obj_vfs_posix_file_t *o) {
STATIC void vfs_posix_file_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_vfs_posix_file_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<io.%s %d>", mp_obj_get_type_str(self_in), self->fd);
mp_printf(print, "<io.%q %d>", mp_obj_get_type_qstr(self_in), self->fd);
}

mp_obj_t mp_vfs_posix_file_open(const mp_obj_type_t *type, mp_obj_t file_in, mp_obj_t mode_in) {
Expand Down
10 changes: 8 additions & 2 deletions lib/libm/ef_rem_pio2.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
*/
#ifdef __STDC__
static const __int32_t two_over_pi[] = {
static const __uint8_t two_over_pi[] = {
#else
static __int32_t two_over_pi[] = {
static __uint8_t two_over_pi[] = {
#endif
0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC,
0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62,
Expand Down Expand Up @@ -145,6 +145,7 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
return -1;
}
}
#if CIRCUITPY_FULL_BUILD
if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */
t = fabsf(x);
n = (__int32_t) (t*invpio2+half);
Expand Down Expand Up @@ -180,6 +181,11 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
else return n;
}
#else
// Suppress "defined but not used" diagnostics
(void) j; (void) fn; (void) r; (void) t; (void) w; (void) pio2_3t;
(void) pio2_3; (void) invpio2; (void)half; (void)npio2_hw;
#endif
/*
* all other (large) arguments
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/libm/fdlibm.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ extern float __ieee754_scalbf __P((float,float));
extern float __kernel_sinf __P((float,float,int));
extern float __kernel_cosf __P((float,float));
extern float __kernel_tanf __P((float,float,int));
extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const __int32_t*));
extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const __uint8_t*));

/* A union which permits us to convert between a float and a 32 bit
int. */
Expand Down
4 changes: 2 additions & 2 deletions lib/libm/kf_rem_pio2.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ 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 __uint8_t *ipio2)
#else
int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2)
float x[], y[]; int e0,nx,prec; __int32_t ipio2[];
float x[], y[]; int e0,nx,prec; __uint8_t ipio2[];
#endif
{
__int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
Expand Down
Loading