From 7d8edeff4e81e89ed8833d9933effd1e2431f7f1 Mon Sep 17 00:00:00 2001 From: Josef Gajdusek Date: Tue, 26 May 2015 18:54:55 +0200 Subject: [PATCH] esp8266: Update to SDK version 1.1.0 (MIT-licensed). 1. Updated linker script, now user app appears to contain exception vector table and oesn't work (faults) without it. 2. Commened out support for GPIO pulldown, which was removed in this SDK version without clear explanation, but apparently because it was released without proper validation, and now turns out it doesn't work as expected, or there's a different function there. --- esp8266/esp8266.ld | 29 +++++++++++++++++++++++++++++ esp8266/modpybpin.c | 10 ++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/esp8266/esp8266.ld b/esp8266/esp8266.ld index 998129156f..25cb4e8bed 100644 --- a/esp8266/esp8266.ld +++ b/esp8266/esp8266.ld @@ -21,6 +21,11 @@ PHDRS } ENTRY(call_user_start) +EXTERN(_DebugExceptionVector) +EXTERN(_DoubleExceptionVector) +EXTERN(_KernelExceptionVector) +EXTERN(_NMIExceptionVector) +EXTERN(_UserExceptionVector) PROVIDE(_memmap_vecbase_reset = 0x40000000); @@ -101,6 +106,30 @@ SECTIONS { _stext = .; _text_start = ABSOLUTE(.); + *(.UserEnter.text) + . = ALIGN(16); + *(.DebugExceptionVector.text) + . = ALIGN(16); + *(.NMIExceptionVector.text) + . = ALIGN(16); + *(.KernelExceptionVector.text) + LONG(0) + LONG(0) + LONG(0) + LONG(0) + . = ALIGN(16); + *(.UserExceptionVector.text) + LONG(0) + LONG(0) + LONG(0) + LONG(0) + . = ALIGN(16); + *(.DoubleExceptionVector.text) + LONG(0) + LONG(0) + LONG(0) + LONG(0) + . = ALIGN (16); *(.entry.text) *(.init.literal) *(.init) diff --git a/esp8266/modpybpin.c b/esp8266/modpybpin.c index 8b09c7f655..a2ab985738 100644 --- a/esp8266/modpybpin.c +++ b/esp8266/modpybpin.c @@ -40,7 +40,8 @@ #define GPIO_MODE_OUTPUT (1) #define GPIO_PULL_NONE (0) #define GPIO_PULL_UP (1) -#define GPIO_PULL_DOWN (2) +// Removed in SDK 1.1.0 +//#define GPIO_PULL_DOWN (2) typedef struct _pyb_pin_obj_t { mp_obj_base_t base; @@ -91,15 +92,20 @@ STATIC mp_obj_t pyb_pin_obj_init_helper(pyb_pin_obj_t *self, mp_uint_t n_args, c // configure the GPIO as requested PIN_FUNC_SELECT(self->periph, self->func); + #if 0 + // Removed in SDK 1.1.0 if ((pull & GPIO_PULL_DOWN) == 0) { PIN_PULLDWN_DIS(self->periph); } + #endif if ((pull & GPIO_PULL_UP) == 0) { PIN_PULLUP_DIS(self->periph); } + #if 0 if ((pull & GPIO_PULL_DOWN) != 0) { PIN_PULLDWN_EN(self->periph); } + #endif if ((pull & GPIO_PULL_UP) != 0) { PIN_PULLUP_EN(self->periph); } @@ -191,7 +197,7 @@ STATIC const mp_map_elem_t pyb_pin_locals_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_OUT_PP), MP_OBJ_NEW_SMALL_INT(GPIO_MODE_OUTPUT) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PULL_NONE), MP_OBJ_NEW_SMALL_INT(GPIO_PULL_NONE) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PULL_UP), MP_OBJ_NEW_SMALL_INT(GPIO_PULL_UP) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_PULL_DOWN), MP_OBJ_NEW_SMALL_INT(GPIO_PULL_DOWN) }, + //{ MP_OBJ_NEW_QSTR(MP_QSTR_PULL_DOWN), MP_OBJ_NEW_SMALL_INT(GPIO_PULL_DOWN) }, }; STATIC MP_DEFINE_CONST_DICT(pyb_pin_locals_dict, pyb_pin_locals_dict_table);