From 0d27f4d9a66dcb47b545e715d1833094b0c7b484 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 12 Jul 2018 14:13:51 -0400 Subject: continued WIP: almost compiling --- py/asmarm.h | 2 +- py/asmthumb.h | 2 +- py/asmx64.h | 2 +- py/asmxtensa.h | 2 +- py/modmath.c | 1 - py/mpconfig.h | 16 ++++++++++++++++ py/mperrno.h | 2 -- py/nlr.c | 2 +- py/nlr.h | 3 ++- py/nlrx64.c | 2 +- py/nlrx86.c | 4 ++-- py/nlrxtensa.c | 2 +- py/obj.h | 2 ++ py/objtype.c | 3 ++- py/parse.c | 4 ++-- 15 files changed, 33 insertions(+), 16 deletions(-) (limited to 'py') diff --git a/py/asmarm.h b/py/asmarm.h index fbfe09aac..560303091 100644 --- a/py/asmarm.h +++ b/py/asmarm.h @@ -122,7 +122,7 @@ void asm_arm_bcc_label(asm_arm_t *as, int cond, uint label); void asm_arm_b_label(asm_arm_t *as, uint label); void asm_arm_bl_ind(asm_arm_t *as, void *fun_ptr, uint fun_id, uint reg_temp); -#ifdef GENERIC_ASM_API +#if defined(GENERIC_ASM_API) && GENERIC_ASM_API // The following macros provide a (mostly) arch-independent API to // generate native code, and are used by the native emitter. diff --git a/py/asmthumb.h b/py/asmthumb.h index f8665f35c..b7e2acc04 100644 --- a/py/asmthumb.h +++ b/py/asmthumb.h @@ -238,7 +238,7 @@ void asm_thumb_b_label(asm_thumb_t *as, uint label); // convenience: picks narro void asm_thumb_bcc_label(asm_thumb_t *as, int cc, uint label); // convenience: picks narrow or wide branch void asm_thumb_bl_ind(asm_thumb_t *as, void *fun_ptr, uint fun_id, uint reg_temp); // convenience -#ifdef GENERIC_ASM_API +#if defined(GENERIC_ASM_API) && GENERIC_ASM_API // The following macros provide a (mostly) arch-independent API to // generate native code, and are used by the native emitter. diff --git a/py/asmx64.h b/py/asmx64.h index 9ed2a6cf9..ed0b785fb 100644 --- a/py/asmx64.h +++ b/py/asmx64.h @@ -114,7 +114,7 @@ void asm_x64_mov_r64_to_local(asm_x64_t* as, int src_r64, int dest_local_num); void asm_x64_mov_local_addr_to_r64(asm_x64_t* as, int local_num, int dest_r64); void asm_x64_call_ind(asm_x64_t* as, void* ptr, int temp_r32); -#ifdef GENERIC_ASM_API +#if defined(GENERIC_ASM_API) && GENERIC_ASM_API // The following macros provide a (mostly) arch-independent API to // generate native code, and are used by the native emitter. diff --git a/py/asmxtensa.h b/py/asmxtensa.h index 13d3e8234..ef80f700a 100644 --- a/py/asmxtensa.h +++ b/py/asmxtensa.h @@ -239,7 +239,7 @@ void asm_xtensa_mov_local_reg(asm_xtensa_t *as, int local_num, uint reg_src); void asm_xtensa_mov_reg_local(asm_xtensa_t *as, uint reg_dest, int local_num); void asm_xtensa_mov_reg_local_addr(asm_xtensa_t *as, uint reg_dest, int local_num); -#ifdef GENERIC_ASM_API +#if defined(GENERIC_ASM_API) && GENERIC_ASM_API // The following macros provide a (mostly) arch-independent API to // generate native code, and are used by the native emitter. diff --git a/py/modmath.c b/py/modmath.c index 56ceb14bd..4fa36d304 100644 --- a/py/modmath.c +++ b/py/modmath.c @@ -26,7 +26,6 @@ #include "py/builtin.h" #include "py/runtime.h" -#include "py/runtime.h" #if MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_MATH diff --git a/py/mpconfig.h b/py/mpconfig.h index 52a7c05a2..d80730809 100755 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1238,6 +1238,22 @@ typedef double mp_float_t; #define MICROPY_PY_BTREE (0) #endif +#ifndef MICROPY_PY_OS_DUPTERM +#define MICROPY_PY_OS_DUPTERM (0) +#endif + +#ifndef MICROPY_PY_LWIP_SLIP +#define MICROPY_PY_LWIP_SLIP (0) +#endif + +#ifndef MICROPY_HW_ENABLE_USB +#define MICROPY_HW_ENABLE_USB (0) +#endif + +#ifndef MICROPY_PY_WEBREPL +#define MICROPY_PY_WEBREPL (0) +#endif + /*****************************************************************************/ /* Hooks for a port to add builtins */ diff --git a/py/mperrno.h b/py/mperrno.h index 1eb342bc3..f7dad4c54 100644 --- a/py/mperrno.h +++ b/py/mperrno.h @@ -26,8 +26,6 @@ #ifndef MICROPY_INCLUDED_PY_MPERRNO_H #define MICROPY_INCLUDED_PY_MPERRNO_H -#include "py/mpconfig.h" - #include "py/mpconfig.h" #include "py/obj.h" diff --git a/py/nlr.c b/py/nlr.c index 03d01577e..1bfd9c19b 100644 --- a/py/nlr.c +++ b/py/nlr.c @@ -28,7 +28,7 @@ #if !MICROPY_NLR_SETJMP // When not using setjmp, nlr_push_tail is called from inline asm so needs special care -#if MICROPY_NLR_X86 && MICROPY_NLR_OS_WINDOWS +#if defined(MICROPY_NLR_X86) && MICROPY_NLR_X86 && defined(MICROPY_NLR_OS_WINDOWS) && MICROPY_NLR_OS_WINDOWS // On these 32-bit platforms make sure nlr_push_tail doesn't have a leading underscore unsigned int nlr_push_tail(nlr_buf_t *nlr) asm("nlr_push_tail"); #else diff --git a/py/nlr.h b/py/nlr.h index 90595a12d..802f5f39a 100644 --- a/py/nlr.h +++ b/py/nlr.h @@ -35,7 +35,8 @@ #include "py/mpconfig.h" // If MICROPY_NLR_SETJMP is not enabled then auto-detect the machine arch -#if !MICROPY_NLR_SETJMP +#if !defined(MICROPY_NLR_SETJMP) || !MICROPY_NLR_SETJMP +#define MICROPY_NLR_SETJMP (0) // A lot of nlr-related things need different treatment on Windows #if defined(_WIN32) || defined(__CYGWIN__) #define MICROPY_NLR_OS_WINDOWS 1 diff --git a/py/nlrx64.c b/py/nlrx64.c index a3a1cf341..9b2b22c22 100644 --- a/py/nlrx64.c +++ b/py/nlrx64.c @@ -26,7 +26,7 @@ #include "py/mpstate.h" -#if MICROPY_NLR_X64 +#if defined(MICROPY_NLR_X64) && MICROPY_NLR_X64 #undef nlr_push diff --git a/py/nlrx86.c b/py/nlrx86.c index 59b97d8ee..4900a4c0d 100644 --- a/py/nlrx86.c +++ b/py/nlrx86.c @@ -26,14 +26,14 @@ #include "py/mpstate.h" -#if MICROPY_NLR_X86 +#if defined(MICROPY_NLR_X86) && MICROPY_NLR_X86 #undef nlr_push // For reference, x86 callee save regs are: // ebx, esi, edi, ebp, esp, eip -#if MICROPY_NLR_OS_WINDOWS +#if defined(MICROPY_NLR_OS_WINDOWS) && MICROPY_NLR_OS_WINDOWS unsigned int nlr_push_tail(nlr_buf_t *nlr) asm("nlr_push_tail"); #else __attribute__((used)) unsigned int nlr_push_tail(nlr_buf_t *nlr); diff --git a/py/nlrxtensa.c b/py/nlrxtensa.c index cd3dee364..d66c7a9a7 100644 --- a/py/nlrxtensa.c +++ b/py/nlrxtensa.c @@ -26,7 +26,7 @@ #include "py/mpstate.h" -#if MICROPY_NLR_XTENSA +#if defined(MICROPY_NLR_XTENSA) && MICROPY_NLR_XTENSA #undef nlr_push diff --git a/py/obj.h b/py/obj.h index 42c88ef67..040c8630d 100644 --- a/py/obj.h +++ b/py/obj.h @@ -526,6 +526,8 @@ struct _mp_obj_type_t { extern const mp_obj_type_t mp_type_type; extern const mp_obj_type_t mp_type_object; extern const mp_obj_type_t mp_type_NoneType; +extern const mp_obj_type_t mp_type_bool; +extern const mp_obj_type_t mp_type_int; extern const mp_obj_type_t mp_type_str; extern const mp_obj_type_t mp_type_bytes; extern const mp_obj_type_t mp_type_bytearray; diff --git a/py/objtype.c b/py/objtype.c index dc9724e5b..7244abd9e 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -1283,7 +1283,8 @@ STATIC void super_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { attr_get_method[2] = self_in; attr_get_method[3] = MP_OBJ_FROM_PTR(mp_obj_get_type(self_in)); dest[0] = mp_call_method_n_kw(2, 0, attr_get_method); - } + } + #endif return; } diff --git a/py/parse.c b/py/parse.c index ab162710d..f915f7598 100644 --- a/py/parse.c +++ b/py/parse.c @@ -190,7 +190,7 @@ static const size_t FIRST_RULE_WITH_OFFSET_ABOVE_255 = #undef DEF_RULE_NC 0; -#if USE_RULE_NAME +#if defined(USE_RULE_NAME) && USE_RULE_NAME // Define an array of rule names corresponding to each rule STATIC const char *const rule_name_table[] = { #define DEF_RULE(rule, comp, kind, ...) #rule, @@ -403,7 +403,7 @@ void mp_parse_node_print(mp_parse_node_t pn, size_t indent) { #endif } else { size_t n = MP_PARSE_NODE_STRUCT_NUM_NODES(pns); - #if USE_RULE_NAME + #if defined(USE_RULE_NAME) && USE_RULE_NAME printf("%s(%u) (n=%u)\n", rule_name_table[MP_PARSE_NODE_STRUCT_KIND(pns)], (uint)MP_PARSE_NODE_STRUCT_KIND(pns), (uint)n); #else printf("rule(%u) (n=%u)\n", (uint)MP_PARSE_NODE_STRUCT_KIND(pns), (uint)n); -- cgit v1.2.3