truncate boot_out.txt if it's long

Now this boot.py:
```py
for i in range(1000):
    print(i)
```
creates a 512-byte boot_out.txt that ends
```
88
89
...
```
This commit is contained in:
Jeff Epler 2021-11-02 18:21:45 -05:00
parent 694af3dd23
commit efffb62b36

View File

@ -60,8 +60,14 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) {
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
if (boot_output != NULL) {
// Ensure boot_out.txt is capped at 1 filesystem block and ends with a newline
if (len + boot_output->len > 508) {
vstr_add_str(boot_output, "...\n");
boot_output = NULL;
} else {
vstr_add_strn(boot_output, str, len);
}
}
#endif
serial_write_substring(str, len);