Memory allocation

Skip to first unread message

David Boddie

Dec 7, 2022, 7:32:55 AM12/7/22
I'm trying to get a small (ideally minimal) version of Inferno running on
a microcontroller (STM32F405) and have run into some memory issues which I'm
having difficulty figuring out. There's not a lot of RAM to play with (around
100K free at start-up), so it could be that these will be unsolvable.

Like other ports, I'm initialising the maximum pool sizes in main() in my own
poolsizeinit() function, using percentages passed in the configuration file.

In my confinit() function, I'm defining two banks of memory because there are
two non-adjacent areas of usable RAM.

I've set the BY2PG value to 256 instead of 4096 because it would seem to me
that allocating smaller pages would be better with limited RAM, but maybe
that's counterproductive.

In port/alloc.c the pools have default values that are orders of magnitude
larger than the memory available. I brought these values down to reflect the
typical memory sizes, which seems to affect the failure mode slightly, at
least. ;-)

Any hints and tips would be welcome. It's encouraging that the OS boots and
can run the tiny shell, though disappointing that it trips over itself at
some point and faults.


Dec 10, 2022, 10:51:33 AM12/10/22
to inferno-os
I've put the code up:

Despite what the branch is called, it's not a generic Thumb-2 port. I'll be
repurposing the development board for something else so it's unlikely that I'll
be developing this specific port further unless I have a bright idea in the
next couple of days.

There's definitely scope for making it run on a Thumb/Thumb-2 system with more
than the 192K of RAM that this one has. I have another board with 256K of RAM
that I could target, though this means lots of changes to the port because the
microcontroller is from a different vendor.

Sam Ellicott

Dec 10, 2022, 10:55:53 AM12/10/22
to, inferno-os
This is really neat. I would eventually like to port Inferno to
riscv32 (esp32c3) and this will be very helpful.

David Boddie

Dec 10, 2022, 11:07:37 AM12/10/22
to Sam Ellicott, inferno-os
On Saturday, 10 December 2022 16:55:40 CET Sam Ellicott wrote:
> This is really neat. I would eventually like to port Inferno to
> riscv32 (esp32c3) and this will be very helpful.

Sounds good! Something like the Beetle ESP32 - C3?

You'll be giving Richard Miller's RISC-V compiler a good work out, I guess!


Sam Ellicott

Dec 10, 2022, 11:17:00 AM12/10/22
to David Boddie, inferno-os
Something like that, I have one of the reference boards from espressif.
Reply all
Reply to author
0 new messages