Discontinuous Call Stack Memory Allocation for Microcontrollers
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Microcontrollers without a memory management unit (MMU) face inefficiencies in memory allocation due to the requirement for continuous stack memory, leading to underutilization of memory resources and increased development complexity for optimizing stack size, as existing solutions rely heavily on MMU-based systems and compilers.
Innovation Solution
A method for managing a discontinuous call stack by allocating memory blocks dynamically, using a stack-location indicator and interrupt allowance, allowing for efficient allocation and deallocation of memory blocks based on availability, enabling the stack memory region to be divided into multiple blocks of varying sizes for optimal use.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If continuous stack memory is allocated to ensure proper call stack operation, then system reliability is improved, but memory utilization deteriorates due to underutilization of reserved memory regions
Solution Approach 1:
The patent divides the stack memory into multiple separate memory blocks (first memory block, second memory block, etc.) that can be allocated independently. The call stack can span across these segmented blocks, allowing the system to reserve only the necessary memory quantity rather than allocating a large continuous region. This segmentation enables both reliable stack operation and improved memory utilization.
2Reliability
If large reserved memory regions are allocated for stack to prevent stack overflow, then system reliability is improved, but memory fragmentation increases and available memory for other uses decreases
Solution Approach 1:
The patent implements dynamic allocation of stack memory blocks based on actual runtime requirements. Instead of statically reserving a large fixed memory region, the system allocates memory blocks as needed and can deallocate them when no longer required. This dynamic approach prevents stack overflow while reducing memory fragmentation and making memory available for other uses when the stack requires less space.
3Quantity of substance
If MMU-based systems are used to optimize memory allocation, then memory efficiency is improved, but device complexity and power consumption increase
Solution Approach 1:
The patent implements a self-service memory management mechanism where the system manages its own stack memory allocation without requiring an external MMU. The call stack management logic directly handles allocation across multiple memory blocks, tracking stack locations and managing memory blocks independently. This self-service approach achieves efficient memory utilization while avoiding the complexity and power consumption overhead of an MMU.
Data Source
AI summary
A method for managing a discontinuous call stack is disclosed to more efficiently use the memory of devices without a memory management unit. The method comprising: storing a stack location indicator indicating a top of said discontinuous call stack in a data store; using said stack location indicator to identify a current memory block of said discontinuous call stack from said plurality of memory blocks, said current memory block storing said top of said discontinuous call stack and a previous location indicator indicating a location of a previous memory block of said discontinuous call stack; determining an amount of memory available in said current memory block; determining an amount of memory required for a stack frame; determining an amount of memory required for an interrupt allowance; allocating said stack frame and said interrupt allowance at least one memory block from said plurality of memory blocks in response to said determinations; storing said stack frame in said allocated memory block; and updating said stack location indicator in said data store.


