Skip to content

Commit 90f9e51

Browse files
committed
Fixed the stack overflow and removed the workaround for it
1 parent 8e0c74e commit 90f9e51

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,6 @@ target_link_libraries(rpi_inmp441_kws
163163
CMSISDSP
164164
)
165165

166-
#target_compile_definitions(rpi_inmp441_kws PRIVATE PICO_STACK_SIZE=0x1000)
166+
target_compile_definitions(rpi_inmp441_kws PRIVATE PICO_CORE1_STACK_SIZE=0x1000)
167167
pico_add_extra_outputs(rpi_inmp441_kws)
168168

src/fast_grnn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ void sha_rnn_get_max_logit(const sha_rnn_output_t input, float *max_logit, size_
163163

164164
void sha_rnn_process(const sha_rnn_input_t input, float *max_logit, size_t *max_idx)
165165
{
166-
float output[64] = {0.0f};
167-
float output2[32] = {0.0f};
168-
float output3[6] = {0.0f};
166+
static float output[64] = {0.0f};
167+
static float output2[32] = {0.0f};
168+
static float output3[6] = {0.0f};
169169

170170
sha_rnn_rnn0_process(input, output);
171171
sha_rnn_rnn1_process(output, output2);

src/fbank.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,10 @@ static void preemphasis(float *input, size_t len)
271271

272272
static void powspec(const float input[FRAME_LEN], float output[NUM_FFT_BINS])
273273
{
274-
float32_t tmp[NUM_FFT] = {0.0f};
275-
float32_t out[NUM_FFT];
274+
static float32_t tmp[NUM_FFT];
275+
static float32_t out[NUM_FFT];
276+
277+
memset(tmp, 0, sizeof(tmp));
276278

277279
for (size_t i = 0; i < FRAME_LEN; i++)
278280
{

src/rpi_inmp441_kws.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ static void(core1_entry)(void)
124124
}
125125
}
126126

127-
static uint32_t core1_stack[8 * 1024UL];
128-
129127
static float fbins_out[SHARNN_BRICK_SIZE][NUM_FILT];
130128

131129
int main()
@@ -147,7 +145,7 @@ int main()
147145
}
148146
printf("\n");
149147

150-
multicore_launch_core1_with_stack(core1_entry, core1_stack, sizeof(core1_stack));
148+
multicore_launch_core1(core1_entry);
151149

152150
fbank_init();
153151

0 commit comments

Comments
 (0)