Skip to content

Commit d8cc479

Browse files
authored
Merge pull request #3236 from jepler/firmware-size-gemma-trinket
Firmware size savings
2 parents 16170d4 + 93b373d commit d8cc479

File tree

31 files changed

+188
-223
lines changed

31 files changed

+188
-223
lines changed

extmod/moductypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
520520
uint val_type = GET_TYPE(arr_sz, VAL_TYPE_BITS);
521521
arr_sz &= VALUE_MASK(VAL_TYPE_BITS);
522522
if (index >= arr_sz) {
523-
nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, translate("struct: index out of range")));
523+
mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_struct);
524524
}
525525

526526
if (t->len == 2) {

extmod/vfs_fat_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const byte fresult_to_errno_table[20] = {
4242

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

4848
STATIC mp_uint_t file_obj_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {

extmod/vfs_posix_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ STATIC void check_fd_is_open(const mp_obj_vfs_posix_file_t *o) {
3434
STATIC void vfs_posix_file_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
3535
(void)kind;
3636
mp_obj_vfs_posix_file_t *self = MP_OBJ_TO_PTR(self_in);
37-
mp_printf(print, "<io.%s %d>", mp_obj_get_type_str(self_in), self->fd);
37+
mp_printf(print, "<io.%q %d>", mp_obj_get_type_qstr(self_in), self->fd);
3838
}
3939

4040
mp_obj_t mp_vfs_posix_file_open(const mp_obj_type_t *type, mp_obj_t file_in, mp_obj_t mode_in) {

lib/libm/ef_rem_pio2.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
3636
*/
3737
#ifdef __STDC__
38-
static const __int32_t two_over_pi[] = {
38+
static const __uint8_t two_over_pi[] = {
3939
#else
40-
static __int32_t two_over_pi[] = {
40+
static __uint8_t two_over_pi[] = {
4141
#endif
4242
0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC,
4343
0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62,
@@ -145,6 +145,7 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
145145
return -1;
146146
}
147147
}
148+
#if CIRCUITPY_FULL_BUILD
148149
if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */
149150
t = fabsf(x);
150151
n = (__int32_t) (t*invpio2+half);
@@ -180,6 +181,11 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
180181
if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
181182
else return n;
182183
}
184+
#else
185+
// Suppress "defined but not used" diagnostics
186+
(void) j; (void) fn; (void) r; (void) t; (void) w; (void) pio2_3t;
187+
(void) pio2_3; (void) invpio2; (void)half; (void)npio2_hw;
188+
#endif
183189
/*
184190
* all other (large) arguments
185191
*/

lib/libm/fdlibm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ extern float __ieee754_scalbf __P((float,float));
188188
extern float __kernel_sinf __P((float,float,int));
189189
extern float __kernel_cosf __P((float,float));
190190
extern float __kernel_tanf __P((float,float,int));
191-
extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const __int32_t*));
191+
extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const __uint8_t*));
192192

193193
/* A union which permits us to convert between a float and a 32 bit
194194
int. */

lib/libm/kf_rem_pio2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ two8 = 2.5600000000e+02, /* 0x43800000 */
6262
twon8 = 3.9062500000e-03; /* 0x3b800000 */
6363

6464
#ifdef __STDC__
65-
int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __int32_t *ipio2)
65+
int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __uint8_t *ipio2)
6666
#else
6767
int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2)
68-
float x[], y[]; int e0,nx,prec; __int32_t ipio2[];
68+
float x[], y[]; int e0,nx,prec; __uint8_t ipio2[];
6969
#endif
7070
{
7171
__int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;

0 commit comments

Comments
 (0)