ports/sh: slightly more memory on G-III (32 kB -> ~45 kB)

This commit is contained in:
Lephenixnoir 2023-08-20 13:22:00 +02:00
parent 01036c9611
commit 70e15e9ed1
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 20 additions and 4 deletions

View File

@ -322,13 +322,29 @@ int main(int argc, char **argv)
/* Initialize the MicroPython GC with most available memory */
mp_stack_ctrl_init();
#ifdef FX9860G
/* Get *some* memory from the OS heap */
void *gc_area = malloc(32768);
if(!gc_area)
/* Put basically all the OS heap into the Python GC. For our own purposes
we'll use gint's _uram arena and the leftover from the OS heap. */
int size = 65536;
bool first = true;
while(size >= 2048) {
void *area = kmalloc(size, "_os");
if(area) {
if(first)
gc_init(area, area + size);
else
gc_add(area, area + size);
first = false;
}
else size /= 2;
}
if(first)
pe_debug_panic("No heap!");
gc_init(gc_area, gc_area + 32768);
#if PE_DEBUG
/* Add some Python ram */
// https://www.planet-casio.com/Fr/forums/topic15269-10-khicas-add-in-calcul-formel-pour-graph-90e-et-35eii.html#189284
void *py_ram_start = (void*)0x88053800;
void *py_ram_end = (void*)0x8807f000;
gc_add(py_ram_start, py_ram_end);