1. 29 Jan, 2016 2 commits
    • Damien George's avatar
      stmhal: Make TIM3 available for use by the user. · ea89b80f
      Damien George authored
      TIM3 is no longer used by USB CDC for triggering outgoing data, so we
      can now make it available to the user.
      
      PWM fading on LED(4) is now gone, but will be reinstated in a new way.
      ea89b80f
    • Paul Sokolovsky's avatar
      py/runtime: mp_stack_ctrl_init() should be called immediately on startup. · d3b1f0b6
      Paul Sokolovsky authored
      Calling it from mp_init() is too late for some ports (like Unix), and leads
      to incomplete stack frame being captured, with following GC issues. So, now
      each port should call mp_stack_ctrl_init() on its own, ASAP after startup,
      and taking special precautions so it really was called before stack variables
      get allocated (because if such variable with a pointer is missed, it may lead
      to over-collecting (typical symptom is segfaulting)).
      d3b1f0b6
  2. 07 Dec, 2015 2 commits
    • Dave Hylands's avatar
      stmhal: Print exception information in nlr_jump_failed · f380904b
      Dave Hylands authored
      Currently nlr_jump_fail prints that there was an uncaught exception
      but nothing about the exception.
      This patch causes nlr_jump_failed to try to print the exception.
      Given that printf was called on the line above, I think that
      the call to mp_obj_print_exception has about as much likelyhood
      of succeeding as the printf does.
      f380904b
    • Dave Hylands's avatar
      stmhal: Execute boot.py and main.py when formatting the file system. · acc20841
      Dave Hylands authored
      When you use the USER button to perform a filesystem reset
      at boot time then it wipes out the filesystem and creates
      a new boot.py and main.py.  With this patch these files are
      executed after formatting, ensuring that pyb and machine modules
      get imported.
      acc20841
  3. 04 Dec, 2015 2 commits
  4. 23 Nov, 2015 1 commit
    • T S's avatar
      stmhal: Implement delayed RTC initialization with LSI fallback. · 86aa16be
      T S authored
      If RTC is already running at boot then it's left alone.  Otherwise, RTC is
      started at boot but startup function returns straight away.  RTC startup
      is then finished the first time it is used.  Fallback to LSI if LSE fails
      to start in a certain time.
      
      Also included:
       MICROPY_HW_CLK_LAST_FREQ
              hold pyb.freq() parameters in RTC backup reg
       MICROPY_HW_RTC_USE_US
              option to present datetime sub-seconds in microseconds
       MICROPY_HW_RTC_USE_CALOUT
              option to enable RTC calibration output
      
      CLK_LAST_FREQ and RTC_USE_CALOUT are enabled for PYBv1.0.
      86aa16be
  5. 09 Nov, 2015 1 commit
  6. 31 Oct, 2015 1 commit
    • Damien George's avatar
      all: Add py/mphal.h and use it in all ports. · 731f3592
      Damien George authored
      py/mphal.h contains declarations for generic mp_hal_XXX functions, such
      as stdio and delay/ticks, which ports should provide definitions for.  A
      port will also provide mphalport.h with further HAL declarations.
      731f3592
  7. 19 Oct, 2015 1 commit
  8. 11 Oct, 2015 1 commit
  9. 12 Sep, 2015 1 commit
  10. 05 Aug, 2015 2 commits
  11. 02 Aug, 2015 1 commit
  12. 29 Jul, 2015 1 commit
  13. 06 May, 2015 1 commit
  14. 04 Mar, 2015 1 commit
  15. 15 Feb, 2015 1 commit
  16. 13 Feb, 2015 4 commits
  17. 09 Jan, 2015 1 commit
  18. 07 Jan, 2015 1 commit
  19. 01 Jan, 2015 1 commit
  20. 25 Oct, 2014 1 commit
  21. 22 Oct, 2014 1 commit
  22. 21 Oct, 2014 1 commit
    • Damien George's avatar
      stmhal: Overhaul UART class to use read/write, and improve it. · 481d714b
      Damien George authored
      UART object now uses a stream-like interface: read, readall, readline,
      readinto, readchar, write, writechar.
      
      Timeouts are configured when the UART object is initialised, using
      timeout and timeout_char keyword args.
      
      The object includes optional read buffering, using interrupts.  You can set
      the buffer size dynamically using read_buf_len keyword arg.  A size of 0
      disables buffering.
      481d714b
  23. 06 Oct, 2014 1 commit
  24. 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
  25. 29 Sep, 2014 1 commit
  26. 23 Sep, 2014 1 commit
    • Damien George's avatar
      stmhal: Initialise stack pointer correctly. · eaaebf32
      Damien George authored
      Stack is full descending and must be 8-byte aligned.  It must start off
      pointing to just above the last byte of RAM.
      
      Previously, stack started pointed to last byte of RAM (eg 0x2001ffff)
      and so was not 8-byte aligned.  This caused a bug in combination with
      alloca.
      
      This patch also updates some debug printing code.
      
      Addresses issue #872 (among many other undiscovered issues).
      eaaebf32
  27. 15 Sep, 2014 1 commit
    • Damien George's avatar
      py: Move definition of mp_sys_exit to core. · b92cbe61
      Damien George authored
      sys.exit always raises SystemExit so doesn't need a special
      implementation for each port.  If C exit() is really needed, use the
      standard os._exit function.
      
      Also initialise mp_sys_path and mp_sys_argv in teensy port.
      b92cbe61
  28. 25 Aug, 2014 1 commit
  29. 16 Aug, 2014 1 commit
  30. 10 Aug, 2014 1 commit
  31. 04 Aug, 2014 2 commits
    • Damien George's avatar
      stmhal: Clean up reset/soft-reset code; fix bug init'ing VCP exc. · ccacdf44
      Damien George authored
      Make a clearer distinction between init functions that must be done
      before any scripts can run (xxx_init0) and those that can be safely
      deferred (xxx_init).
      
      Fix bug initialising USB VCP exception.  Addresses issue #788.
      
      Re-order some init function to improve reliability of
      reset/soft-reset.
      ccacdf44
    • Damien George's avatar
      Put call to qstr_init and mp_init_emergency_exc_buf in mp_init. · 8dbbbbc7
      Damien George authored
      qstr_init is always called exactly before mp_init, so makes sense to
      just have mp_init call it.  Similarly with
      mp_init_emergency_exception_buf.  Doing this makes the ports simpler and
      less error prone (ie they can no longer forget to call these).
      8dbbbbc7
  32. 31 Jul, 2014 1 commit
    • Damien George's avatar
      stmhal: Change 0:/ and 1:/ to /flash and /sd; add CWD support. · 65dd7bc1
      Damien George authored
      Some important changes to the way the file system is structured on the
      pyboard:
      
      1. 0: and 1: drive names are now replaced with POSIX inspired
      directories, namely /flash and /sd.
      
      2. Filesystem now supports the notion of a current working directory.
      Supports the standard Python way of manipulating it: os.chdir and
      os.getcwd.
      
      3. On boot up, current directory is /flash if no SD inserted, else /sd
      if SD inserted.  Then runs boot.py and main.py from the current dir.
      This is the same as the old behaviour, but is much more consistent and
      flexible (eg you can os.chdir in boot.py to change where main.py is run
      from).
      
      4. sys.path (for import) is now set to '' (current dir), plus /flash
      and /flash/lib, and then /sd and /sd/lib if SD inserted.  This, along
      with CWD, means that import now works properly.  You can import a file
      from the current directory.
      
      5. os.listdir is fixed to return just the basename, not the full path.
      
      See issue #537 for background and discussion.
      65dd7bc1