{"id":22869020,"url":"https://github.com/jbilander/simpledevice","last_synced_at":"2025-05-05T20:26:27.666Z","repository":{"id":137347352,"uuid":"293490279","full_name":"jbilander/SimpleDevice","owner":"jbilander","description":"Amiga Simple Device driver skel in C using Bebbo's or Bartman's gcc","archived":false,"fork":false,"pushed_at":"2020-09-07T14:12:26.000Z","size":1118,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T20:26:07.978Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jbilander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-07T10:02:13.000Z","updated_at":"2025-01-10T03:55:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"3581e825-e645-4e11-a3fa-e6a9da4f7cbf","html_url":"https://github.com/jbilander/SimpleDevice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbilander%2FSimpleDevice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbilander%2FSimpleDevice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbilander%2FSimpleDevice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbilander%2FSimpleDevice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbilander","download_url":"https://codeload.github.com/jbilander/SimpleDevice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252569748,"owners_count":21769533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-13T12:44:54.545Z","updated_at":"2025-05-05T20:26:27.660Z","avatar_url":"https://github.com/jbilander.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Amiga SimpleDevice\nAmiga Simple Device driver skel in C using Bebbo's or Bartman's gcc.\n***\nThis example shows you how to build a simple device driver for the Amiga in C with a modern cross compile gcc-toolchain for the Amiga using VSCode as IDE. Driver should work with 1.3 and above. I haven't tested with older versions.\n***\nThe `Makefile` is made to work with both `Bebbo's amiga-gcc toolchain` as well as `Bartman^Abyss' amiga-elf gcc toolchain`. Currently it is set by default to Bebbo's toolchain, but you can easily switch by commenting out `hunk-toolchain` and uncomment `elf-toolchain` in the Makefile. Obviously you need to install \"your\" prefered toolchain for it to work and set the correct path to compiler and some settings in .vscode for intellisense and compilation to work. The Makefile should also work with Bartman's `gnumake.exe` running natively on Windows as well as `make` working on MSYS2 and on Linux. The `device.c` is only made to compile with Bebbo's toolchain since it is using register assignments to function parameters, no such thing exists in the elf-toolchain but you can work around it using inline asm should you want to try out building with the elf-toolchain instead. The `Makefile` is also set to automatically disassemble the build so that the assembly generated can easily be inspected. If you are using the elf-toolchain and have Bebbo's toolchain installed as well you can uncomment the `m68k-amigaos-objdump -D $(DIR)/$(FILENAME) \u003e $(DIR)/$(FILENAME).s` line and you will have an disassembly of the executable hunk-file generated after the `elf2hunk` step as well.\n***\nThe Makfile is set to delete and recompile the executable if any source files `(%.c or %.s)` have been touched before running `make`. Just comment out the `@$(DEL_EXE)` on both `%.c and %.s` if you don't want it to work this way.\n***\n### Some screenshots:\nOn Windows with MSYS2:\n\u003cbr /\u003e\n\u003ca href=\"images/VSCode_on_windows_with_MSYS2.jpg\"\u003e\n\u003cimg src=\"images/VSCode_on_windows_with_MSYS2.jpg\" width=\"577\" height=\"366\"\u003e\n\u003c/a\u003e\n\u003cbr /\u003e\n\nOn Linux Mint:\n\u003cbr /\u003e\n\u003ca href=\"images/VSCode_on_linux.jpg\"\u003e\n\u003cimg src=\"images/VSCode_on_linux.jpg\" width=\"577\" height=\"369\"\u003e\n\u003c/a\u003e\n***\n`settings.json` in .vscode for linux would be something like this:\n```\n   {\n      \"terminal.integrated.env.linux\": {\n        \"PATH\": \"/opt/amiga/bin:${env:PATH}\"\n      },\n   }\n```\nand `c_cpp_properties.json` something like this:\n```\n\"includePath\": [\n    \"${workspaceFolder}/**\",\"/opt/amiga/m68k-amigaos/ndk-include\"\n],\n\"compilerPath\": \"/opt/amiga/bin/m68k-amigaos-gcc.exe\",\n```\n***\n\n### Make commands:\n* build debug: `make debug`  (This creates a folder `build-debug` with all the build-files in it, compiles with debug-flags set)\n* build release: `make`  (This creates a folder `build-release` with all the build-files in it, compiles with release-flags set)\n* clean debug: `make cleandebug`\n* clean release: `make cleanrelease`\n* clean both: `make clean`\n\n***\n\n### \"Debug\" with KPrintF in methods running in Forbidden mode by Exec:\nAs you might know `Init_Device/Open/Close/Expunge` runs single threaded by Exec, no other task is allowed to run in this mode so no writing to a dos-console possible as it would mean deadlock to occur, however with the `debug.lib (libdebug.a)` linked into our build (with `-ldebug -mcrt=clib2`) it is possible to get `KPrintF`-statements out on the serial port terminal. Good thing is WinUAE has an option to emulate the serial terminal of the Amiga and then we can use telnet to connect to it with the command `telnet localhost 1234`\n\nEnable WinUAE serial port on 1234, and open a cmd-prompt and write the telnet command (obviously you'll need telnet installed first via `Control Panel-\u003eProgram and Features-\u003eTurn windows features on/off)`.\n\u003cbr /\u003e\n\u003cbr /\u003e\n\u003ca href=\"images/telnet_to_WinUAE_emulated_serial_port.jpg\"\u003e\n\u003cimg src=\"images/telnet_to_WinUAE_emulated_serial_port.jpg\" width=\"577\" height=\"319\"\u003e\n\u003c/a\u003e\n***\nFor conveniency, do also map the Project folder in WinUAE so we easily can copy our newly built device driver over to the emulated Amiga:\n\u003cbr /\u003e\u003cbr /\u003e\n\u003ca href=\"images/project_folder_mapped_as_drive_in_WinUAE.jpg\"\u003e\n\u003cimg src=\"images/project_folder_mapped_as_drive_in_WinUAE.jpg\" width=\"577\" height=\"432\"\u003e\n\u003c/a\u003e\n***\nWith dopus on the Amiga you can copy the `simple.device` into `devs`.\n\u003cbr /\u003e\u003cbr /\u003e\n\u003ca href=\"images/project_folder_shown_in_dopus.jpg\"\u003e\n\u003cimg src=\"images/project_folder_shown_in_dopus.jpg\" width=\"577\" height=\"493\"\u003e\n\u003c/a\u003e\n\u003cbr /\u003e\u003cbr /\u003e\n\u003ca href=\"images/copy_driver_to_devs_with_dopus.jpg\"\u003e\n\u003cimg src=\"images/copy_driver_to_devs_with_dopus.jpg\" width=\"577\" height=\"493\"\u003e\n\u003c/a\u003e\n***\nTo load the device we need a device list with the Device entry pointing to our name of the file `simple.device`, I'll use a `SD0`-file here made in `Devs` as a dummy to see if it will work to load the driver, Exec will scan for a romtag in our device driver:\n\u003cbr /\u003e\u003cbr /\u003e\n\u003ca href=\"images/mapping_device_name_in device_list.jpg\"\u003e\n\u003cimg src=\"images/mapping_device_name_in device_list.jpg\" width=\"577\" height=\"493\"\u003e\n\u003c/a\u003e\n***\nAnd with telnet connected and running by double-clicking the `SD0`-file it is indeed showing `KPrintF`-output on the serial console...yay!\n\u003cbr /\u003e\u003cbr /\u003e\n\u003ca href=\"images/telnet_kprintf_output.jpg\"\u003e\n\u003cimg src=\"images/telnet_kprintf_output.jpg\" width=\"577\" height=\"418\"\u003e\n\u003c/a\u003e\n***\nIn the disassembly we can also se that the romtag is created correctly after `moveq #-1,d0` `rts` as it should be:\n\u003cbr /\u003e\u003cbr /\u003e\n\u003ca href=\"images/disassembly_screenshot.jpg\"\u003e\n\u003cimg src=\"images/disassembly_screenshot.jpg\" width=\"577\" height=\"364\"\u003e\n\u003c/a\u003e\n***\nThat's all folks!, Happy Amiga Hackin'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbilander%2Fsimpledevice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbilander%2Fsimpledevice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbilander%2Fsimpledevice/lists"}