esp32 nes code segmentation error

timl12332
Posts: 27
Joined: Wed May 10, 2017 3:05 pm

esp32 nes code segmentation error

Postby timl12332 » Wed May 10, 2017 3:12 pm

Hello everyone,

I got my esp32 dev board and got a ili9341 display and have it all working fine with adafruit librarys.
Now i rewired it for working with the esp32 nes emulator code and all is fine.
But my problem is when i upload the code,
I get this in serial console:

Code: Select all

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0008,len:8
load:0x3fff0010,len:3416
load:0x40078000,len:10388
load:0x40080000,len:252
entry 0x40080034
[0;32mI (703) cpu_start: Pro cpu up.[0m
[0;32mI (703) cpu_start: Starting app cpu, entry point is 0x40080d90[0m
[0;32mI (0) cpu_start: App cpu up.[0m
[0;32mI (712) heap_alloc_caps: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (734) heap_alloc_caps: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM[0m
[0;32mI (755) heap_alloc_caps: At 3FFBB770 len 00024890 (146 KiB): DRAM[0m
[0;32mI (775) heap_alloc_caps: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (796) heap_alloc_caps: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (818) heap_alloc_caps: At 40092DB0 len 0000D250 (52 KiB): IRAM[0m
[0;32mI (838) cpu_start: Pro cpu start user code[0m
[0;32mI (896) cpu_start: Starting scheduler on PRO CPU.[0m
NoFrendo start!
[0;32mI (202) cpu_start: Starting scheduler on APP CsUpi[0mn mux init ...
lcd spi signal init
Hspi config
[0;32mI (944) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 [0m
[0;32mI (944) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 [0m
[0;32mI (951) gpio: GPIO[16]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 [0m
[0;32mI (961) gpio: GPIO[27]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 [0m
No PSX/PS2 controller detected (0xFF). You will not be able to control the game.
Malloc: 916 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/bitmap.c:47
video driver: Simple DirectMedia Layer at 256x224
vid_init done
vid_init done
Malloc: 4 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/nofrendo.c:243
Malloc: 4 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/nofrendo.c:152
system type unknown, playing nofrendo NES intro.
Malloc: 4 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/nofrendo.c:152
Malloc: 824 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/nes/nes.c:511
Malloc: 65283 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/bitmap.c:84
Malloc: 980 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/bitmap.c:47
Malloc: 92 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/nes/nes.c:526
Malloc: 2048 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/nes/nes.c:533
Malloc: 368 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/sndhrdw/nes_apu.c:1002
Malloc: 7608 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/nes/nes_ppu.c:128
Initialized. ROM@0x3f410000
Malloc: 1068 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/nes/nes_rom.c:444
Head: 0x3f410000 (4e 45 53 1a)
Malloc: 8192 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/nes/nes_rom.c:135
GUI: ROM loaded:  [4] 256k/128k H
Malloc: 8 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/nes/nes_mmc.c:241
created memory mapper: MMC3
setting up mapper 4
reset memory mapper
GUI: NES powered on
Malloc: 57347 at C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/bitmap.c:84
ASSERT: line 269 of C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/memguard.c, malloc: out of memory at line 84 of C:/msys32/esp-idf/examples/esp32-nesemu-master/components/nofrendo/bitmap.c.  block size: 57347

Guru Meditation Error: Core  0 panic'ed (Unhandled debug exception)
Debug exception reason: BREAKN instr 
Register dump:
PC      : 0x400f835e  PS      : 0x00060f36  A0      : 0x80083049  A1      : 0x3ffbec40  
A2      : 0x00000000  A3      : 0x0000010d  A4      : 0x3f406b60  A5      : 0x3ffbec60  
A6      : 0x0000e003  A7      : 0x00000000  A8      : 0x800f8380  A9      : 0x3ffbebf0  
A10     : 0x00000000  A11     : 0x3ffb5fc4  A12     : 0x3f406b60  A13     : 0x3ffbec60  
A14     : 0x3ffbeaa0  A15     : 0x00000003  SAR     : 0x00000004  EXCCAUSE: 0x00000001  
EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffc5  

Backtrace: 0x400f835e:0x3ffbec40 0x40083049:0x3ffbec60 0x400fa221:0x3ffbed80 0x400f82cb:0x3ffbeda0 0x400f6d11:0x3ffbedc0 0x400f6d41:0x3ffbede0 0x400f6e3c:0x3ffbee00 0x401088a5:0x3ffbee30 0x400f6ddc:0x3ffbee50 0x400f51aa:0x3ffbee70 0x400d1085:0x3ffbee90

and it keeps looping at this forever.
Now as stated in the code i think it is out of memory and i dont know how to resolve it.
All i did was:

Code: Select all

Make automenu

and change the com port and then save it.

then i did:

Code: Select all

make
and then i did

Code: Select all

make flash
and everything went okay.
then i used the script to write a rom(super mario bros 3) and that went ok too and as you can see in the log it detects it.
But then it gets a segmentation error.
I dont know how to resolve it.

Can anyone help me out?


I hope to hear soon from you,


Thanks

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32 nes code segmentation error

Postby ESP_Sprite » Thu May 11, 2017 1:57 am

Hmm, it's been a while since I touched the emulator, but I think esp-idf just happens to use some more memory since I last worked on it. I'll see if I can fix it today; still have a long-standing wish to add sound support to it anyway.

timl12332
Posts: 27
Joined: Wed May 10, 2017 3:05 pm

Re: esp32 nes code segmentation error

Postby timl12332 » Thu May 11, 2017 6:12 am

thanks!
Could you tell me when it is fixed?

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: esp32 nes code segmentation error

Postby ESP_Sprite » Thu May 11, 2017 10:45 am

Fyi, I have pushed some updates, can you try again?

I also added sound support, but it's not working yet because an update to the I2S driver hasn't made it into esp-idf yet. That should get in in a few days, you can also enable sound in menuconfig then.

I couldn't reproduce your error with the original code, however, so I'm not entirely sure what issue you ran into...

timl12332
Posts: 27
Joined: Wed May 10, 2017 3:05 pm

Re: esp32 nes code segmentation error

Postby timl12332 » Thu May 11, 2017 11:01 am

Okay, thanks.
Will try when i get home.

timl12332
Posts: 27
Joined: Wed May 10, 2017 3:05 pm

Re: esp32 nes code segmentation error

Postby timl12332 » Thu May 11, 2017 7:43 pm

OKay, thanks it works.

Thank you for your help.

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: esp32 nes code segmentation error

Postby rudi ;-) » Fri May 12, 2017 10:25 am

ESP_Sprite wrote:
Fyi, I have pushed some updates...,
... I also added sound support, but it's not working yet because an update to the I2S driver hasn't made it into esp-idf yet. That should get in in a few days, you can also enable sound in menuconfig then....

...
ah :) have not seen this post -
now is clear why :mrgreen:
you "code in future" :mrgreen:

Jeroen, can you say, comes I2S and PDM too or PDM not ready

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

timl12332
Posts: 27
Joined: Wed May 10, 2017 3:05 pm

Re: esp32 nes code segmentation error

Postby timl12332 » Fri May 12, 2017 1:13 pm

thanks! it works

But what rudi says, i get a compiler error when enabling audio and when i remove the I2C ENABLE DAC line it compiles fine but with no audio.
Is that command something that has'nt been added to esp-idf yet?

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: esp32 nes code segmentation error

Postby rudi ;-) » Fri May 12, 2017 1:30 pm

timl12332 wrote:thanks! it works

But what rudi says, i get a compiler error when enabling audio and when i remove the I2C ENABLE DAC line it compiles fine but with no audio.
Is that command something that has'nt been added to esp-idf yet?
thanks for testing audio if you remove I2C enable DAC line and audio is not working :)
so i need not to test this way - i think we must wait for the update on esp-idf for the future work on I2S Enable DAC ,
seams Jeroen used future code that is just in time not available like he described in preview text.

:)

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1698
Joined: Fri Nov 13, 2015 3:25 pm

Re: esp32 nes code segmentation error

Postby rudi ;-) » Fri May 12, 2017 7:32 pm

yeap ;-)
ESP-IDF 2.0 Release online
I2S PDM support
...
best wishes
rudi ;-)

last but not least - now it compiles :)
i2s_set_dac_mode_done.jpg
i2s_set_dac_mode_done.jpg (108.41 KiB) Viewed 11753 times
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: awegel, Bing [Bot], ESP_rrtandler, zelenecul and 107 guests