From c38ea32810f2b8b55c1585a3022902c359f84d6e Mon Sep 17 00:00:00 2001 From: Vincenzo Frascino Date: Wed, 26 Oct 2016 10:33:26 +0100 Subject: lib/utils/pyexec: Add mp_hal_set_interrupt_char() prototype. This patch removes a compilation warning in pyexec. Signed-off-by: Vincenzo Frascino --- lib/utils/pyexec.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/utils/pyexec.c') diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index d7c257024..ed424a2f9 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -53,6 +53,8 @@ STATIC bool repl_display_debugging_info = 0; #define EXEC_FLAG_IS_REPL (4) #define EXEC_FLAG_SOURCE_IS_RAW_CODE (8) +extern void mp_hal_set_interrupt_char (int c); + // parses, compiles and executes the code in the lexer // frees the lexer before returning // EXEC_FLAG_PRINT_EOF prints 2 EOF chars: 1 after normal output, 1 after exception output -- cgit v1.2.3 From 6832cbd69d04db1703b8b17939d8cd894aea4c68 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 26 Oct 2016 13:45:03 +0300 Subject: lib/utils/pyexec: Fix compilation warning of type vs format mismatch. This happens with some compilers on some architectures, which don't define size_t as unsigned int. MicroPython's printf() dooesn't support obscure format specifiers for size_t, so the obvious choice is to explicitly cast to unsigned, to match %u used in printf(). --- lib/utils/pyexec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/utils/pyexec.c') diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index ed424a2f9..b398d7266 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -120,7 +120,9 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind, { size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes; qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes); - printf("qstr:\n n_pool=" UINT_FMT "\n n_qstr=" UINT_FMT "\n n_str_data_bytes=" UINT_FMT "\n n_total_bytes=" UINT_FMT "\n", n_pool, n_qstr, n_str_data_bytes, n_total_bytes); + printf("qstr:\n n_pool=" UINT_FMT "\n n_qstr=" UINT_FMT "\n " + "n_str_data_bytes=" UINT_FMT "\n n_total_bytes=" UINT_FMT "\n", + (unsigned)n_pool, (unsigned)n_qstr, (unsigned)n_str_data_bytes, (unsigned)n_total_bytes); } #if MICROPY_ENABLE_GC -- cgit v1.2.3 From 3cdccb9b1429bc3afd04ec3f9171b373fe939375 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 26 Oct 2016 17:53:28 +0300 Subject: zephyr: Fix mp_hal_set_interrupt_char() declaration to be compatible. With other ports. Other ports declare it in mphalport.h, it can be inline or macro. --- lib/utils/pyexec.c | 2 -- zephyr/mphalport.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/utils/pyexec.c') diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index b398d7266..61cd5a98c 100644 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -53,8 +53,6 @@ STATIC bool repl_display_debugging_info = 0; #define EXEC_FLAG_IS_REPL (4) #define EXEC_FLAG_SOURCE_IS_RAW_CODE (8) -extern void mp_hal_set_interrupt_char (int c); - // parses, compiles and executes the code in the lexer // frees the lexer before returning // EXEC_FLAG_PRINT_EOF prints 2 EOF chars: 1 after normal output, 1 after exception output diff --git a/zephyr/mphalport.h b/zephyr/mphalport.h index 594bdd6d0..a634455a8 100644 --- a/zephyr/mphalport.h +++ b/zephyr/mphalport.h @@ -1,4 +1,5 @@ #include +#include "lib/utils/interrupt_char.h" static inline mp_uint_t mp_hal_ticks_us(void) { return sys_tick_get() * sys_clock_us_per_tick; -- cgit v1.2.3