File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ QSTR_DEFS = qstrdefsport.h
77include $(TOP ) /py/py.mk
88include $(TOP ) /extmod/extmod.mk
99
10- XCVERSION ?= 1.35
10+ XCVERSION ?= 2.10
1111XC16 ?= /opt/microchip/xc16/v$(XCVERSION )
1212CROSS_COMPILE ?= $(XC16 ) /bin/xc16-
1313
@@ -31,7 +31,7 @@ CFLAGS += -O1 -DNDEBUG
3131endif
3232
3333LDFLAGS += --heap=0 -nostdlib -T $(XC16 ) /support/$(PARTFAMILY ) /gld/p$(PART ) .gld -Map=$@ .map --cref -p$(PART )
34- LIBS += -L$(XC16 ) /lib -L$(XC16 ) /lib/$(PARTFAMILY ) -lc -lm -lpic30
34+ LIBS += -L$(XC16 ) /lib -L$(XC16 ) /lib/$(PARTFAMILY ) -lc99-elf -lm-elf -lc99-pic30-elf
3535
3636SRC_C = \
3737 main.c \
Original file line number Diff line number Diff line change @@ -93,7 +93,3 @@ typedef int mp_off_t;
9393#define MICROPY_MPHALPORT_H "pic16bit_mphal.h"
9494#define MICROPY_HW_BOARD_NAME "dsPICSK"
9595#define MICROPY_HW_MCU_NAME "dsPIC33"
96-
97- // XC16 toolchain doesn't seem to define these
98- typedef int intptr_t ;
99- typedef unsigned int uintptr_t ;
Original file line number Diff line number Diff line change @@ -380,6 +380,18 @@ static inline bool mp_check(bool value) {
380380
381381// mp_int_t can be larger than long, i.e. Windows 64-bit, nan-box variants
382382static inline uint32_t mp_clz_mpi (mp_int_t x ) {
383+ #ifdef __XC16__
384+ mp_uint_t mask = MP_OBJ_WORD_MSBIT_HIGH ;
385+ mp_uint_t zeroes = 0 ;
386+ while (mask != 0 ) {
387+ if (mask & (mp_uint_t )x ) {
388+ break ;
389+ }
390+ zeroes ++ ;
391+ mask >>= 1 ;
392+ }
393+ return zeroes ;
394+ #else
383395 MP_STATIC_ASSERT (sizeof (mp_int_t ) == sizeof (long long )
384396 || sizeof (mp_int_t ) == sizeof (long ));
385397
@@ -389,6 +401,7 @@ static inline uint32_t mp_clz_mpi(mp_int_t x) {
389401 } else {
390402 return mp_clzll ((unsigned long long )x );
391403 }
404+ #endif
392405}
393406
394407#endif // MICROPY_INCLUDED_PY_MISC_H
You can’t perform that action at this time.
0 commit comments