From 4d9dd26818547e252768d62bf3e319c6f1ca7b7f Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Mon, 14 Jul 2014 22:19:27 -0700 Subject: [PATCH] Fix teensy to build on latest tree. Put #include of mpconfig.h before misc.h Replace uses of ARRAY_SIZE with MP_ARRAY_SIZE --- teensy/import.c | 2 +- teensy/led.c | 2 +- teensy/lexermemzip.c | 2 +- teensy/main.c | 2 +- teensy/memzip.c | 1 + teensy/mk20dx256-prefix.c | 2 +- teensy/modpyb.c | 6 +++--- teensy/mpconfigport.h | 1 + teensy/uart.c | 6 +++--- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/teensy/import.c b/teensy/import.c index 967de102ac..5332ebe599 100644 --- a/teensy/import.c +++ b/teensy/import.c @@ -1,8 +1,8 @@ #include #include -#include "misc.h" #include "mpconfig.h" +#include "misc.h" #include "qstr.h" #include "lexer.h" diff --git a/teensy/led.c b/teensy/led.c index 999ca98071..2f6e8d6301 100644 --- a/teensy/led.c +++ b/teensy/led.c @@ -31,7 +31,7 @@ STATIC const pyb_led_obj_t pyb_led_obj[] = { #endif #endif }; -#define NUM_LEDS ARRAY_SIZE(pyb_led_obj) +#define NUM_LEDS MP_ARRAY_SIZE(pyb_led_obj) void led_init(void) { /* GPIO structure */ diff --git a/teensy/lexermemzip.c b/teensy/lexermemzip.c index b74d2ebee3..4c363cd6dc 100644 --- a/teensy/lexermemzip.c +++ b/teensy/lexermemzip.c @@ -1,8 +1,8 @@ #include #include -#include "misc.h" #include "mpconfig.h" +#include "misc.h" #include "qstr.h" #include "lexer.h" #include "memzip.h" diff --git a/teensy/main.c b/teensy/main.c index 5e7918cdc6..f15b3dedd0 100644 --- a/teensy/main.c +++ b/teensy/main.c @@ -3,8 +3,8 @@ #include #include -#include "misc.h" #include "mpconfig.h" +#include "misc.h" #include "qstr.h" #include "nlr.h" #include "lexer.h" diff --git a/teensy/memzip.c b/teensy/memzip.c index b269c472a1..7934bea6b2 100644 --- a/teensy/memzip.c +++ b/teensy/memzip.c @@ -1,6 +1,7 @@ #include #include #include +#include "mpconfigport.h" #include "misc.h" #include "memzip.h" diff --git a/teensy/mk20dx256-prefix.c b/teensy/mk20dx256-prefix.c index ea9eec74a2..2485dc01ab 100644 --- a/teensy/mk20dx256-prefix.c +++ b/teensy/mk20dx256-prefix.c @@ -6,8 +6,8 @@ #include "teensy_hal.h" -#include "misc.h" #include "mpconfig.h" +#include "misc.h" #include "qstr.h" #include "obj.h" #include "pin.h" diff --git a/teensy/modpyb.c b/teensy/modpyb.c index 435b198d0b..64b9bda2d9 100644 --- a/teensy/modpyb.c +++ b/teensy/modpyb.c @@ -29,8 +29,8 @@ #include #include "Arduino.h" -#include "misc.h" #include "mpconfig.h" +#include "misc.h" #include "teensy_hal.h" @@ -328,8 +328,8 @@ STATIC const mp_obj_dict_t pyb_module_globals = { .map = { .all_keys_are_qstrs = 1, .table_is_fixed_array = 1, - .used = ARRAY_SIZE(pyb_module_globals_table), - .alloc = ARRAY_SIZE(pyb_module_globals_table), + .used = MP_ARRAY_SIZE(pyb_module_globals_table), + .alloc = MP_ARRAY_SIZE(pyb_module_globals_table), .table = (mp_map_elem_t*)pyb_module_globals_table, }, }; diff --git a/teensy/mpconfigport.h b/teensy/mpconfigport.h index 108b230dfd..56bd25c61a 100644 --- a/teensy/mpconfigport.h +++ b/teensy/mpconfigport.h @@ -65,6 +65,7 @@ typedef const void *machine_const_ptr_t; // must be of pointer size // The following would be from a board specific file, if one existed #define MICROPY_HW_BOARD_NAME "Teensy-3.1" +#define MICROPY_HW_MCU_NAME "MK20DX256" #define MICROPY_HW_HAS_SWITCH (0) #define MICROPY_HW_HAS_SDCARD (0) diff --git a/teensy/uart.c b/teensy/uart.c index e3a35153bc..48149c795d 100644 --- a/teensy/uart.c +++ b/teensy/uart.c @@ -290,7 +290,7 @@ STATIC const mp_arg_t pyb_uart_init_args[] = { { MP_QSTR_stop, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, { MP_QSTR_parity, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, }; -#define PYB_UART_INIT_NUM_ARGS ARRAY_SIZE(pyb_uart_init_args) +#define PYB_UART_INIT_NUM_ARGS MP_ARRAY_SIZE(pyb_uart_init_args) STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { // parse args @@ -419,7 +419,7 @@ STATIC const mp_arg_t pyb_uart_send_args[] = { { MP_QSTR_send, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 5000} }, }; -#define PYB_UART_SEND_NUM_ARGS ARRAY_SIZE(pyb_uart_send_args) +#define PYB_UART_SEND_NUM_ARGS MP_ARRAY_SIZE(pyb_uart_send_args) STATIC mp_obj_t pyb_uart_send(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { // TODO assumes transmission size is 8-bits wide @@ -465,7 +465,7 @@ STATIC const mp_arg_t pyb_uart_recv_args[] = { { MP_QSTR_recv, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 5000} }, }; -#define PYB_UART_RECV_NUM_ARGS ARRAY_SIZE(pyb_uart_recv_args) +#define PYB_UART_RECV_NUM_ARGS MP_ARRAY_SIZE(pyb_uart_recv_args) STATIC mp_obj_t pyb_uart_recv(uint n_args, const mp_obj_t *args, mp_map_t *kw_args) { // TODO assumes transmission size is 8-bits wide