Skip to content

Commit aaea755

Browse files
committed
Increase stack size (Back-port adafruit#2393 to 4.x)
1 parent dbab538 commit aaea755

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

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

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

36+
// Increase stack size slightly due to CPX library import nesting
37+
#define CIRCUITPY_DEFAULT_STACK_SIZE (4504)
38+
3639
#define DEFAULT_I2C_BUS_SCL (&pin_PB03)
3740
#define DEFAULT_I2C_BUS_SDA (&pin_PB02)
3841

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

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

36+
// Increase stack size slightly due to CPX library import nesting
37+
#define CIRCUITPY_DEFAULT_STACK_SIZE (4504)
38+
3639
#define DEFAULT_I2C_BUS_SCL (&pin_PB03)
3740
#define DEFAULT_I2C_BUS_SDA (&pin_PB02)
3841

ports/atmel-samd/mpconfigport.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#define CIRCUITPY_MCU_FAMILY samd21
3535
#define MICROPY_PY_SYS_PLATFORM "Atmel SAMD21"
3636
#define SPI_FLASH_MAX_BAUDRATE 8000000
37-
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
3837
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
3938
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
4039
#define MICROPY_PY_FUNCTION_ATTRS (0)
@@ -69,6 +68,7 @@
6968
#define MICROPY_PY_UJSON (1)
7069
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1)
7170
// MICROPY_PY_UERRNO_LIST - Use the default
71+
7272
#endif
7373

7474
// Turning off audioio, audiobusio, and touchio as necessary
@@ -78,6 +78,19 @@
7878

7979
#include "py/circuitpy_mpconfig.h"
8080

81+
82+
#ifdef SAMD21
83+
#ifndef CIRCUITPY_DEFAULT_STACK_SIZE
84+
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
85+
#endif
86+
#endif
87+
88+
#ifdef SAMD51
89+
#ifndef CIRCUITPY_DEFAULT_STACK_SIZE
90+
#define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024)
91+
#endif
92+
#endif
93+
8194
#define MICROPY_PORT_ROOT_POINTERS \
8295
CIRCUITPY_COMMON_ROOT_POINTERS \
8396
mp_obj_t playing_audio[AUDIO_DMA_CHANNEL_COUNT];

tools/build_memory_info.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@
6161
space = M_PATTERN.sub(M_REPLACE, space)
6262
regions[region] = eval(space)
6363

64+
ram_region = regions["RAM"]
6465
free_flash = regions["FLASH"] - text - data
6566
free_ram = regions["RAM"] - data - bss
6667
print(free_flash, "bytes free in flash out of", regions["FLASH"], "bytes (", regions["FLASH"] / 1024, "kb ).")
67-
print(free_ram, "bytes free in ram for stack out of", regions["RAM"], "bytes (", regions["RAM"] / 1024, "kb ).")
68+
print("{} bytes free in ram for stack and heap out of {} bytes ({}kB).".format(free_ram, ram_region, ram_region / 1024))
6869
print()
6970

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

0 commit comments

Comments
 (0)