micropython/ports
cpottle9 c80e7c14e6 rp2: Allocate GC heap from unused RAM.
Borrowing an idea from the mimxrt port (also stm32 port): in the loader
input file memmap_mp.ld calculate __GcHeapStart and __GcHeapEnd as the
unused RAM.  Then in main.c use these addresses as arguments to gc_init().

The benefits of this change are:

1) When libraries are added or removed in the future changing BSS usage,
   main.c's sizing of the GC heap does not need to be changed.

2) Currently these changes make the GC area about 30 KBytes larger, eg on
   PICO_W the GC heap increases from 166016 to 192448 bytes.  Without that
   change this RAM would never get used.

3) If someone wants to disable one or more SRAM blocks on the RP2040 to
   reduce power consumption it will be easy: just change the MEMORY section
   in memmap_mp.ld.  For instance to not use SRAM2 and SRAM3 change it to:

        MEMORY
        {
            FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 2048k
            RAM(rwx) : ORIGIN =  0x21000000, LENGTH = 128k
            SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
            SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
        }

   Then to turn off clocks for SRAM2 and SRAM3 from MicroPython, set the
   appropriate bits in WAKE_EN0 and SLEEP_EN0.

Tested by running the firmware.uf2 file on PICO_W and displaying
micropython.mem_info().  Confirmed GC total size approximately matched the
size calculated by the loader.

Signed-off-by: cpottle9 <cpottle9@outlook.com>
2023-03-09 12:00:02 +11:00
..
bare-arm bare-arm/mpconfigport.h: Disable remaining optional features. 2021-11-01 14:23:06 +11:00
cc3200 shared/runtime/gchelper: Drop cpu directive from ARM asm helpers. 2023-01-28 15:51:38 +11:00
embed embed: Add new "embed" port which builds a simple C package. 2023-01-20 22:28:50 +11:00
esp32 esp32: Use extmod/modnetwork.c instead of port-specific version. 2023-03-01 01:26:54 +11:00
esp8266 esp8266: Use extmod/modnetwork.c instead of port-specific version. 2023-03-01 01:27:06 +11:00
mimxrt mimxrt/pendsv: Add MICROPY_BOARD_PENDSV_ENTRIES for board customisation. 2023-03-07 15:57:58 +11:00
minimal minimal: Increase heap size for Linux builds. 2023-02-20 10:44:14 +11:00
nrf nrf/boards/arduino_nano_33_ble_sense: Add support for REV-2 chipset. 2023-03-08 00:53:25 +11:00
pic16bit all: Use += rather than = everywhere for CFLAGS/LDFLAGS/LIBS. 2022-10-11 23:17:41 +11:00
powerpc all: Use += rather than = everywhere for CFLAGS/LDFLAGS/LIBS. 2022-10-11 23:17:41 +11:00
qemu-arm shared/runtime/gchelper: Drop cpu directive from ARM asm helpers. 2023-01-28 15:51:38 +11:00
renesas-ra ports: Make BOARD default from BOARD_DIR in Makefile's. 2023-02-23 09:47:08 +11:00
rp2 rp2: Allocate GC heap from unused RAM. 2023-03-09 12:00:02 +11:00
samd samd/pendsv: Add MICROPY_BOARD_PENDSV_ENTRIES for board customisation. 2023-03-07 15:59:58 +11:00
stm32 stm32/boards: Include "senml" in manifest for ARDUINO boards. 2023-03-09 10:37:06 +11:00
teensy shared/runtime/gchelper: Drop cpu directive from ARM asm helpers. 2023-01-28 15:51:38 +11:00
unix ports: Make BOARD default from BOARD_DIR in Makefile's. 2023-02-23 09:47:08 +11:00
webassembly webassembly/library: Extract and send data to print as UInt8Array. 2022-12-13 17:16:37 +11:00
windows ports: Make BOARD default from BOARD_DIR in Makefile's. 2023-02-23 09:47:08 +11:00
zephyr zephyr: Rename machine I2C and SPI types consistently across ports. 2022-10-22 12:58:21 +11:00