rossumur / esp_8_bit

Atari 8 bit computers, NES and SMS game consoles on your TV with nothing more than a ESP32 and a sense of nostalgia
1.04k stars 148 forks source link

MALLOC32 FAILED allocation of MEMORY_mem:65540!!!! #4

Open bootrino opened 4 years ago

bootrino commented 4 years ago

Hello I'm trying to run this and I get this error:

esp_8_bit

mounting spiffs (will take ~15 seconds if formatting for the first time)....
... mounted in 99 ms
frame_time:0 drawn:1 displayed:0 blit_ticks:0->0, isr time:0.00%
emu_task atari800 running on core 0 at 240000000mhz
MALLOC32 245608 free, 113792 biggest, allocating Screen_atari:92160
MALLOC32 allocation of Screen_atari:92160 3FFE4374
MALLOC32 153432 free, 64776 biggest, allocating MEMORY_mem:65540
MALLOC32 FAILED allocation of MEMORY_mem:65540!!!!####################
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:9280
load:0x40080400,len:5848
entry 0x40080698

If it helps, this is system information for the esp32 chip:

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:9280
load:0x40080400,len:5848
entry 0x40080698
Internal Total heap 405012, internal Free Heap 379196
SPIRam Total heap 0, SPIRam Free Heap 0
ChipRevision 1, Cpu Freq 240, SDK Version v3.3-beta1-179-ge931fe9f5-dirty
 Flash Size 4194304, Flash Speed 80000000
ps=0x0

I've tried it on 2 different esp32 dev boards but same result each time.

Any suggestions as to what I might be doing wrong?

thanks

bootrino commented 4 years ago

Sorry I only just saw in the source code that I need to "ESP32 Sketch Data Upload" first.

Still not working yet, but please disregard first error in this thread. Onto solving the next5 issue.

bootrino commented 4 years ago

OK so progress made, and some feedback.

It appears that the documentation on the readme page says pin 25 in the schematic but the source code says pin 26.

A suggestion, if there was a a quick start guide that said:

1: Start by doing "esp32 sketch data upload", which uploads needed data to the esp32 built in flash. 2: Check the pin number in src/video_out.h - it must be either pin 25 or pin 26 3: The video cable is the centre pin of the yellow connection on an RCA composite cable - connect this to pin 25 (or pin 26) on the esp32. 4: Connect the outer shield on the yellow cable to one of the ground pins on the esp32

This will get the video displaying.

I managed to get a good clear and stable NTSC signal. I could not however get a stable PAL signal.

I've put a video here showing - sorry its rather long winded. The upshot of it though is that NTSC worked on both TV's and PAL didn't seem to lock in cleanly - on one TV the signal was rolling and on the other TV the signal was stable but did not look right - with lines and a corrupted border.

Here is the YouTube video: https://www.youtube.com/watch?v=LtlMDrhE50c

bootrino commented 4 years ago

Further update - maybe not worth worrying about my PAL issues - I have tried bitluni's composite video on exactly the same hardware and it's janky too - it's not rolling, but it is jumping and tearing a bit. So the problem is possibly my plug and cable setup - somehow the NTSC is OK with that but the PAL doesn't like it. I'll see if somehow I can get a cleaner composite video plug and cable setup and that might clear up the PAL issues.

A question: what sort of PAL TV did you try it on? There might be a clue in there.

Here's images of PAL:

IMG_8942

IMG_5355 IMG_7711 IMG_8725 IMG_9573

gregsadetsky commented 3 years ago

Thanks, I found this thread by googling the same error message.

I received this message using the ESP32 Development Board when using the default #define EMULATOR EMU_ATARI value. I changed it to #define EMULATOR EMU_NES and that worked. Something seems "wrong"/incompatible by default with the Atari emulator and this board, but at least the NES emulator does boot up.

Second point: you mention pin 25 vs. 26, but interestingly enough, that line #define VIDEO_PIN 26 (here) is a red herring -- there is no use of VIDEO_PIN anywhere in the code. The video is rather setup on pin 25 as that pin is the DAC output pin. See here in the code, and this pinout which shows physical pin 14 being GPIO25 and the DAC_1 pin as well. Oof! :-)

For anyone reading/debugging this, what worked for my CRT monitor was the default setting: pin 25 for the video signal and any ground pin on the board. Cheers!

OK1FSX commented 1 year ago

Please can anybody help? I am trying to make CORNN64 project with microSDcard (setting PAL, EMU_ATARI). Without connecting MicroSDcard adapter I can compile and upload everything successfully, it works. But if I connect MicroSD card module with card and enable it in the code, uploading of code ends with "MALLOC32 FAILED allocation of MEMORY_mem:65540" error and rebooting. Older libraries in Arduino IDE or older ArduinoIDE don´t help. I have read, the problem is concerning esp_heap_caps.h or multi_heap.h libraries and bad allocation of memory, but I don´t know how to fix it. By the way, I cannot find sources (.c) of these libraries in ArduinoIDE to edit. Where are these sources? Headers (.h) are present but sources not. Thanks.

EmVee381 commented 1 year ago

Please can anybody help? I am trying to make CORNN64 project with microSDcard (setting PAL, EMU_ATARI). Without connecting MicroSDcard adapter I can compile and upload everything successfully, it works. But if I connect MicroSD card module with card and enable it in the code, uploading of code ends with "MALLOC32 FAILED allocation of MEMORY_mem:65540" error and rebooting. Older libraries in Arduino IDE or older ArduinoIDE don´t help. I have read, the problem is concerning esp_heap_caps.h or multi_heap.h libraries and bad allocation of memory, but I don´t know how to fix it. By the way, I cannot find sources (.c) of these libraries in ArduinoIDE to edit. Where are these sources? Headers (.h) are present but sources not. Thanks.

as i am playing with this project also, it is everything mostly around memory :) if you dont use buetooth then comment out hid* functions in main.cpp, you will save memory and you will pass to next level of this game :)))