Remove debug menu, allocate more memory

Experimentally, we need to leave about 4K free for "other stuff"

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
Christophe de Dinechin 2022-11-02 13:37:04 +01:00
parent 303ac0ff17
commit 08638f7ef8
2 changed files with 10 additions and 13 deletions

View file

@ -604,6 +604,13 @@ void stop_buzzer()
{
record(dmcp_notyet, "stop_buzzer not implemented");
}
int sys_free_mem()
{
// On the simulator, we have real memory
return 1024 * 1024;
}
void sys_delay(uint32_t ms_delay)
{
QThread::msleep(ms_delay);

View file

@ -157,8 +157,9 @@ void program_init()
font_defaults();
#ifndef DEBUG
// Give 64K to the runtime
size_t size = 64 * 1024;
// Give as much as memory as possible to the runtime
// Experimentally, this is the amount of memory we need to leave free
size_t size = sys_free_mem() - 8 * 1024;
#else
// Give 256 bytes to the runtime to stress-test the GC
size_t size = 256;
@ -166,17 +167,6 @@ void program_init()
byte *memory = (byte *) malloc(size);
runtime::RT.memory(memory, size);
// Fake test menu
cstring labels[input::NUM_MENUS] = {
"Short", "A bit long", "Very long", "Super Duper long",
"X1", "X2", "A", "B",
"C", "D", "E", "F",
"Tests", "Benchmark DMCP", "Benchark My Code", "Toggle Font",
"Previous Font", "Next Font",
};
object_p functions[input::NUM_MENUS] = { MenuFont };
Input.menus(input::NUM_MENUS, labels, functions);
// The following is just to link the same set of functions as DM42
if (memory == (byte *) program_init)
{