continued WIP: almost compiling

crypto-aes
Dan Halbert 4 years ago
parent 7c219600a2
commit 0d27f4d9a6
  1. 35
      drivers/dht/dht.py
  2. 2
      extmod/modwebrepl.c
  3. 2
      extmod/uos_dupterm.c
  4. 2
      extmod/vfs_posix.c
  5. 1
      extmod/vfs_posix.h
  6. 2
      extmod/vfs_posix_file.c
  7. 2
      py/asmarm.h
  8. 2
      py/asmthumb.h
  9. 2
      py/asmx64.h
  10. 2
      py/asmxtensa.h
  11. 1
      py/modmath.c
  12. 16
      py/mpconfig.h
  13. 2
      py/mperrno.h
  14. 2
      py/nlr.c
  15. 3
      py/nlr.h
  16. 2
      py/nlrx64.c
  17. 4
      py/nlrx86.c
  18. 2
      py/nlrxtensa.c
  19. 2
      py/obj.h
  20. 3
      py/objtype.c
  21. 4
      py/parse.c

@ -1,35 +0,0 @@
# DHT11/DHT22 driver for MicroPython on ESP8266
# MIT license; Copyright (c) 2016 Damien P. George
try:
from esp import dht_readinto
except:
from pyb import dht_readinto
class DHTBase:
def __init__(self, pin):
self.pin = pin
self.buf = bytearray(5)
def measure(self):
buf = self.buf
dht_readinto(self.pin, buf)
if (buf[0] + buf[1] + buf[2] + buf[3]) & 0xff != buf[4]:
raise Exception("checksum error")
class DHT11(DHTBase):
def humidity(self):
return self.buf[0]
def temperature(self):
return self.buf[2]
class DHT22(DHTBase):
def humidity(self):
return (self.buf[0] << 8 | self.buf[1]) * 0.1
def temperature(self):
t = ((self.buf[2] & 0x7f) << 8 | self.buf[3]) * 0.1
if self.buf[2] & 0x80:
t = -t
return t

@ -37,7 +37,7 @@
#include "extmod/modwebsocket.h"
#include "genhdr/mpversion.h"
#ifdef MICROPY_PY_WEBREPL
#if MICROPY_PY_WEBREPL
#if 0 // print debugging info
#define DEBUG_printf DEBUG_printf

