Skip to content

Commit 143a1ff

Browse files
committed
spresense: change the GC to do 32-byte blocks
1 parent fbf4431 commit 143a1ff

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

ports/cxd56/configs/circuitpython/defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ CONFIG_USBDEV=y
165165
CONFIG_USBDEV_DMA=y
166166
CONFIG_USBDEV_DUALSPEED=y
167167
CONFIG_USEC_PER_TICK=1000
168-
CONFIG_USERMAIN_STACKSIZE=1064960
169168
CONFIG_USER_ENTRYPOINT="spresense_main"
170169
CONFIG_VIDEO_ISX012=y
171170
CONFIG_VIDEO_STREAM=y

ports/cxd56/mpconfigport.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@
2727
#ifndef __INCLUDED_MPCONFIGPORT_H
2828
#define __INCLUDED_MPCONFIGPORT_H
2929

30-
#define MICROPY_PY_SYS_PLATFORM "CXD56"
30+
#define MICROPY_PY_SYS_PLATFORM "CXD56"
3131

3232
// 64kiB stack
33-
#define CIRCUITPY_DEFAULT_STACK_SIZE 0x10000
33+
#define CIRCUITPY_DEFAULT_STACK_SIZE (0x10000)
3434

3535
#include "py/circuitpy_mpconfig.h"
3636

37+
#define MICROPY_BYTES_PER_GC_BLOCK (32)
38+
3739
#define MICROPY_PORT_ROOT_POINTERS \
3840
CIRCUITPY_COMMON_ROOT_POINTERS \
3941

ports/cxd56/supervisor/port.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,20 @@
4646
#include "common-hal/pwmio/PWMOut.h"
4747
#include "common-hal/busio/UART.h"
4848

49+
#define HEAP_SIZE (1000 * 1024)
50+
51+
uint32_t* heap;
52+
uint32_t heap_size;
53+
4954
safe_mode_t port_init(void) {
5055
boardctl(BOARDIOC_INIT, 0);
5156

5257
// Wait until RTC is available
5358
while (g_rtc_enabled == false);
5459

60+
heap = memalign(32, HEAP_SIZE);
61+
heap_size = HEAP_SIZE / sizeof(uint32_t);
62+
5563
if (board_requests_safe_mode()) {
5664
return USER_SAFE_MODE;
5765
}
@@ -100,11 +108,11 @@ uint32_t *port_stack_get_top(void) {
100108
}
101109

102110
uint32_t *port_heap_get_bottom(void) {
103-
return port_stack_get_limit();
111+
return heap;
104112
}
105113

106114
uint32_t *port_heap_get_top(void) {
107-
return port_stack_get_top();
115+
return heap + heap_size;
108116
}
109117

110118
extern uint32_t _ebss;

0 commit comments

Comments
 (0)