https://toitlang.org/ logo
Firmware is "too big" to fit on ESP32C6 - the echo...
# help
a
k
Do you know which partition layout you're using here?
The OTA partitions are 1,703,936 bytes, so that seems to fit.
Are you building a debug build by any chance?
f
Did you maybe enable a big module in the sdkconfig?
a
apparently I made a mistake somewhere but now the issue is gone when i re-ran make and flashed the envelope in build/esp; Thanks all!
@floitsch @kasperl Hi, I ran into the same issue again however it seems legit now; i am trying to deploy an edge ML model (it worked with native esp idf environment) based on the custom enevlope template you have on github; the build result was just slighly over the limit to fit onto an esp32c6 board (1745120 > 1703936); i wonder if there's a way to squeeze that further (perhaps via a compiler option?)
f
You could also just use a different partition table.
k
You can also change the partition layout and give yourself some more space? @floitsch may have a recipe for you 🙂
What Florian said.
a
how can i do that?
f
Also, you can disabled code that you don't use. (Like, for example, BLE, FAT support, ...)
Since you are already using a custom envelope, you can just modify the partition-table in it.
The
make init
copied over a partition table file (
partitions.csv
).
You can either modify that, or download the OTA-1C0000 one from here: https://github.com/toitlang/envelopes/tree/main/partitions/esp32/ota-1c0000
a
That worked, thanks!, how do i disable functionalities in toit? (i,e, i2c, spi, ....) I am planning to use another i2c implementation in the c code and that seems to interfer with the current toit implementation
f
I think I was wrong there. There is currently no support to disable "crucial" peripherals. We should probably add sdkconfig options.
Some already have (like espnow, ethernet, fatfs) and these can be changed in the sdkconfig file.
Are you running into the issue that your code uses the new I2C driver and Toit uses the old one? (Espressif rewrote a lot of their drivers).
a
not sure tbh the cause of that but when i use my i2c code (it's the arduino one) and flash it onto the mcu, the device continues rebooting
f
Do you have any output?
a
yes let me just find that
f
Yes. That's the error.
You have three options: - use the old API for now (but that would probably require an older Arduino version). - patch the Toit SDK file - wait until I upgraded the I2C driver. The simplest is to just patch the SDK file: https://github.com/toitlang/toit/blob/ad90af0e51ca51da14de5f01cbb58adbd19ef5d1/src/resources/i2c_esp32.cc#L18 Just change that to
#if 0
and the i2c could won't be compiled anymore. I think you can just change your local file in the
toit
folder.
I have plans to update the driver, but I can't tell when I will find the time for it.
It's the next driver I will update, but it might still take a few weeks.
a
do you mean i change the entire i2c_esp32.cc code into #if 0 ?
f
No. Just the
#ifdef TOIT_ESP32
into
#if 0
.
(line 18).
a
Hi, that didn't help unfortunately. I am currently trying to access the sensor via its toit driver (it's the LIS3DH), using the provided examples on github: https://github.com/nilwes/LIS3DH.git; wierdly enough all examples cause the device to crash and reboot, i tried even flashing it out in a fresh jaguar environment but the issue still persists; any ideas? could that be the reason why the crash happened when i accessed the sensor in the enevlope c app?
f
Aah. I see the issue now.
So the error message is about the RMT driver.
Basically, the esp-idf checks at boot if the firmware contains more than one driver for their peripherals.
At the moment it complains about the RMT driver (
E (399) rmt(legacy): CONFLICT! driver_ng is not allowed to be used with the legacy driver
.
So that wasn't a complaint about the i2c driver, but the RMT driver.
a
ah lemme try disabling that then
f
You can just disable it in the rmt_esp32.c file.
It's not clear if you can reenable the i2c.
I think the esp-idf just goes through the drivers one by one, and RMT was the first one to be hit.
I would expect that you need to disable most of the peripherals for Toit.
I have already migrated ADC, and i2s. So those should be ok.
A bit unfortunate that you can't use the Toit level for the sensor. We do have a driver for it.
Would it make sense to just migrate to Toit, or is your Arduino code using things for which there doesn't exist a Toit driver yet?
a
well weirdly enough now by just disabling rmt (and keeping all other perfs intact) the enevlope worked, however I am getting this: , what do you think? https://cdn.discordapp.com/attachments/1341407586414493821/1342165614806171710/message.txt?ex=67b8a4a2&is=67b75322&hm=3df2ee5645c39c5ce083b4f24802803bf6d9340976cfa0d553944627d0c71100&
this is what I'll be working on next actually
f
That's a safe guard so that Toit code doesn't use the wrong new. The linking probably made it apply to Arduino code as well.
I need to run now, but I will try to explain later. Hopefully with a work around
a
no worries, is there a way to disable it?
f
Yes. That would be the workaround
a
Hey I did try setting "throwing_new_allowed" true in top.cc and now it's working! thanks for pointing it out
f
So the problem is, that Toit does garbage collection. However, it doesn't do it when new and malloc fail. So if your code encounters OOMs you have to call the Toit GC and try again. You could, in theory, patch the
new
that caused problems and do that automatically (after all, we were not allowed to call it), but it wouldn't do anything for
malloc
calls.