@ -34,7 +34,7 @@
#include "py/stream.h"
#include "lib/utils/interrupt_char.h"
#ifdef MICROPY_PY_OS_DUPTERM
#if MICROPY_PY_OS_DUPTERM
void mp_uos_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc) {
mp_obj_t term = MP_STATE_VM(dupterm_objs[dupterm_idx]);

@ -29,7 +29,7 @@
#include "extmod/vfs.h"
#include "extmod/vfs_posix.h"
#if MICROPY_VFS_POSIX
#if defined(MICROPY_VFS_POSIX) && MICROPY_VFS_POSIX
#include <string.h>
#include <sys/stat.h>

@ -27,6 +27,7 @@
#define MICROPY_INCLUDED_EXTMOD_VFS_POSIX_H
#include "py/lexer.h"
#include "py/mpconfig.h"
#include "py/obj.h"
extern const mp_obj_type_t mp_type_vfs_posix;

@ -28,7 +28,7 @@
#include "py/stream.h"
#include "extmod/vfs_posix.h"
#if MICROPY_VFS_POSIX
#if defined(MICROPY_VFS_POSIX) && MICROPY_VFS_POSIX
#include <fcntl.h>

@ -122,7 +122,7 @@ void asm_arm_bcc_label(asm_arm_t *as, int cond, uint label);
void asm_arm_b_label(asm_arm_t *as, uint label);
void asm_arm_bl_ind(asm_arm_t *as, void *fun_ptr, uint fun_id, uint reg_temp);
#ifdef GENERIC_ASM_API
#if defined(GENERIC_ASM_API) && GENERIC_ASM_API
// The following macros provide a (mostly) arch-independent API to
// generate native code, and are used by the native emitter.

@ -238,7 +238,7 @@ void asm_thumb_b_label(asm_thumb_t *as, uint label); // convenience: picks narro
void asm_thumb_bcc_label(asm_thumb_t *as, int cc, uint label); // convenience: picks narrow or wide branch
void asm_thumb_bl_ind(asm_thumb_t *as, void *fun_ptr, uint fun_id, uint reg_temp); // convenience
#ifdef GENERIC_ASM_API
#if defined(GENERIC_ASM_API) && GENERIC_ASM_API
// The following macros provide a (mostly) arch-independent API to
// generate native code, and are used by the native emitter.

@ -114,7 +114,7 @@ void asm_x64_mov_r64_to_local(asm_x64_t* as, int src_r64, int dest_local_num);
void asm_x64_mov_local_addr_to_r64(asm_x64_t* as, int local_num, int dest_r64);
void asm_x64_call_ind(asm_x64_t* as, void* ptr, int temp_r32);
#ifdef GENERIC_ASM_API
#if defined(GENERIC_ASM_API) && GENERIC_ASM_API
// The following macros provide a (mostly) arch-independent API to
// generate native code, and are used by the native emitter.

@ -239,7 +239,7 @@ void asm_xtensa_mov_local_reg(asm_xtensa_t *as, int local_num, uint reg_src);
void asm_xtensa_mov_reg_local(asm_xtensa_t *as, uint reg_dest, int local_num);
void asm_xtensa_mov_reg_local_addr(asm_xtensa_t *as, uint reg_dest, int local_num);
#ifdef GENERIC_ASM_API
#if defined(GENERIC_ASM_API) && GENERIC_ASM_API
// The following macros provide a (mostly) arch-independent API to
// generate native code, and are used by the native emitter.

@ -26,7 +26,6 @@
#include "py/builtin.h"
#include "py/runtime.h"
#include "py/runtime.h"
#if MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_MATH

@ -1238,6 +1238,22 @@ typedef double mp_float_t;
#define MICROPY_PY_BTREE (0)
#endif
#ifndef MICROPY_PY_OS_DUPTERM
#define MICROPY_PY_OS_DUPTERM (0)
#endif
#ifndef MICROPY_PY_LWIP_SLIP
#define MICROPY_PY_LWIP_SLIP (0)
#endif
#ifndef MICROPY_HW_ENABLE_USB
#define MICROPY_HW_ENABLE_USB (0)
#endif
#ifndef MICROPY_PY_WEBREPL
#define MICROPY_PY_WEBREPL (0)
#endif
/*****************************************************************************/
/* Hooks for a port to add builtins */

@ -26,8 +26,6 @@
#ifndef MICROPY_INCLUDED_PY_MPERRNO_H
#define MICROPY_INCLUDED_PY_MPERRNO_H
#include "py/mpconfig.h"
#include "py/mpconfig.h"
#include "py/obj.h"

@ -28,7 +28,7 @@
#if !MICROPY_NLR_SETJMP
// When not using setjmp, nlr_push_tail is called from inline asm so needs special care
#if MICROPY_NLR_X86 && MICROPY_NLR_OS_WINDOWS
#if defined(MICROPY_NLR_X86) && MICROPY_NLR_X86 && defined(MICROPY_NLR_OS_WINDOWS) && MICROPY_NLR_OS_WINDOWS
// On these 32-bit platforms make sure nlr_push_tail doesn't have a leading underscore
unsigned int nlr_push_tail(nlr_buf_t *nlr) asm("nlr_push_tail");
#else

@ -35,7 +35,8 @@
#include "py/mpconfig.h"
// If MICROPY_NLR_SETJMP is not enabled then auto-detect the machine arch
#if !MICROPY_NLR_SETJMP
#if !defined(MICROPY_NLR_SETJMP) || !MICROPY_NLR_SETJMP
#define MICROPY_NLR_SETJMP (0)
// A lot of nlr-related things need different treatment on Windows
#if defined(_WIN32) || defined(__CYGWIN__)
#define MICROPY_NLR_OS_WINDOWS 1

@ -26,7 +26,7 @@
#include "py/mpstate.h"
#if MICROPY_NLR_X64
#if defined(MICROPY_NLR_X64) && MICROPY_NLR_X64
#undef nlr_push

@ -26,14 +26,14 @@
#include "py/mpstate.h"
#if MICROPY_NLR_X86
#if defined(MICROPY_NLR_X86) && MICROPY_NLR_X86
#undef nlr_push
// For reference, x86 callee save regs are:
// ebx, esi, edi, ebp, esp, eip
#if MICROPY_NLR_OS_WINDOWS
#if defined(MICROPY_NLR_OS_WINDOWS) && MICROPY_NLR_OS_WINDOWS
unsigned int nlr_push_tail(nlr_buf_t *nlr) asm("nlr_push_tail");
#else
__attribute__((used)) unsigned int nlr_push_tail(nlr_buf_t *nlr);

@ -26,7 +26,7 @@
#include "py/mpstate.h"
#if MICROPY_NLR_XTENSA
#if defined(MICROPY_NLR_XTENSA) && MICROPY_NLR_XTENSA
#undef nlr_push

@ -526,6 +526,8 @@ struct _mp_obj_type_t {
extern const mp_obj_type_t mp_type_type;
extern const mp_obj_type_t mp_type_object;
extern const mp_obj_type_t mp_type_NoneType;
extern const mp_obj_type_t mp_type_bool;
extern const mp_obj_type_t mp_type_int;
extern const mp_obj_type_t mp_type_str;
extern const mp_obj_type_t mp_type_bytes;
extern const mp_obj_type_t mp_type_bytearray;

@ -1283,7 +1283,8 @@ STATIC void super_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
attr_get_method[2] = self_in;
attr_get_method[3] = MP_OBJ_FROM_PTR(mp_obj_get_type(self_in));
dest[0] = mp_call_method_n_kw(2, 0, attr_get_method);
}
}
#endif
return;
}

@ -190,7 +190,7 @@ static const size_t FIRST_RULE_WITH_OFFSET_ABOVE_255 =
#undef DEF_RULE_NC
0;
#if USE_RULE_NAME
#if defined(USE_RULE_NAME) && USE_RULE_NAME
// Define an array of rule names corresponding to each rule
STATIC const char *const rule_name_table[] = {
#define DEF_RULE(rule, comp, kind, ...) #rule,
@ -403,7 +403,7 @@ void mp_parse_node_print(mp_parse_node_t pn, size_t indent) {
#endif
} else {
size_t n = MP_PARSE_NODE_STRUCT_NUM_NODES(pns);
#if USE_RULE_NAME
#if defined(USE_RULE_NAME) && USE_RULE_NAME
printf("%s(%u) (n=%u)\n", rule_name_table[MP_PARSE_NODE_STRUCT_KIND(pns)], (uint)MP_PARSE_NODE_STRUCT_KIND(pns), (uint)n);
#else
printf("rule(%u) (n=%u)\n", (uint)MP_PARSE_NODE_STRUCT_KIND(pns), (uint)n);

Loading…
Cancel
Save