drorgl / esp32-tinyemu

A fork to Fabrice Bellard's TinyEmu ported to ESP32
MIT License
51 stars 14 forks source link

Cannot get Linux to boot #2

Closed meltdown03 closed 2 years ago

meltdown03 commented 2 years ago

I used the premade buildroot file from the readme file. I had to tweak the name of the bin file in the root-riscv32.cfg file to get it to do anything, but it gets to this line and then just sits:

writing jump address ram ptr: 0x0 phy: 0x0x0

I'm guessing I am missing a step somewhere.

The entire output is here (I was actually able to get it working on the my ESP32-S3, but it did the same thing on my ESP32):

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x2a (SPI_FAST_FLASH_BOOT)
Saved PC:0x4203f6b6
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x1324
load:0x403b6000,len:0xb34
load:0x403ba000,len:0x2e10
entry 0x403b6230
I (24) boot: ESP-IDF 4.4.1 2nd stage bootloader
I (25) boot: compile time 08:59:23
I (25) boot: chip revision: 0
I (26) boot.esp32s3: Boot SPI Speed : 80MHz
I (31) boot.esp32s3: SPI Mode       : DIO
I (36) boot.esp32s3: SPI Flash Size : 8MB
I (40) boot: Enabling RNG early entropy source...
I (46) boot: Partition Table:
I (49) boot: ## Label            Usage          Type ST Offset   Length
I (57) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (64) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (72) boot:  2 factory          factory app      00 00 00010000 00100000
I (79) boot: End of partition table
I (83) esp_image: segment 0: paddr=00010020 vaddr=3c050020 size=0a8d8h ( 43224) map
I (99) esp_image: segment 1: paddr=0001a900 vaddr=3fc914e0 size=01ffch (  8188) load
I (102) esp_image: segment 2: paddr=0001c904 vaddr=40374000 size=03714h ( 14100) load
I (112) esp_image: segment 3: paddr=00020020 vaddr=42000020 size=42708h (272136) map
I (166) esp_image: segment 4: paddr=00062730 vaddr=40377714 size=09dc4h ( 40388) load
I (175) esp_image: segment 5: paddr=0006c4fc vaddr=50000200 size=00010h (    16) load
I (181) boot: Loaded app from partition at offset 0x10000
I (181) boot: Disabling RNG early entropy source...
I (195) opi psram: vendor id : 0x0d (AP)
I (195) opi psram: dev id    : 0x02 (generation 3)
I (196) opi psram: density   : 0x03 (64 Mbit)
I (199) opi psram: good-die  : 0x01 (Pass)
I (204) opi psram: Latency   : 0x01 (Fixed)
I (209) opi psram: VCC       : 0x01 (3V)
I (213) opi psram: SRF       : 0x01 (Fast Refresh)
I (219) opi psram: BurstType : 0x01 (Hybrid Wrap)
I (224) opi psram: BurstLen  : 0x01 (32 Byte)
I (229) opi psram: Readlatency  : 0x02 (10 cycles@Fixed)
I (235) opi psram: DriveStrength: 0x00 (1/1)
W (240) PSRAM: DO NOT USE FOR MASS PRODUCTION! Timing parameters will be updated in future IDF version.
I (251) spiram: Found 64MBit SPI RAM device
I (255) spiram: SPI RAM mode: sram 80m
I (260) spiram: PSRAM initialized, cache is in normal (1-core) mode.
I (267) cpu_start: Pro cpu up.
I (270) cpu_start: Starting app cpu, entry point is 0x40375d00
I (0) cpu_start: App cpu up.
I (683) spiram: SPI SRAM memory test OK
I (693) cpu_start: Pro cpu start user code
I (693) cpu_start: cpu freq: 240000000
I (693) cpu_start: Application information:
I (696) cpu_start: Project name:     esp32-tinyemu
I (701) cpu_start: App version:      ee5e244-dirty
I (707) cpu_start: Compile time:     Jul 23 2022 08:57:39
I (713) cpu_start: ELF file SHA256:  1f4f3d5acb5ce31e...
I (719) cpu_start: ESP-IDF:          4.4.1
I (723) heap_init: Initializing. RAM available for dynamic allocation:
I (731) heap_init: At 3FC945A8 len 0004BA58 (302 KiB): D/IRAM
I (737) heap_init: At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM
I (744) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (750) heap_init: At 600FE000 len 00002000 (8 KiB): RTCRAM
I (756) spiram: Adding pool of 8192K of external SPI memory to heap allocator
I (764) spi_flash: detected chip: gd
I (768) spi_flash: flash io: dio
I (773) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (793) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (793) SD: Using SPI peripheral
I (803) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (813) sdspi_transaction: cmd=52, R1 response: command not supported
I (853) sdspi_transaction: cmd=5, R1 response: command not supported
Name: SD128
Type: SDHC/SDXC
Speed: 20 MHz
Size: 122344MB
Loading 0
Setting up UART Console
Registering RAM 0x80000000: 134217728 bytes
Registering RAM Entry 0x80000000 134217728 bytes
creating vmm /sdcard/emu/pagefile0x80000000.bin size: 134217728, page: 8192, pages: 380, total: 3112960
Registered RAM 0x80000000: 134217728 bytes at 0x0x0
Registering RAM 0x0: 65536 bytes
Registering RAM Entry 0x0 65536 bytes
creating vmm /sdcard/emu/pagefile0x0.bin size: 65536, page: 8192, pages: 200, total: 1638400
Registered RAM 0x0: 65536 bytes at 0x0x0
Registering CLINT
Registering Device at 0x2000000 786432 bytes
Registering PLIC
Registering Device at 0x40100000 4194304 bytes
Registring HTIF
Registering Device at 0x40008000 16 bytes
Registering VIRTIO Page Size
Registering Device at 0x40010000 4096 bytes
Registering VIRTIO Page Size
Registering Device at 0x40011000 4096 bytes
copied bios from bbl32.bin to 0x0 53730 bytes
copied kernel from kernel-riscv32.bin to 0x400000 3253116 bytes
building fdt
fdt dst 0x1040
writing jump address ram ptr: 0x0 phy: 0x0x0
drorgl commented 2 years ago

