Jelajahi Sumber

【修复】更新版本后,MDK/IAR 编译出错的问题。

Signed-off-by: armink <armink.ztl@gmail.com>
armink 7 tahun lalu
induk
melakukan
a103e2f50d
6 mengubah file dengan 9 tambahan dan 15 penghapusan
  1. 0 4
      port/file.c
  2. 0 2
      port/moduos.c
  3. 1 1
      port/modusocket.c
  4. 4 1
      port/mpconfigport.h
  5. 3 0
      port/mphalport.h
  6. 1 7
      port/mpy_main.c

+ 0 - 4
port/file.c

@@ -280,8 +280,4 @@ mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs)
 }
 MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
 
-const mp_obj_fdfile_t mp_sys_stdin_obj  = { .base = {&mp_type_textio}, .fd = STDIN_FILENO };
-const mp_obj_fdfile_t mp_sys_stdout_obj = { .base = {&mp_type_textio}, .fd = STDOUT_FILENO };
-const mp_obj_fdfile_t mp_sys_stderr_obj = { .base = {&mp_type_textio}, .fd = STDERR_FILENO };
-
 #endif // MICROPY_PY_IO

+ 0 - 2
port/moduos.c

@@ -36,8 +36,6 @@
 #include "py/objstr.h"
 #include "py/mperrno.h"
 #include "lib/timeutils/timeutils.h"
-#include "lib/oofatfs/ff.h"
-#include "lib/oofatfs/diskio.h"
 #include "extmod/misc.h"
 #include "genhdr/mpversion.h"
 #include "portmodules.h"

+ 1 - 1
port/modusocket.c

@@ -34,8 +34,8 @@
 #include <netdb.h>
 #include <sys/socket.h>
 #include <fcntl.h>
-#include <sys/select.h>
 #include <sys/time.h>
+#include <sys/select.h>
 
 #include "py/objtuple.h"
 #include "py/objlist.h"

+ 4 - 1
port/mpconfigport.h

@@ -41,6 +41,7 @@
 #define MICROPY_HEAP_SIZE (8 * 1024)
 #endif
 
+#define MP_ENDIANNESS_LITTLE        (1)
 #define MICROPY_STACK_CHECK         (1)
 #define MICROPY_PY_MICROPYTHON_STACK_USE (1)
 #define MICROPY_QSTR_BYTES_IN_HASH  (1)
@@ -244,7 +245,6 @@
 
 #if defined(__CC_ARM)
 #include <sys/types.h>
-#define __LITTLE_ENDIAN__
 #define MICROPY_NO_ALLOCA           1
 #define MP_WEAK                     RT_WEAK
 #define MP_NOINLINE
@@ -293,6 +293,9 @@ typedef long mp_off_t;
 #define MICROPY_HW_MCU_NAME   "RT-Thread"
 #define MICROPY_PY_PATH       "/libs/mpy/"
 
+#define MICROPY_BEGIN_ATOMIC_SECTION()     rt_hw_interrupt_disable()
+#define MICROPY_END_ATOMIC_SECTION(state)  rt_hw_interrupt_enable(state)
+
 #ifdef __linux__
 #define MICROPY_MIN_USE_STDOUT (1)
 #endif

+ 3 - 0
port/mphalport.h

@@ -33,6 +33,9 @@ extern void mp_hal_set_interrupt_char (int c);
 extern void mp_pin_od_write(void *machine_pin, int stat);
 extern void mp_hal_pin_open_set(void *machine_pin, int mode);
 
+#define mp_hal_quiet_timing_enter()         MICROPY_BEGIN_ATOMIC_SECTION()
+#define mp_hal_quiet_timing_exit(irq_state) MICROPY_END_ATOMIC_SECTION(irq_state)
+
 // needed for machine.I2C
 #define mp_hal_delay_us_fast(us) mp_hal_delay_us(us)
 #define mp_hal_pin_od_low(pin)   mp_pin_od_write(pin, PIN_LOW)

+ 1 - 7
port/mpy_main.c

@@ -73,7 +73,7 @@ void mpy_main(const char *filename) {
     rtt_getchar_init();
 
 #if MICROPY_PY_THREAD
-    mp_thread_init(rt_thread_self()->stack_addr, (rt_uint32_t)(stack_top - rt_thread_self()->stack_addr) / 4);
+    mp_thread_init(rt_thread_self()->stack_addr, ((rt_uint32_t)stack_top - (rt_uint32_t)rt_thread_self()->stack_addr) / 4);
 #endif
 
     mp_stack_set_top(stack_top);
@@ -169,12 +169,6 @@ void MP_WEAK __assert_func(const char *file, int line, const char *func, const c
 }
 #endif
 
-#if !MICROPY_VFS
-mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
-    mp_raise_OSError(MP_ENOENT);
-}
-#endif
-
 #include <stdarg.h>
 
 int DEBUG_printf(const char *format, ...)