From: Andrew Hutchings Date: Sat, 1 May 2021 06:48:42 +0000 (+0100) Subject: Cleanup warnings and LinuxJedi's docs X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=007b35ae52d617b947dd5522f1797ef49e2da9b7;p=pistorm Cleanup warnings and LinuxJedi's docs This branch: * Adds information on modifying the systemd script provided in boot_scripts * Adds documentation for the newest options on the PiStorm gui * Fixes a memory leak and a potential crash on alloc failure for the gui * Minor text changes in the gui * Fixes minor compiler warnings for the PiSimple CLI (both for GCC and VBCC) --- diff --git a/boot_scripts/README.md b/boot_scripts/README.md index 9156a82..e12a598 100644 --- a/boot_scripts/README.md +++ b/boot_scripts/README.md @@ -2,13 +2,59 @@ ## Bootup script +For your convience a startup script for systemd in Linux is located in this directory. This script will start PiStorm *before* the network connections have started. + +### Installation + To start PiStorm on automatically on boot, copy `pistorm.service` into /etc/systemd/system/ in your Pi's filesystem. Then run: ```bash sudo systemctl enable pistorm ``` +### Customisation + +There are some things you may want to change in the systemd script. These instructions will help with that. + +#### Custom config + +If you wish to boot using a custom configuration file change `ExecStart` to: + +```ini +ExecStart=/home/pi/pistorm/emulator --config-file myconfig.cfg +``` + +Where `myconfig.cfg` is your config file in the `pistorm` directory. If your config file is somewhere else you will need to put the full path for it there. + +**NOTE:** do not put an '=' between `--config-file` and the file name, this will not work. + +#### Different location + +You may want to run your PiStorm from a different location than `/home/pi/pistorm` this is fine, but it is important that the files that come with the emulator stay together in the same directory structure. For example, if you moved pistorm to `/opt/pistorm` you will need to change the following two lines: + +```ini +ExecStart=/opt/pistorm/emulator +WorkingDirectory=/opt/pistorm +``` + +It is important both lines are changed otherwise this can cause issues, particularly crashes. + +#### Startup order -This script will start PiStorm *before* the network connections have started. +If, for example, your PiStorm configuration depends on something like Samba running for PiScsi you will want to change the startup order so the PiStorm waits for that to run. In the `[Unit]` second add something like the following example: + +```ini +After=network.target samba.service +``` + +Please see the systemd documentation for more informatino on this. + +### Applying changes + +If you have made any changes to the `pistorm.service` file *after* it has been copied over you will need to reload the systemd configuration for the changes to be seen. This can be done with: + +```bash +sudo systemctl daemon-reload +``` ## Faster boot diff --git a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/PiSimple b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/PiSimple index 0d413a9..f3c265d 100755 Binary files a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/PiSimple and b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/PiSimple differ diff --git a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/PiStorm b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/PiStorm index 4150c04..d195961 100755 Binary files a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/PiStorm and b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/PiStorm differ diff --git a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/README.md b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/README.md index 7eb507f..de07a50 100644 --- a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/README.md +++ b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/README.md @@ -1,4 +1,4 @@ -# PiStorm Interaction Tool +# PiStorm Interaction Tools ## Cross-Compiling @@ -35,3 +35,13 @@ You can copy a file from the PiStorm to the Amiga. First of all, type in the fil ### Reboot Reboots the Amiga (not PiStorm). + +### Kickstart file + +This will let you choose a Kickstart ROM file on the Pi to boot from. As with Config gile, you can type the name of the Kickstart ROM file relative to the PiStorm's execution directory and hit "Commit". If the Kickstart ROM file is valie the PiStorm will load it in and the Amiga will immediately reboot. + +**NOTE:** Instead of rebooting the Amiga may crash here. This would be due to an interrupt trying to access an old ROM position in the new ROM file before the reboot could execute. You can resolve this by manually doing a Ctrl-A-A reboot. + +### Shutdown Pi + +When pressing this button and confirming, the Pi will safely shutdown the underlying Linux OS. When this happens the Amiga will essentially hang as it will be as if the CPU has been removed. There will be no indication that the Pi shutdown has completed so it is probably wise to wait 10-15 seconds before removing power if this option is used. diff --git a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/build.sh b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/build.sh old mode 100644 new mode 100755 diff --git a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/gui_interact.c b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/gui_interact.c index 789f4d8..6ceff07 100644 --- a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/gui_interact.c +++ b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/gui_interact.c @@ -19,7 +19,7 @@ extern unsigned int pistorm_base_addr; struct ReqToolsBase *ReqToolsBase; -#define VERSION "v0.3" +#define VERSION "v0.3.1" #define button1w 54 #define button1h 11 @@ -212,7 +212,7 @@ struct Gadget RebootButton = &RebootButton_text, 0, NULL, GADREBOOT, NULL }; -UBYTE StatusBar_buf[128] = "PiStorm..."; +UBYTE StatusBar_buf[128] = "Reticulating splines..."; struct IntuiText StatusBar_text = { @@ -485,9 +485,11 @@ static char *GetSavePath() else { rtEZRequest("Out of memory!", "Oh no!", NULL, NULL); + return NULL; } strncpy(fullpath, (char*)filereq->Dir, 256); + rtFreeRequest((APTR)filereq); return fullpath; } @@ -533,6 +535,10 @@ int main() no_board = TRUE; WriteGadgetText("PiStorm not found", StatusBar_buf, myWindow, &StatusBar); } + else + { + WriteGadgetText("PiStorm found!", StatusBar_buf, myWindow, &StatusBar); + } if (!no_board) { updateRTG(myWindow); diff --git a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/pistorm_dev.c b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/pistorm_dev.c index 10cc3fa..e21bdcb 100644 --- a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/pistorm_dev.c +++ b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/pistorm_dev.c @@ -12,8 +12,6 @@ #include #include -#include - #include #include #include @@ -44,8 +42,8 @@ unsigned short short_val; unsigned int pi_find_pistorm() { unsigned int board_addr = 0xFFFFFFFF; - struct ExpansionBase *expansionbase = (struct ExpansionBase *)OpenLibrary("expansion.library", 0L); - + struct ExpansionBase *expansionbase = (struct ExpansionBase *)OpenLibrary((STRPTR)"expansion.library", 0L); + if (expansionbase == NULL) { #ifdef HAS_STDLIB printf("Failed to open expansion.library.\n"); diff --git a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/simple_interact.c b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/simple_interact.c index 969cebf..2a07fe8 100644 --- a/platforms/amiga/pistorm-dev/pistorm_dev_amiga/simple_interact.c +++ b/platforms/amiga/pistorm-dev/pistorm_dev_amiga/simple_interact.c @@ -18,8 +18,6 @@ #include #include -#include - #include #include #include @@ -110,7 +108,7 @@ int __stdargs main (int argc, char *argv[]) { if (dest == NULL) { printf ("Failed to allocate memory buffer for file. Aborting file transfer.\n"); } else { - printf ("Found a %d byte file on the Pi side. Eating it.\n", filesize); + printf ("Found a %u byte file on the Pi side. Eating it.\n", filesize); if (pi_transfer_file(argv[2], dest) != PI_RES_OK) { printf ("Something went horribly wrong during the file transfer.\n"); } else { @@ -120,7 +118,7 @@ int __stdargs main (int argc, char *argv[]) { } else { fwrite(dest, filesize, 1, out); fclose(out); - printf ("%d bytes transferred to file %s.\n", filesize, argv[3]); + printf ("%u bytes transferred to file %s.\n", filesize, argv[3]); } } free(dest);