[libmaple and STM32Generic] configurable buffer sizes with larger chips

Cores are the underlying magic that make the Arduino API possible
Post Reply
User avatar
Pito
Posts: 1625
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

[libmaple and STM32Generic] configurable buffer sizes with larger chips

Post by Pito » Sun Jul 16, 2017 7:42 am

:idea:
Would it be possible to make the various buffers sizes within the cores (ie. rx/tx serial/usb and maybe others) configurable via for example boards.txt parameters? With 64kB/128kB chips we could afford much larger buffers, couldn't we?
Pukao Hats Cleaning Services Ltd.

victor_pv
Posts: 1734
Joined: Mon Apr 27, 2015 12:12 pm

Re: [libmaple and STM32Generic] configurable buffer sizes with larger chips

Post by victor_pv » Sat Aug 12, 2017 2:37 am

Pito wrote:
Sun Jul 16, 2017 7:42 am
:idea:
Would it be possible to make the various buffers sizes within the cores (ie. rx/tx serial/usb and maybe others) configurable via for example boards.txt parameters? With 64kB/128kB chips we could afford much larger buffers, couldn't we?
Can be done, similar to how the board options selected to have Serial USB or not, but personally the boards.txt file is getting so bloated, I would skip it.
For most users the buffers size is ok, and otherwise is not too hard to change it.
We could have the #define line for the buffer size be conditional, depending on the MCU selected or the series, use a different buffer size.
That wouldn't add to the bloat on the menus.

User avatar
RogerClark
Posts: 7413
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: [libmaple and STM32Generic] configurable buffer sizes with larger chips

Post by RogerClark » Sat Aug 12, 2017 3:22 am

@victor

Unfortunately the way the IDE works, there is no way to put a #include e.g. into the main sketch, which would get picked up by the functions in the core

I agree, yet another option in boards.txt will be confusing and the file is already huge.

We could simply assign larger buffers in variants for the devices with more RAM, but this presumes that everyone wants larger buffers and doesnt want to use the RAM for something else.
e.g. People are starting to use the OV7670 camera with the F103VGT boards etc, but want to use the RAM for storing or buffering the video frame data

danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: [libmaple and STM32Generic] configurable buffer sizes with larger chips

Post by danieleff » Sat Aug 12, 2017 5:58 am

I have -DRAM_LENGTH={upload.maximum_data_size} -DFLASH_LENGTH={upload.maximum_size} in platform.txt
This way this data is available in the compiled files.

I was thinking making the buffer sizes a percentage of RAM_LENGTH, for example 1% rounded to nearest power of 2, with some min/max. So no need to set explicitly for every variant.

Post Reply