This fixes errors like these ones:
modffi.c: In function 'return_ffi_value':
modffi.c:143:29: error: cast to pointer from integer of different size
[-Werror=int-to-pointer-cast]
const char *s = (const char *)val;
^
modffi.c:162:20: error: cast to pointer from integer of different size
[-Werror=int-to-pointer-cast]
return (mp_obj_t)val;
^
modffi.c: In function 'ffifunc_call':
modffi.c:358:25: error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
values[i] = (ffi_arg)a;
^
modffi.c:373:25: error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
values[i] = (ffi_arg)s;
^
modffi.c:381:25: error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
values[i] = (ffi_arg)bufinfo.buf;
^
modffi.c:384:25: error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
values[i] = (ffi_arg)p->func;
^
These errors can be highlighted when building micropython from MIPS64
n32 because ffi_arg is 64-bit wide and the pointers on MIPS64 n32 are
32-bit wide, so it's trying to case an integer to a pointer (or
vice-versa) of a different size. We should cast first the pointer (or the
integer) to a pointer sized integer (intptr_t) to fix that problem.
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
There is an issue sending 1 byte on the SPI bus using DMA, but it only
occurs when the transmit is done for the first time after initialising
the SPI and DMA peripherals. All other cases (sending 2 or more bytes,
doing send_recv, doing recv first) work okay. We sidestep this issue by
using polling (not DMA) for all 1 byte transfers. This is fine because
a 1 byte transfer can't be interrupted and doesn't need the benefits of
DMA (and using polling for this case is more efficient).
Resolves#1456.
When creating constant mpz's, the length of the mpz must be exactly how
many digits are used (not allocated) otherwise these numbers are not
compatible with dynamically allocated numbers.
Addresses issue #1448.