pic16bit: Make it build with recent XC16 versions.
The PIC16 port didn't catch up with the other ports, so it required a bit of work to make it build with the latest version of XC16. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
parent
548babf8a0
commit
d34b15ac6f
@ -7,7 +7,7 @@ QSTR_DEFS = qstrdefsport.h
|
||||
include $(TOP)/py/py.mk
|
||||
include $(TOP)/extmod/extmod.mk
|
||||
|
||||
XCVERSION ?= 1.35
|
||||
XCVERSION ?= 2.10
|
||||
XC16 ?= /opt/microchip/xc16/v$(XCVERSION)
|
||||
CROSS_COMPILE ?= $(XC16)/bin/xc16-
|
||||
|
||||
@ -31,7 +31,7 @@ CFLAGS += -O1 -DNDEBUG
|
||||
endif
|
||||
|
||||
LDFLAGS += --heap=0 -nostdlib -T $(XC16)/support/$(PARTFAMILY)/gld/p$(PART).gld -Map=$@.map --cref -p$(PART)
|
||||
LIBS += -L$(XC16)/lib -L$(XC16)/lib/$(PARTFAMILY) -lc -lm -lpic30
|
||||
LIBS += -L$(XC16)/lib -L$(XC16)/lib/$(PARTFAMILY) -lc99-elf -lm-elf -lc99-pic30-elf
|
||||
|
||||
SRC_C = \
|
||||
main.c \
|
||||
|
@ -93,7 +93,3 @@ typedef int mp_off_t;
|
||||
#define MICROPY_MPHALPORT_H "pic16bit_mphal.h"
|
||||
#define MICROPY_HW_BOARD_NAME "dsPICSK"
|
||||
#define MICROPY_HW_MCU_NAME "dsPIC33"
|
||||
|
||||
// XC16 toolchain doesn't seem to define these
|
||||
typedef int intptr_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
|
13
py/misc.h
13
py/misc.h
@ -380,6 +380,18 @@ static inline bool mp_check(bool value) {
|
||||
|
||||
// mp_int_t can be larger than long, i.e. Windows 64-bit, nan-box variants
|
||||
static inline uint32_t mp_clz_mpi(mp_int_t x) {
|
||||
#ifdef __XC16__
|
||||
mp_uint_t mask = MP_OBJ_WORD_MSBIT_HIGH;
|
||||
mp_uint_t zeroes = 0;
|
||||
while (mask != 0) {
|
||||
if (mask & (mp_uint_t)x) {
|
||||
break;
|
||||
}
|
||||
zeroes++;
|
||||
mask >>= 1;
|
||||
}
|
||||
return zeroes;
|
||||
#else
|
||||
MP_STATIC_ASSERT(sizeof(mp_int_t) == sizeof(long long)
|
||||
|| sizeof(mp_int_t) == sizeof(long));
|
||||
|
||||
@ -389,6 +401,7 @@ static inline uint32_t mp_clz_mpi(mp_int_t x) {
|
||||
} else {
|
||||
return mp_clzll((unsigned long long)x);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // MICROPY_INCLUDED_PY_MISC_H
|
||||
|
Loading…
Reference in New Issue
Block a user