pschatzmann / arduino-liblame

A simple mp3 encoder (not only) for Arduino using LAME
20 stars 3 forks source link

Out of memory ESP32 #1

Closed dzanis closed 2 years ago

dzanis commented 2 years ago

Thanks for your work with the project. I tried compiling this project to PlatformIO platformio.ini file

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
build_flags = ;-DCORE_DEBUG_LEVEL=5
    -Wl,-Map,output.map
    -DUSE_DEBUG_ALLOC=1
board_build.partitions = partitions.csv
lib_deps = https://github.com/pschatzmann/arduino-liblame.git

Tried to compile it but got a build error xtensa-esp32-elf/bin/ld: region dram0_0_seg overflowed by 6200 bytes

It was decided that it was necessary to disable classes WiFi. And the project compiled with no problem

Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  33.9% (used 111036 bytes from 327680 bytes)
Flash: [======    ]  59.3% (used 777730 bytes from 1310720 bytes)
Building .pio/build/esp32dev/firmware.bin
esptool.py v3.1

But an error pops up when encoding in mp3 after the line mp3.begin(info); I have such an error

MP3: Start encode
==> calloc(1,304) -> 1 [available: 146544]
==> calloc(1,85840) -> 1 [available: 60688]
==> calloc(1,2772) -> 1 [available: 57916]
[Error] lame.c : 2740 - calloc(1,38808) -> 0 [available: 57916]

As I understand it, the mp3 lame encoder needs a lot of memory, but esp32 is simply not able to give so much. It's a pity, I hope this will be solved someday. Thanks again for your work.

pschatzmann commented 2 years ago

After some optimizations it is working now https://www.pschatzmann.ch/home/2021/08/10/an-mp3-encoder-for-arduino/