(Sram) Memory shortage of arduino

Hi I am developing a car interface with 3.5" nextion hmi. Many functions on car will be controlled by nextion hmi and arduino so I have to add and define about 100 components(button , slider , picture vs).
I have to use arduino pro mini(sram=2kb) , nano(sram=2kb) or genuino micro (sram=2.5kb)

I can't use Arduino mega because of measurements.

Is there a way to reduce library size?

I uploaded my sketch to check.

Thanks

hmi_ana_mod_l.ino (8.21 KB)

I don't think libraries are consciously built to abuse memory usage... (Although this one uses Strings objects for sending commands which is probably a bad idea)

given that you are planing to use a lot of components (100 is a lot of components for small memory devices) I Would advise to not pre-create all the objects and only instantiate on demand and free up memory as you don't need them for display anymore.

J-M-L has good advice for you.

Also, you have access to library source code so you may modify it any way that you want, including saving space by deleting unused functions and variables.

I think his issue is SRAM not flash - deleting code won't help and compiler optimizes a few things for you anyway

How about a '1284P? 128k flash, 16k sram, not much bigger than the nano. Plug on a ftdi basic to download code/debug, pull off for fielding.

Most flash usage becomes SRAM usage. There are exceptions, with the F(...) macro being one of them.

vaj4088:
Most flash usage becomes SRAM usage.

Huh?

vaj4088:
Most flash usage becomes SRAM usage. There are exceptions, with the F(...) macro being one of them.

Most what?

I can see that I confused people. I did not mean to. I am the one that is/was confused.

Data gets copied from flash memory to SRAM as part of Arduino initialization. My confusion was posting (INCORRECTLY!) that machine code also gets copied.

Please ignore my previous post. Some flash usage becomes SRAM usage, but not necessarily most.

I can't use Arduino mega because of measurements.

It is my opinion that it is just silly not to move to an appropriate uC environment because of physical board size... the small-footprint boards are everywhere.

There are several YouTube videos showing the Nextion working with Teensy.

Teensy

Ray