Its hard to know by this log, to debug it I've used more verbose logging and even then it was hard to figure out problems.

I've just uploaded my working binaries in the buildroot-tinyemu project, please try them first before trying other configurations.

Note your SD card is mounted as 20Mhz, this will slow things down a bit.

Name: SD128 Type: SDHC/SDXC Speed: 20 MHz Size: 122344MB

meltdown03 commented 2 years ago

Its hard to know by this log, to debug it I've used more verbose logging and even then it was hard to figure out problems.

I've just uploaded my working binaries in the buildroot-tinyemu project, please try them first before trying other configurations.

Note your SD card is mounted as 20Mhz, this will slow things down a bit.

Name: SD128 Type: SDHC/SDXC Speed: 20 MHz Size: 122344MB

The binaries work for my OG ESP32 which I use the SPI method for SD mounting which for some reason I can only run at 5MHz max! Otherwise, I get errors. But it works! On my ESP32-S3 (I used the emulated himem and 20MHz SPI SD) it still doesn't. If I get it to work, do you want me to do a PR?

meltdown03 commented 2 years ago

Ok, I got it working on the S3, and it's faster, about 53 seconds to get to the last kernel message. I was using the USB port and not the UART one, so it may have been working before.

drorgl commented 2 years ago

The binaries work for my OG ESP32 which I use the SPI method for SD mounting which for some reason I can only run at 5MHz max! Otherwise, I get errors. But it works! On my ESP32-S3 (I used the emulated himem and 20MHz SPI SD) it still doesn't. If I get it to work, do you want me to do a PR?

Sure. PRs welcome.

It could be noise/parasitics issues, breadboards are notorious for that, try to use short, direct wires.