Skip to content
  • Damien George's avatar
    py: Add optional Python-stack memory region. · aca930d3
    Damien George authored
    This patch adds an optional Python-stack memory region, in addition to
    the C stack and the Python heap.  The Python stack is enabled by the
    MICROPY_ENABLE_PYSTACK option (it's disabled by default).  And then the
    memory for the Python stack is initialised via:
    
        mp_pystack_init(pystack_start, pystack_end);
    
    With this feature enabled the memory for the call frame of a Python
    function is allocated from this region, rather than from the C stack
    or heap.  The advantage of using the Python stack is that it is very
    fast to allocate/deallocate, it is deterministic, and allows better
    control over how much C stack is used.
    aca930d3