boards: nucleo_f031k6: update CONFIG_ISR_STACK_SIZE

The current setting of `CONFIG_ISR_STACK_SIZE=256` in the
`nucleo_f031k6_defconfig` for the `nucleo_f031k6` creates a stack
overflow in the `ISR0` thread. The stack is simply too small.

This can be verified by increasing `CONFIG_ISR_STACK_SIZE=512` and
then build some of the sample applications (fx. `samples/basic/blinky`
and `samples/helloworld`).

As part of the study the `THREAD_ANALYZER` was enabled, to get some
insigt to what a proper new stack size for `ISR0` should be. The used
config is shown below.

```
CONFIG_THREAD_ANALYZER=y
CONFIG_THREAD_ANALYZER_USE_PRINTK=y
CONFIG_THREAD_ANALYZER_AUTO=y
CONFIG_THREAD_ANALYZER_AUTO_INTERVAL=5
CONFIG_THREAD_ANALYZER_AUTO_STACK_SIZE=540
CONFIG_THREAD_NAME=y
CONFIG_THREAD_RUNTIME_STATS=y
```

During the tests the following results were recorded for the
`samples/basic/blinky` and `samples/helloworld`. As seen the `ISR0`
stack usage is 80% for the two use cases, which leaves a little
headroom for other samples and applications.

**samples/basic/blinky**:

```
Thread analyze:
 thread_analyzer     : STACK: unused 96 usage 504 / 600 (84 %); CPU: 0 %
      : Total CPU cycles used: 12472939
 idle                : STACK: unused 104 usage 48 / 152 (31 %); CPU: 99 %
      : Total CPU cycles used: 1679934713
 main                : STACK: unused 284 usage 228 / 512 (44 %); CPU: 0 %
      : Total CPU cycles used: 274737
 ISR0                : STACK: unused 100 usage 412 / 512 (80 %)
```

**samples/helloworld**:

```
Thread analyze:
 thread_analyzer     : STACK: unused 40 usage 504 / 544 (92 %); CPU: 0 %
      : Total CPU cycles used: 2634078
 idle                : STACK: unused 104 usage 48 / 152 (31 %); CPU: 99 %
      : Total CPU cycles used: 480004798
 ISR0                : STACK: unused 100 usage 412 / 512 (80 %)
```

As part of the test it was also checked if the stack usage of `ISR0`
could be lowered by setting `CONFIG_UART_INTERRUPT_DRIVEN=n` in the
`nucleo_f031k6_defconfig`. This didn't seem to have any effect on the
`ISR0` stack utilization.

Signed-off-by: Carsten Thuesen <cvt@thucon.dk>
1 file changed