mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 04:30:24 +01:00
unix/mpconfigport: Enable natmod loading for RISC-V builds.
This commit lets the Unix port load native modules when built for both RV32 and RV64. Since RV64 doesn't have a native emitter, the new native code loading configuration settings have been used to allow such a feature. RV32 is fully supported by the native emitter framework but the emitter wasn't enabled for Unix builds (and therefore no natmod support). RV64 builds have been tested on QEMU and on a MilkV-Duo board, and whilst RV32 isn't really tested, its native code loading functionality is routinely tested both on bare-metal QEMU and on microcontroller boards. Since the code for RV64 under Unix and RV32 is essentially the same, having RV64 working is a strong indicator that RV32 will work too. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
@@ -72,6 +72,12 @@
|
||||
#if !defined(MICROPY_EMIT_ARM) && defined(__arm__) && !defined(__thumb2__)
|
||||
#define MICROPY_EMIT_ARM (1)
|
||||
#endif
|
||||
#if !defined(MICROPY_EMIT_RV32) && defined(__riscv) && __riscv_xlen == 32
|
||||
#define MICROPY_EMIT_RV32 (1)
|
||||
#endif
|
||||
#if !defined(MICROPY_PERSISTENT_CODE_LOAD_NATIVE) && defined(__riscv) && __riscv_xlen == 64
|
||||
#define MICROPY_PERSISTENT_CODE_LOAD_NATIVE (1)
|
||||
#endif
|
||||
|
||||
// Cannot include <sys/types.h>, as it may lead to symbol name clashes
|
||||
#if _FILE_OFFSET_BITS == 64 && !defined(__LP64__)
|
||||
@@ -93,7 +99,7 @@ typedef long mp_off_t;
|
||||
// Always enable GC.
|
||||
#define MICROPY_ENABLE_GC (1)
|
||||
|
||||
#if !(defined(MICROPY_GCREGS_SETJMP) || defined(__x86_64__) || defined(__i386__) || defined(__thumb2__) || defined(__thumb__) || defined(__arm__) || (defined(__riscv) && (__riscv_xlen == 64)))
|
||||
#if !(defined(MICROPY_GCREGS_SETJMP) || defined(__x86_64__) || defined(__i386__) || defined(__thumb2__) || defined(__thumb__) || defined(__arm__) || (defined(__riscv) && __riscv_xlen <= 64))
|
||||
// Fall back to setjmp() implementation for discovery of GC pointers in registers.
|
||||
#define MICROPY_GCREGS_SETJMP (1)
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user