Serial buffer size on Grand Central M4

As per the title. How do I change Serial buffer size on a Grand Central M4 using platformio?

I tried using:
build_flags = -D SERIAL_BUFFER_SIZE=1024
In platformio.ini

The first error message part is:
src/variant.h:4: warning: “SERIAL_BUFFER_SIZE” redefined
4 | #define SERIAL_BUFFER_SIZE 256
|
: note: this is the location of the previous definition

Subsequent error messages are to do with the libraries that I am using like <Wire.h>.

What’s the best approach here?

What’s the best way to address this?

Well thanks to the code

any global define won’t be able to change the value since it would be #undefined first.

That was most recently changed in

Note that you could also patch this file as you like using advanced scripting

https://docs.platformio.org/en/latest/scripting/examples/override_package_files.html

Is this the only way to change the value to patch it? Is there another way?

My ability to code is still early on and I can’t really understand the steps in the link you have sent.

Thanks for replying to my question.

I don’t see any other way to influence the buffer size but to path the Uart.h file, as it won’t let itself be influenced by any global defines. I’ve opened an issue for that in

if you don’t want to do this dynamic scripting / patching, you can also use platform_packages to point to a one-time fixed version of the package (arduino framework).