-
-
Notifications
You must be signed in to change notification settings - Fork 779
Description
System specifications
- nRF52840-DK board
USB_DEBUGGINGenabled on the board'ssrc/main.rs- Latest Tock kernel, commit 527afb4
Commands run
On Tock repository.
cd boards/nordic/nrf52840dk
make flashOn libtock-rs at my console-check branch.
./run_example console_triangleExpected behavior
The console_triangle example from my console-check branch on libtock-rs is using the console driver with buffers of increasing size (hence the "triangle") https://github.com/gendx/libtock-rs/blob/console-check/examples/console_triangle.rs.
The output is supposed to look like this:
1
22
333
4444
55555
666666
7777777
88888888
999999999
0000000000
11111111111
222222222222
3333333333333
44444444444444
555555555555555
...
Observed behavior
With a maximum buffer size of 128 bytes, I observe corrupted console output such as the following:
...
6666666666666666666666666666666666666666666666666666666666666666666666666666
77777777777777777777777777777777777777777777777777777777777777777777777777777
888888888888888888888888888888888888888888888888888888888888888888888888888888
9999999999999999999999999999999999999999999999999999999999999999999999999999999
00000000000000000000000000000000000000000000000000000000000000000000000000000000
111111111111111111111111111111111111111111111111111111111111111111111111111111111
2222222222222222222222222222222222222222222222222222222222222222222222222222222222
3333333333333333333333333333333333333334444444444
333333333333333333333333333333333
4444444444444445555555555555555555555555555555555555555555555
4444444444444444444444
5566666666666666666666666666666666666666666666666666666666666666666666666
7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
88888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888
...
When the maximum buffer size is 64 bytes however, there's no such corrupted output.
Analysis
Incidentally, the console driver has buffers of 64 bytes, which leads me to believe that the bug could come from there.
Lines 59 to 60 in 527afb4
| pub static mut WRITE_BUF: [u8; 64] = [0; 64]; | |
| pub static mut READ_BUF: [u8; 64] = [0; 64]; |
It could also be another side-effect of alarms not working properly (see #1651).
Help wanted
I can currently only test on nRF52840-DK via Segger RTT output, so it would be helpful to know if anyone can reproduce on another board and/or on UART output.