Skip to content

Commit e9cb47f

Browse files
authored
Merge pull request #2393 from dhalbert/increase-cpx-stack
Increase CPX stack size slightly
2 parents 1108e8f + 81581b3 commit e9cb47f

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
// Explanation of how a user got into safe mode.
2828
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
2929

30+
// Increase stack size slightly due to CPX library import nesting
31+
#define CIRCUITPY_DEFAULT_STACK_SIZE (4504)
32+
3033
#define DEFAULT_I2C_BUS_SCL (&pin_PB03)
3134
#define DEFAULT_I2C_BUS_SDA (&pin_PB02)
3235

ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
// Explanation of how a user got into safe mode.
2828
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
2929

30+
// Increase stack size slightly due to CPX library import nesting
31+
#define CIRCUITPY_DEFAULT_STACK_SIZE (4504)
32+
3033
#define DEFAULT_I2C_BUS_SCL (&pin_PB03)
3134
#define DEFAULT_I2C_BUS_SDA (&pin_PB02)
3235

ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
// Explanation of how a user got into safe mode.
2828
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
2929

30+
// Increase stack size slightly due to CPX library import nesting.
31+
#define CIRCUITPY_DEFAULT_STACK_SIZE (4504) // divisible by 8
32+
3033
#define DEFAULT_I2C_BUS_SCL (&pin_PB03)
3134
#define DEFAULT_I2C_BUS_SDA (&pin_PB02)
3235

ports/atmel-samd/mpconfigport.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#define CIRCUITPY_MCU_FAMILY samd21
4343
#define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21"
4444
#define SPI_FLASH_MAX_BAUDRATE 8000000
45-
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
4645
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
4746
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
4847
#define MICROPY_PY_FUNCTION_ATTRS (0)
@@ -74,8 +73,6 @@
7473
#define CIRCUITPY_MCU_FAMILY samd51
7574
#define MICROPY_PY_SYS_PLATFORM "MicroChip SAMD51"
7675
#define SPI_FLASH_MAX_BAUDRATE 24000000
77-
// 24kiB stack
78-
#define CIRCUITPY_DEFAULT_STACK_SIZE 0x6000
7976
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1)
8077
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1)
8178
#define MICROPY_PY_FUNCTION_ATTRS (1)
@@ -108,6 +105,10 @@
108105
#define CIRCUITPY_INTERNAL_NVM_SIZE (256)
109106
#endif
110107

108+
#ifndef CIRCUITPY_DEFAULT_STACK_SIZE
109+
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
110+
#endif
111+
111112
#endif // SAMD21
112113

113114
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -118,6 +119,10 @@
118119
#define CIRCUITPY_INTERNAL_NVM_SIZE (8192)
119120
#endif
120121

122+
#ifndef CIRCUITPY_DEFAULT_STACK_SIZE
123+
#define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024)
124+
#endif
125+
121126
// If CIRCUITPY is internal, use half of flash for it.
122127
#if INTERNAL_FLASH_FILESYSTEM
123128
#ifndef CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE

tools/build_memory_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
free_flash = firmware_region - text - data
7474
free_ram = ram_region - data - bss
7575
print("{} bytes free in flash firmware space out of {} bytes ({}kB).".format(free_flash, firmware_region, firmware_region / 1024))
76-
print("{} bytes free in ram for heap out of {} bytes ({}kB).".format(free_ram, ram_region, ram_region / 1024))
76+
print("{} bytes free in ram for stack and heap out of {} bytes ({}kB).".format(free_ram, ram_region, ram_region / 1024))
7777
print()
7878

7979
# Check that we have free flash space. GCC doesn't fail when the text + data

0 commit comments

Comments
 (0)