C12 Embedded systems in MicroPython and C · Practice
Memory on small machines: flash, RAM, the stack and the heap
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
0 solved
0 in a row
0 of 7 kinds solid
Check
A chip has 16 KB of RAM; the program has 1 KB of .data, 6 KB of .bss and a 4 KB stack.
(a)
How much RAM is free?
(b)
What share is used?
Check
The deepest call chain is 15 frames of 32 bytes, and 2 interrupt level(s) of 64-byte frames can stack on top.
(a)
How much stack does it need?
(b)
What should be reserved with a 30% margin?
Check
A painted stack of 2048 bytes still has its lowest 300 bytes untouched after testing.
(a)
What is the high-water mark?
(b)
What share of the stack was never used?
Check
A lookup table has 256 entries of 1 bytes.
(a)
How much flash does it take if it's declared const?
(b)
How much RAM does it waste if const is forgotten?
Check
7 KB of a 12 KB RAM is used. How much is free?
Check
Stack for 10 frames of 40 bytes?
Check
High-water mark of a 2048-byte stack with 512 bytes untouched?
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C12