Skip to content

Commit 170310c

Browse files
committed
working on --task-stack-size
1 parent 16ec6fd commit 170310c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

builder/esp32.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -844,19 +844,12 @@ def set_thread_core():
844844
data = data.replace(pattern, text)
845845
break
846846

847-
if '#ifdef MICROPY_TASK_STACK_SIZE' not in data:
848-
new_lines = [
849-
'#ifdef MICROPY_TASK_STACK_SIZE',
850-
' #undef MICROPY_TASK_STACK_SIZE'
851-
'#endif'
852-
''
853-
f'#define MICROPY_TASK_STACK_SIZE ({task_stack_size})'
854-
''
855-
'#ifndef MICROPY_CONFIG_ROM_LEVEL'
856-
]
847+
if data.count('#define MICROPY_TASK_STACK_SIZE') == 1:
857848
data = data.replace(
858849
'#ifndef MICROPY_CONFIG_ROM_LEVEL',
859-
'\n'.join(new_lines), 1)
850+
f'#define MICROPY_TASK_STACK_SIZE '
851+
f'({task_stack_size})\n\n#ifndef MICROPY_CONFIG_ROM_LEVEL'
852+
)
860853
else:
861854
data = data.split('\n')
862855
for i, line in enumerate(data):

0 commit comments

Comments
 (0)