From 92f1ed8f4086dcd0eb6c39df695d0326252db7c4 Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Thu, 27 Nov 2014 17:54:37 +0000
Subject: [PATCH] stmhal: Enable uhashlib module; add heapq, hashlib weak
 links.

hashlib test passes on pyboard.
---
 stmhal/memory.h       | 2 ++
 stmhal/mpconfigport.h | 5 +++++
 stmhal/qstrdefsport.h | 2 ++
 3 files changed, 9 insertions(+)
 create mode 100644 stmhal/memory.h

diff --git a/stmhal/memory.h b/stmhal/memory.h
new file mode 100644
index 000000000..f3777b0e3
--- /dev/null
+++ b/stmhal/memory.h
@@ -0,0 +1,2 @@
+// this is needed for extmod/crypto-algorithms/sha256.c
+#include <string.h>
diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h
index 96936e46f..d730173b0 100644
--- a/stmhal/mpconfigport.h
+++ b/stmhal/mpconfigport.h
@@ -63,6 +63,7 @@
 #define MICROPY_PY_UJSON            (1)
 #define MICROPY_PY_URE              (1)
 #define MICROPY_PY_UHEAPQ           (1)
+#define MICROPY_PY_UHASHLIB         (1)
 
 #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF   (1)
 #define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE  (0)
@@ -82,6 +83,8 @@ extern const struct _mp_obj_module_t stm_module;
 extern const struct _mp_obj_module_t mp_module_ure;
 extern const struct _mp_obj_module_t mp_module_uzlib;
 extern const struct _mp_obj_module_t mp_module_ujson;
+extern const struct _mp_obj_module_t mp_module_uheapq;
+extern const struct _mp_obj_module_t mp_module_uhashlib;
 extern const struct _mp_obj_module_t mp_module_uos;
 extern const struct _mp_obj_module_t mp_module_utime;
 extern const struct _mp_obj_module_t mp_module_uselect;
@@ -101,6 +104,8 @@ extern const struct _mp_obj_module_t mp_module_network;
     { MP_OBJ_NEW_QSTR(MP_QSTR_re), (mp_obj_t)&mp_module_ure }, \
     { MP_OBJ_NEW_QSTR(MP_QSTR_zlib), (mp_obj_t)&mp_module_uzlib }, \
     { MP_OBJ_NEW_QSTR(MP_QSTR_json), (mp_obj_t)&mp_module_ujson }, \
+    { MP_OBJ_NEW_QSTR(MP_QSTR_heapq), (mp_obj_t)&mp_module_uheapq }, \
+    { MP_OBJ_NEW_QSTR(MP_QSTR_hashlib), (mp_obj_t)&mp_module_uhashlib }, \
     { MP_OBJ_NEW_QSTR(MP_QSTR_os), (mp_obj_t)&mp_module_uos }, \
     { MP_OBJ_NEW_QSTR(MP_QSTR_time), (mp_obj_t)&mp_module_utime }, \
     { MP_OBJ_NEW_QSTR(MP_QSTR_select), (mp_obj_t)&mp_module_uselect }, \
diff --git a/stmhal/qstrdefsport.h b/stmhal/qstrdefsport.h
index 19270a6f3..ce09404d3 100644
--- a/stmhal/qstrdefsport.h
+++ b/stmhal/qstrdefsport.h
@@ -76,6 +76,8 @@ Q(elapsed_micros)
 Q(re)
 Q(zlib)
 Q(json)
+Q(heapq)
+Q(hashlib)
 
 // for file class
 Q(seek)
-- 
GitLab