Skip to content

Commit a103e2f

Browse files
committed
【修复】更新版本后,MDK/IAR 编译出错的问题。
Signed-off-by: armink <[email protected]>
1 parent 8212c07 commit a103e2f

File tree

6 files changed

+9
-15
lines changed

6 files changed

+9
-15
lines changed

port/file.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,4 @@ mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs)
280280
}
281281
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
282282

283-
const mp_obj_fdfile_t mp_sys_stdin_obj = { .base = {&mp_type_textio}, .fd = STDIN_FILENO };
284-
const mp_obj_fdfile_t mp_sys_stdout_obj = { .base = {&mp_type_textio}, .fd = STDOUT_FILENO };
285-
const mp_obj_fdfile_t mp_sys_stderr_obj = { .base = {&mp_type_textio}, .fd = STDERR_FILENO };
286-
287283
#endif // MICROPY_PY_IO

port/moduos.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
#include "py/objstr.h"
3737
#include "py/mperrno.h"
3838
#include "lib/timeutils/timeutils.h"
39-
#include "lib/oofatfs/ff.h"
40-
#include "lib/oofatfs/diskio.h"
4139
#include "extmod/misc.h"
4240
#include "genhdr/mpversion.h"
4341
#include "portmodules.h"

port/modusocket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
#include <netdb.h>
3535
#include <sys/socket.h>
3636
#include <fcntl.h>
37-
#include <sys/select.h>
3837
#include <sys/time.h>
38+
#include <sys/select.h>
3939

4040
#include "py/objtuple.h"
4141
#include "py/objlist.h"

port/mpconfigport.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define MICROPY_HEAP_SIZE (8 * 1024)
4242
#endif
4343

44+
#define MP_ENDIANNESS_LITTLE (1)
4445
#define MICROPY_STACK_CHECK (1)
4546
#define MICROPY_PY_MICROPYTHON_STACK_USE (1)
4647
#define MICROPY_QSTR_BYTES_IN_HASH (1)
@@ -244,7 +245,6 @@
244245

245246
#if defined(__CC_ARM)
246247
#include <sys/types.h>
247-
#define __LITTLE_ENDIAN__
248248
#define MICROPY_NO_ALLOCA 1
249249
#define MP_WEAK RT_WEAK
250250
#define MP_NOINLINE
@@ -293,6 +293,9 @@ typedef long mp_off_t;
293293
#define MICROPY_HW_MCU_NAME "RT-Thread"
294294
#define MICROPY_PY_PATH "/libs/mpy/"
295295

296+
#define MICROPY_BEGIN_ATOMIC_SECTION() rt_hw_interrupt_disable()
297+
#define MICROPY_END_ATOMIC_SECTION(state) rt_hw_interrupt_enable(state)
298+
296299
#ifdef __linux__
297300
#define MICROPY_MIN_USE_STDOUT (1)
298301
#endif

port/mphalport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ extern void mp_hal_set_interrupt_char (int c);
3333
extern void mp_pin_od_write(void *machine_pin, int stat);
3434
extern void mp_hal_pin_open_set(void *machine_pin, int mode);
3535

36+
#define mp_hal_quiet_timing_enter() MICROPY_BEGIN_ATOMIC_SECTION()
37+
#define mp_hal_quiet_timing_exit(irq_state) MICROPY_END_ATOMIC_SECTION(irq_state)
38+
3639
// needed for machine.I2C
3740
#define mp_hal_delay_us_fast(us) mp_hal_delay_us(us)
3841
#define mp_hal_pin_od_low(pin) mp_pin_od_write(pin, PIN_LOW)

port/mpy_main.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void mpy_main(const char *filename) {
7373
rtt_getchar_init();
7474

7575
#if MICROPY_PY_THREAD
76-
mp_thread_init(rt_thread_self()->stack_addr, (rt_uint32_t)(stack_top - rt_thread_self()->stack_addr) / 4);
76+
mp_thread_init(rt_thread_self()->stack_addr, ((rt_uint32_t)stack_top - (rt_uint32_t)rt_thread_self()->stack_addr) / 4);
7777
#endif
7878

7979
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
169169
}
170170
#endif
171171

172-
#if !MICROPY_VFS
173-
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
174-
mp_raise_OSError(MP_ENOENT);
175-
}
176-
#endif
177-
178172
#include <stdarg.h>
179173

180174
int DEBUG_printf(const char *format, ...)

0 commit comments

Comments
 (0)