captain-amygdala / pistorm

68k Hardware Emulator
MIT License
748 stars 105 forks source link

--config-file option does not seem to be implemented in pistorm32 branch #66

Open TonyHoyle opened 1 year ago

TonyHoyle commented 1 year ago

--config-file option does not work.

in boot_scripts/README.md the documentation states:

If you wish to boot using a custom configuration file change ExecStart to:

ExecStart=/home/pi/pistorm/emulator --config-file myconfig.cfg

This does not seem to be implemented currently in the pistorm32 branch.. instead it tries to open a file called '--config-file' instead and crashes.

root@pistorm:/opt/pistorm# /opt/pistorm/emulator --config-file config/pistorm.cfg FPGA Firmware : --config-file Segmentation fault

Or, via strace:

fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(0x88, 0), ...}) = 0 write(1, "FPGA Firmware : --config-file\n", 30FPGA Firmware : --config-file ) = 30 openat(AT_FDCWD, "--config-file", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} --- +++ killed by SIGSEGV +++ Segmentation fault

It's possible the documentation is out of date and there is a different command?

LemaruX commented 1 year ago

As a workaround, if you call your config default.cfg then you don't need to specify it at all.

On Sat, 18 Mar 2023, 16:57 Tony Hoyle, @.***> wrote:

--config-file option does not work.

in boot_scripts/README.md the documentation states:

If you wish to boot using a custom configuration file change ExecStart to:

ExecStart=/home/pi/pistorm/emulator --config-file myconfig.cfg

This does not seem to be implemented currently in the pistorm32 branch.. instead it tries to open a file called '--config-file' instead and crashes.

@.***:/opt/pistorm# /opt/pistorm/emulator --config-file config/pistorm.cfg FPGA Firmware : --config-file Segmentation fault

Or, via strace:

fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(0x88, 0), ...}) = 0 write(1, "FPGA Firmware : --config-file\n", 30FPGA Firmware : --config-file ) = 30 openat(AT_FDCWD, "--config-file", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} --- +++ killed by SIGSEGV +++ Segmentation fault

It's possible the documentation is out of date and there is a different command?

— Reply to this email directly, view it on GitHub https://github.com/captain-amygdala/pistorm/issues/66, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIHEVTDFZFXSNCZX26W6SELW4XSPXANCNFSM6AAAAAAV7SHZAI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Guddler commented 1 year ago

@TonyHoyle I don't know what the official answer is but I suspect someone modified emulator and didn't update the documentation? It seems to want the name of the firmware as the 1st parameter when supplying options. Since the default firmware appears to be 'bitstream.bin', the following worked for me

./emulator bitstream.bin --config ../amiga.cfg

[EDIT]

Yep, emulator.c in main:

  if (argc < 2)
   {
        printf("Loading default FPGA Firmware file bitstream.bin\n");
        filename = "bitstream.bin";
        //return(1);
   }
   else
  {
        filename = argv[1];
        printf("FPGA Firmware : %s\n", filename);
   }

This is different to main branch, so it's a difference in documentation between main and PiStorm32 Lite. Lite always needs the bitstream as the 1st command line argument, unless running with no command line options.