1. 29 Jul, 2015 1 commit
  2. 27 Jul, 2015 1 commit
  3. 26 Jul, 2015 1 commit
  4. 24 May, 2015 1 commit
  5. 04 May, 2015 1 commit
  6. 16 Apr, 2015 1 commit
    • Damien George's avatar
      py: Overhaul and simplify printf/pfenv mechanism. · 7f9d1d6a
      Damien George authored
      Previous to this patch the printing mechanism was a bit of a tangled
      mess.  This patch attempts to consolidate printing into one interface.
      
      All (non-debug) printing now uses the mp_print* family of functions,
      mainly mp_printf.  All these functions take an mp_print_t structure as
      their first argument, and this structure defines the printing backend
      through the "print_strn" function of said structure.
      
      Printing from the uPy core can reach the platform-defined print code via
      two paths: either through mp_sys_stdout_obj (defined pert port) in
      conjunction with mp_stream_write; or through the mp_plat_print structure
      which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
      on the platform.  The former is only used when MICROPY_PY_IO is defined.
      
      With this new scheme printing is generally more efficient (less layers
      to go through, less arguments to pass), and, given an mp_print_t*
      structure, one can call mp_print_str for efficiency instead of
      mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
      Thumb2 archs.
      7f9d1d6a
  7. 04 Apr, 2015 2 commits
  8. 20 Mar, 2015 2 commits
    • stijn's avatar
      py: Allow retrieving a function's __name__. · 3cc17c69
      stijn authored
      Disabled by default.  Enabled on unix and stmhal ports.
      3cc17c69
    • Paul Sokolovsky's avatar
      py: Implement core of OrderedDict type. · 0ef01d0a
      Paul Sokolovsky authored
      Given that there's already support for "fixed table" maps, which are
      essentially ordered maps, the implementation of OrderedDict just extends
      "fixed table" maps by adding an "is ordered" flag and add/remove
      operations, and reuses 95% of objdict code, just making methods tolerant
      to both dict and OrderedDict.
      
      Some things are missing so far, like CPython-compatible repr and comparison.
      
      OrderedDict is Disabled by default; enabled on unix and stmhal ports.
      0ef01d0a
  9. 14 Mar, 2015 1 commit
  10. 02 Mar, 2015 1 commit
  11. 22 Feb, 2015 1 commit
  12. 15 Feb, 2015 1 commit
  13. 13 Feb, 2015 1 commit
  14. 24 Jan, 2015 1 commit
    • Damien George's avatar
      stmhal: Disable MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE. · ad33e246
      Damien George authored
      It uses RAM and on pyboard we are generally tight on RAM, so disable
      this optimisation for general builds.  If users need the speed then
      they can build their own version.  Maybe in the future we can have
      different versions of pyboard firmware built with different tradeoffs.
      ad33e246
  15. 22 Jan, 2015 1 commit
  16. 10 Jan, 2015 1 commit
  17. 09 Jan, 2015 2 commits
  18. 07 Jan, 2015 2 commits
    • Damien George's avatar
      stmhal: Collect all root pointers together in 1 place. · 3b51b3e9
      Damien George authored
      A GC in stmhal port now only scans true root pointers, not entire BSS.
      This reduces base GC time from 1700ms to 900ms.
      3b51b3e9
    • Damien George's avatar
      py: Add option to cache map lookup results in bytecode. · 7ee91cf8
      Damien George authored
      This is a simple optimisation inspired by JITing technology: we cache in
      the bytecode (using 1 byte) the offset of the last successful lookup in
      a map. This allows us next time round to check in that location in the
      hash table (mp_map_t) for the desired entry, and if it's there use that
      entry straight away.  Otherwise fallback to a normal map lookup.
      
      Works for LOAD_NAME, LOAD_GLOBAL, LOAD_ATTR and STORE_ATTR opcodes.
      
      On a few tests it gives >90% cache hit and greatly improves speed of
      code.
      
      Disabled by default.  Enabled for unix and stmhal ports.
      7ee91cf8
  19. 24 Dec, 2014 1 commit
  20. 19 Dec, 2014 1 commit
  21. 09 Dec, 2014 1 commit
    • Damien George's avatar
      py: Allow builtins to be overridden. · 78d702c3
      Damien George authored
      This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS)
      which, when enabled, allows to override all names within the builtins
      module.  A builtins override dict is created the first time the user
      assigns to a name in the builtins model, and then that dict is searched
      first on subsequent lookups.  Note that this implementation doesn't
      allow deleting of names.
      
      This patch also does some refactoring of builtins code, creating the
      modbuiltins.c file.
      
      Addresses issue #959.
      78d702c3
  22. 27 Nov, 2014 1 commit
  23. 16 Nov, 2014 1 commit
  24. 31 Oct, 2014 1 commit
    • Damien George's avatar
      stmhal: Add ioctl to USB_VCP object, so it works with select. · 9a41b32b
      Damien George authored
      This patch also enables non-blocking streams on stmhal port.
      
      One can now make a USB-UART pass-through function:
      
      def pass_through(usb, uart):
          while True:
              select.select([usb, uart], [], [])
              if usb.any():
                  uart.write(usb.read(256))
              if uart.any():
                  usb.write(uart.read(256))
      
      pass_through(pyb.USB_VCP(), pyb.UART(1, 9600))
      9a41b32b
  25. 23 Oct, 2014 1 commit
  26. 22 Oct, 2014 1 commit
  27. 12 Oct, 2014 2 commits
  28. 11 Oct, 2014 1 commit
  29. 30 Sep, 2014 1 commit
    • Damien George's avatar
      stmhal: Add network and usocket module. · 3a1c4c5b
      Damien George authored
      As per issue #876, the network module is used to configure NICs
      (hardware modules) and configure routing.  The usocket module is
      supposed to implement the normal Python socket module and selects the
      underlying NIC using routing logic.
      
      Right now the routing logic is brain dead: first-initialised,
      first-used.  And the routing table is just a list of registered NICs.
      
      cc3k and wiznet5k work, but not at the same time due to C name clashes
      (to be fixed).
      
      Note that the usocket module has alias socket, so that one can import
      socket and it works as normal.  But you can also override socket with
      your own module, using usocket at the backend.
      3a1c4c5b
  30. 25 Sep, 2014 1 commit
  31. 17 Sep, 2014 1 commit
  32. 07 Sep, 2014 2 commits
  33. 01 Sep, 2014 1 commit
    • Damien George's avatar
      stmhal: Add wiznet5k module, to control WIZnet ethernet adaptor. · bcf041f1
      Damien George authored
      Allows to create socket objects that support TCP and UDP in server and
      client mode.  Interface is very close to standard Python socket class,
      except bind and accept do not work the same (due to hardware not
      supporting them in the usual way).
      
      Not compiled by default.  To compile this module, use:
      make MICROPY_PY_WIZNET5K=1
      bcf041f1
  34. 25 Aug, 2014 1 commit
    • Damien George's avatar
      stmhal: Make enable_irq and disable_irq inline functions. · e5cbb703
      Damien George authored
      These functions are generally 1 machine instruction, and are used in
      critical code, so makes sense to have them inline.
      
      Also leave these functions uninverted (ie 0 means enable, 1 means
      disable) and provide macro constants if you really need to distinguish
      the states.  This makes for smaller code as well (combined with
      inlining).
      
      Applied to teensy port as well.
      e5cbb703