guild icon
Toit
#๐Ÿ›  Remaining memory
Thread channel in help
Arubinu
Arubinu 04/28/2025 03:44 PM
Is there a way to get feedback on how much space is still available (taking into account a safety margin for operation if possible)?

I haven't found anything other than the amount of KB the program is taking up.
floitsch
floitsch 04/28/2025 03:50 PM
This space is the flash on the device.
You typically want to look at the partition table to know how much space you have for the OTA image, and then for the installed apps.
floitsch
floitsch 04/28/2025 03:51 PM
This is the default partition table when using Jaguar.
https://github.com/toitlang/toit/blob/master/toolchains/esp32/partitions.csv
Program your microcontrollers in a fast and robust high-level language. - toitlang/toit
floitsch
floitsch 04/28/2025 03:51 PM
Note that partition tables can not be updated OTA (except with some hacks). So choosing the correct one when flashing is important.
floitsch
floitsch 04/28/2025 03:51 PM
The correct partition table depends a lot on your use case.
floitsch
floitsch 04/28/2025 03:53 PM
If you bundle your programs with the system, then having a bigger ota_0 and ota_1 is important (which is why Artemis uses the partitions-esp32-ota-1c0000.csv by default (an asset of the envelopes repository https://github.com/toitlang/envelopes/releases/tag/v2.0.0-alpha.179)
floitsch
floitsch 04/28/2025 03:53 PM
Jaguar, on the other hand, writes programs into the programs partition, and thus doesn't need a bigger ota_0/ota_1 partition.
floitsch
floitsch 04/28/2025 03:54 PM
If you store data (sensor values...) in flash, you might have additional constraints.
floitsch
floitsch 04/28/2025 03:55 PM
In addition, the system firmware's size can vary a lot depending on the features that are enabled. For example, the no-ble (without Bluetooth) envelope will use less space than one that includes BLE.
floitsch
floitsch 04/28/2025 03:55 PM
And to answer your actual question: I think Jaguar doesn't have a way to know the size of installed programs yet.
floitsch
floitsch 04/28/2025 03:56 PM
The default programs partition is 655360 bytes.
floitsch
floitsch 04/28/2025 03:57 PM
That said: normally you don't want to ship programs with Jaguar, but with Artemis (or your own OTA solution). So for Jaguar I wouldn't worry for the size yet.
floitsch
floitsch 04/28/2025 03:57 PM
Things only get interesting when you switch from Jaguar to your deployement solution.
Arubinu
Arubinu 04/28/2025 04:01 PM
I use Jag directly, but it's mainly to know how close I am to the limit ^^
I saw the story of the no-ble, I'll keep that in mind if I'm ever on the edge, thank you.

I thought Artemis would take up more memory, and I don't need it. Once my program is complete, I won't be touching it again for a long time.
My current use is for my home automation via MQTT, since I use Zigbee2MQTT. Currently, I control the devices in my bedroom with an IKEA STYRBAR switch. But eventually, if there's no lag and enough memory, I'll install all the switches in the house.
I'd find it amusing to know that the whole house is controlled by such a small device :๐Ÿคฃ:
Arubinu
Arubinu 04/28/2025 04:02 PM
My code will be released on GitHub if I find it sufficiently complete, and I'll post the link here if anyone is interested.
I'm trying to do this as cleanly as possible using classes :๐Ÿ˜:
floitsch
floitsch 04/28/2025 04:05 PM
I wouldn't worry about the size just yet. You have 4MB of flash, and there are many knobs to tune the system.
However, the partition table is pretty much the only thing you can't change OTA, so before you put your device in an inaccessible location you need to think about the correct partition table.
floitsch
floitsch 04/28/2025 04:05 PM
I have a few shelly devices inside my light switches, and I really don't want to take them out again.
floitsch
floitsch 04/28/2025 04:05 PM
In that case I made sure that I have a partition table that allows me to grow the system over time.
floitsch
floitsch 04/28/2025 04:06 PM
Off-topic: I would avoid the term "memory" when referring to flash, as "memory" is usually used for the RAM.(edited)
Arubinu
Arubinu 04/28/2025 04:08 PM
I understand, but my ESP will be directly in my home automation bay and therefore accessible even for reprogramming (everything goes through MQTT), via a simple USB cable.
For the term I understand, so the appropriate term would be "flash memory"?
floitsch
floitsch 04/28/2025 04:14 PM
Or just "flash".
floitsch
floitsch 04/28/2025 04:15 PM
If you have easy access to your device, don't worry about program size. You will be able to fix things if you really run into size issues.
๐Ÿ™1
23 messages in total