Skip to content
Snippets Groups Projects
  1. Aug 14, 2018
    • Damien George's avatar
      py/gc: In gc_alloc, reset n_free var right before search for free mem. · 91041945
      Damien George authored
      Otherwise there is the possibility that n_free starts out non-zero from the
      previous iteration, which may have found a few (but not enough) free blocks
      at the end of the heap.  If this is the case, and if the very first blocks
      that are scanned the second time around (starting at
      gc_last_free_atb_index) are found to give enough memory (including the
      blocks at the end of the heap from the previous iteration that left n_free
      non-zero) then memory will be allocated starting before the location that
      gc_last_free_atb_index points to, most likely leading to corruption.
      
      This serious bug did not manifest itself in the past because a gc_collect
      always resets gc_last_free_atb_index to point to the start of the GC heap,
      and the first block there is almost always allocated to a long-lived
      object (eg entries from sys.path, or mounted filesystem objects), which
      means that n_free would be reset at the start of the search loop.
      
      But with threading enabled with the GIL disabled it is possible to trigger
      the bug via the following sequence of events:
      
      1. Thread A runs gc_alloc, fails to find enough memory, and has a non-zero
         n_free at the end of the search.
      2. Thread A calls gc_collect and frees a bunch of blocks on the GC heap.
      3. Just after gc_collect finishes in thread A, thread B takes gc_mutex and
         does an allocation, moving gc_last_free_atb_index to point to the
         interior of the heap, to a place where there is most likely a run of
         available blocks.
      4. Thread A regains gc_mutex and does its second search for free memory,
         starting with a non-zero n_free.  Since it's likely that the first block
         it searches is available it will allocate memory which overlaps with the
         memory before gc_last_free_atb_index.
      91041945
    • forester3's avatar
      stm32/boards/STM32F7DISC: Enable onboard SDRAM. · 02fbb0a4
      forester3 authored
      The default SYSCLK frequency is reduced to 192MHz because SDRAM requires it
      to be 200MHz or less.
      02fbb0a4
    • forester3's avatar
      stm32/boards/STM32F429DISC: Add burst len and autorefresh to SDRAM cfg. · 502c4102
      forester3 authored
      To align with recent changes to sdram.c.
      502c4102
    • forester3's avatar
      stm32/sdram: Allow additional config by a board, and tune MPU settings. · e562f992
      forester3 authored
      - Allow configuration by a board of autorefresh number and burst length.
      - Increase MPU region size to 8MiB.
      - Make SDRAM region cacheable and executable.
      e562f992
    • Damien George's avatar
      docs/library/machine.UART.rst: Specify optional txbuf and rxbuf args. · b18fa1e6
      Damien George authored
      If a port would like to expose the configuration of transmit and/or receive
      buffers then it can use these arguments.
      b18fa1e6
    • Paul Sokolovsky's avatar
      unix/Makefile: coverage: Explicitly build "axtls" too. · fe1ef507
      Paul Sokolovsky authored
      "coverage" build uses different BUILD directory comparing to the normal
      build. Previously, any build picked up libaxtls.a from normal build's
      directory, but that was fixed recently. So, for each build, we must
      build axtls explicitly.
      
      This fixes Travis build in particular.
      fe1ef507
    • Paul Sokolovsky's avatar
      py/py.mk: Don't hardcode path to libaxtls.a. · bb28fe7b
      Paul Sokolovsky authored
      Use -L$(BUILD), not -Lbuild. Otherwise, builds for different archs/subarchs
      using different values of BUILD may fail.
      bb28fe7b
    • stijn's avatar
      windows/msvc: Support custom compiler for header generation. · 3f9d3e12
      stijn authored
      Use overrideable properties instead of hardcoding the use of the
      default cl executable used by msvc toolsets. This allows using
      arbitrary compiler commands for qstr header generation.
      The CLToolExe and CLToolPath properties are used because they are,
      even though absent from any official documentation, the de-facto
      standard as used by the msvc toolsets themselves.
      3f9d3e12
  2. Aug 13, 2018
  3. Aug 10, 2018
  4. Aug 08, 2018
  5. Aug 07, 2018
  6. Aug 06, 2018
    • Damien George's avatar
      py/emitnative: Simplify handling of exception objects from nlr_buf_t. · 652a5869
      Damien George authored
      There is no need to have three copies of the exception object on the top of
      the native value stack.  Instead, the values on the stack should be the
      first two items in an nlr_buf_t: the prev pointer and the ret_val pointer.
      This is all that is needed and is what the rest of the native emitter
      expects is on the stack.
      
      This patch is essentially an optimisation.  Behaviour is unchanged,
      although the stack layout for native exception handling now makes more
      sense.
      652a5869
  7. Aug 04, 2018
  8. Aug 02, 2018
  9. Aug 01, 2018
    • Stig Bjørlykke's avatar
      nrf: Correct index checking of ADC/PWM/RTCounter instances. · 0c161691
      Stig Bjørlykke authored
      Avoid trying to use ADC, PWM and RTCounter instances which is
      one past last available, because this will give a HardFault.
      0c161691
    • Stig Bjørlykke's avatar
      nrf: Enable all PWM, RTC and Timer instances for nrf52840. · 7f0c5f2e
      Stig Bjørlykke authored
      The NRF52 define only covers nrf52832, so update the define checks
      to use NRF52_SERIES to cover both nrf52832 and nrf52840.
      
      Fixed machine_hard_pwm_instances table in modules/machine/pwm.c
      
      This enables PWM(0) to PWM(3), RTCounter(2), Timer(3) and Timer(4),
      in addition to NFC reset cause, on nrf52840.
      7f0c5f2e
    • Stig Bjørlykke's avatar
      nrf/uos: Add mbfs __enter__ and __exit__ handlers. · b6e49da4
      Stig Bjørlykke authored
      This will make 'with open('file', 'r') as f:' work by properly close
      the file after the suite is finished.
      Unverified
      b6e49da4
    • Rich Barlow's avatar
      tools/mpy-tool: Set sane initial dynamic qstr pool size with frozen mods · 6e5a40cf
      Rich Barlow authored
      The first dynamic qstr pool is double the size of the 'alloc' field of
      the last const qstr pool. The built in const qstr pool
      (mp_qstr_const_pool) has a hardcoded alloc size of 10, meaning that the
      first dynamic pool is allocated space for 20 entries. The alloc size
      must be less than or equal to the actual number of qstrs in the pool
      (the 'len' field) to ensure that the first dynamically created qstr
      triggers the creation of a new pool.
      
      When modules are frozen a second const pool is created (generally
      mp_qstr_frozen_const_pool) and linked to the built in pool. However,
      this second const pool had its 'alloc' field set to the number of qstrs
      in the pool. When freezing a large quantity of modules this can result
      in thousands of qstrs being in the pool. This means that the first
      dynamically created qstr results in a massive allocation. This commit
      sets the alloc size of the frozen qstr pool to 10 or less (if the number
      of qstrs in the pool is less than 10). The result of this is that the
      allocation behaviour when a dynamic qstr is created is identical with an
      without frozen code.
      
      Note that there is the potential for a slight memory inefficiency if the
      frozen modules have less than 10 qstrs, as the first few dynamic
      allocations will have quite a large overhead, but the geometric growth
      soon deals with this.
      6e5a40cf
    • Damien George's avatar
      stm32/modmachine: Get machine.sleep working on L4 MCUs. · 5482d846
      Damien George authored
      When waking from stop mode most of the system is still in the same state as
      before entering stop, so only minimal configuration is needed to bring the
      system clock back online.
      5482d846
    • Damien George's avatar
  10. Jul 31, 2018
    • Damien George's avatar
      docs: Move WiPy specific Timer class to separate doc file. · d8e03204
      Damien George authored
      The WiPy machine.Timer class is very different to the esp8266 and esp32
      implementations which are better candidates for a general Timer class.  By
      moving the WiPy Timer docs to a completely separate file, under a new name
      machine.TimerWiPy, it gives a clean slate to define and write the docs for
      a better, general machine.Timer class.  This is with the aim of eventually
      providing documentation that does not have conditional parts to it,
      conditional on the port.
      
      While the new docs are being defined it makes sense to keep the WiPy docs,
      since they describe its behaviour.  Once the new Timer behaviour is defined
      the WiPy code can be changed to match it, and then the TimerWiPy docs would
      be removed.
      d8e03204
    • Damien George's avatar
Loading