{"id":21711842,"url":"https://github.com/gemarcano/libctr_core","last_synced_at":"2025-04-12T17:42:02.219Z","repository":{"id":75914393,"uuid":"77660144","full_name":"gemarcano/libctr_core","owner":"gemarcano","description":"Baremetal ARM library for the Nintendo 3DS, used by libctr9 and libctr11","archived":false,"fork":false,"pushed_at":"2023-06-05T08:05:33.000Z","size":133,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T12:03:05.577Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gemarcano.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"COPYING.txt","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":"2016-12-30T04:24:50.000Z","updated_at":"2022-05-13T03:48:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"f1e2da49-ec4b-4404-ab92-6333a32a3ad1","html_url":"https://github.com/gemarcano/libctr_core","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/gemarcano%2Flibctr_core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemarcano%2Flibctr_core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemarcano%2Flibctr_core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gemarcano%2Flibctr_core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gemarcano","download_url":"https://codeload.github.com/gemarcano/libctr_core/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248608164,"owners_count":21132672,"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-11-25T23:30:06.070Z","updated_at":"2025-04-12T17:42:02.213Z","avatar_url":"https://github.com/gemarcano.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"________________________________________________________________________________\n\n(Working title) libctr_core\n\nCopyright 2016 Gabriel Marcano\n________________________________________________________________________________\n\n\n--------------------------------------------------------------------------------\nLicensing\n--------------------------------------------------------------------------------\n\nThis project is licensed under the GPL 2 or later licenses, at your choice.\nRefer to COPYING for more licensing information and for the licensing for the\ncode borrowed from other sources.\n\n\n--------------------------------------------------------------------------------\nAbout\n--------------------------------------------------------------------------------\n\nThis library is meant to be a collection of core routines used by libctr9 and\nlibctr11 for ARM 3DS development.\n\nThe library was meant to be linked with LTO, but due to technical limitations of\ndevKitARM with GCC 5.3, it is not. Instead, it is compiled with\n-ffunction-section, so if the final executable uses the gc-section option for\nthe linker, the linker when linking the final executable will be able to throw\nout parts of the library that are not in use, reducing executable size.\n\nNote this library is still in active development and the API is not considered\nstable. Breaking changes will be mentioned in commits at the very least.\n\n\n--------------------------------------------------------------------------------\nDependencies\n--------------------------------------------------------------------------------\n\n - FreeType2 - Used for font handling. Make sure it is installed somewhere that\n    the compiler can pick it up, or use -L and -I to instruct the compiler where\n    to find it. The build tools will attempt to find it within the prefix where\n    libctr11 was configured to be installed in.\n\n - Autotools in general. These are used to create the build scripts.\n\n - autoconf-archive. Some of the macros provided by this packages are used by\n    the bundled autoconf scripts.\n\n\n--------------------------------------------------------------------------------\nCompiling (TODO)\n--------------------------------------------------------------------------------\n\nDue to the differences between the devKitARM bundled libc between ARM9 and\nARM11, mostly having to do with hardware floating point support, libctr_core\nmust be compiled separately for libctr9 and libctr11.\n\nThe configure script supports the --with-gcc-arch option, which allows one to\nspecify an architecture or even CPU model to target. For reference, the ARM9\nCPU in the 3DS is compatible with CPU model arm946e-s, and the ARM11 with\nmpcore.\n\nFor convenience, the configure script has two --enable-* options that set up\nsome common compilation flags. --enable-thumb tells the project to compile the\nlibrary in Thumb mode, and --enable-3ds-arm11 enables some flags that make the\nbinary compatible with devKitARM's libc. Note that both cannot be enabled at the\nsame time (that is, it is not possible to compile an ARM11 application in thumb\nmode that has hardware floating point support).\n\nAs a suggestion, it is recommended for one to set up a fixed prefix directory\nand to store a share/config.site under the prefix. For example, if the variable\nCTRARM11 holds the prefix path, then $CTRARM11/share/config.site is where this\nfile would be located. Any variables defined here will be picked up by configure\nupon being run. At a minimum, if other libraries will be installed to the prefix\npath, the config.site should have the following:\n\n  CPPFLAGS=\"$CPPFLAGS -I$prefix/include -I$prefix/include/freetype2\"\n  LDFLAGS=\"-L$prefix/lib $LDFLAGS\"\n\nThis example assumes that these directories exist, and in particular that\nFreeType2's include path exists in the folder shown above. Refer to:\nhttps://www.gnu.org/software/automake/manual/html_node/config_002esite.html\nfor more information and details about config.site files.\n\nThe Autotools setup assumes that devkitarm is already in the PATH.\n\n # this following line is if the 3ds compiler isn't in the path\n export PATH=${PATH}:${DEVKITPRO}/bin:${DEVKITARM}/bin\n autoreconf -if\n ./configure --host arm-none-eabi --with-gcc-arch=[architecture] \\\n   --prefix=[lib install path] --enable-[optional]\n make\n\nExample for ARM11:\n  export PATH=${PATH}:${DEVKITPRO}/bin:${DEVKITARM}/bin\n  autoreconf -if\n  ./configure --host arm-none-eabi --with-gcc-arch=mpcore \\\n    --prefix=\"$HOME/.local/usr/arm-none-eabi-11/\" --enable-3ds-arm11\n  make -j10\n\nExample for ARM9:\n  export PATH=${PATH}:${DEVKITPRO}/bin:${DEVKITARM}/bin\n  autoreconf -if\n  ./configure --host arm-none-eabi --with-gcc-arch=arm946e-s \\\n    --prefix=\"$HOME/.local/usr/arm-none-eabi-9/\" --enable-thumb\n  make -j10\n\nAs a heads up, if one does not set up a config.site in $prefix/share with the\nfreetype paths as shown above, one will need to add a -I gcc include directory\noption to either CFLAGS or CPPFLAGS when invoking ./configure, so that it can\nproperly find the freetype header it is looking for. For example:\n\n  ./configure --host arm-none-eabi --with-gcc-arch=arm946e-s \\\n    --prefix=\"$HOME/.local/usr/arm-none-eabi-9/\" --enable-thumb \\\n\tCPPFLAGS=\"-I\"$HOME/.local/usr/arm-none-eabi-9/include/freetype2\"\n\n\n--------------------------------------------------------------------------------\nInstallation\n--------------------------------------------------------------------------------\n\nTBD. This library is built using Autotools, so it supports the 'make install'\nand 'make uninstall' targets. Be sure to set --prefix when calling configure\nif either of the preceeding targets will be used, else by default the generated\nMakefile will install to /usr/local/ (most likely)) !\n\nExample (after having compiled):\n  #this will install to the directory specified in prefix, or /usr/local/ if\n  #prefix isn't defined (most likely)!\n  make install\n\n\n--------------------------------------------------------------------------------\nUsage\n--------------------------------------------------------------------------------\n\nDepending on where the library is installed, one may need to use -L in one's\nprojects to point the compiler to find the library, then use -lctr_core to cause\nthe linker to link in the static library.\n\nExample:\n  arm-none-eabi-gcc -I$HOME/.local/usr/arm-none-eabi-11/include \\\n    -L$HOME/.local/usr/arm-none-eabi-11/lib -Os -Wall -Wextra -Wpedantic \\\n\thello.c -lctr11 -lctr_core -lfreetype2\n\nOne setup that is recommended is to export a variable such as, CTRARM11 or\nCTRARM9, to point to the root of the prefix where libctr_core is installed. This\nway, it is easier to point to the lib and include directories (such as by using\n$CTRARM11/include and $CTRARM9/lib, as examples).\n\nThis library may be useful for others, but it is meant to be a place where\nshared code used by libctr9 and libctr11 can be placed and maintained. The\ndeveloper recommends using one of those libraries instead of libctr_core. Those\nlibraries do depend on libctr_core.\n\n\n--------------------------------------------------------------------------------\nDocumentation\n--------------------------------------------------------------------------------\n\nThis project uses Doxygen markup in order to facilitate the generation of\ndocumentation, which should be found when generated in the doc/ folder. Each\nheader in the include/ directory should also be well documented and can be used\nas reference for programming.\n\nIn addition, some documentation is hosted in GitHub pages:\n    https://gemarcano.github.io/libctr_core/\n\n\n--------------------------------------------------------------------------------\nTesting - FIXME not there yet\n--------------------------------------------------------------------------------\n\nThis project does include a homegrown unit testing framework and some unit tests\nfor this library. See the test/ directory for more information. Note that the\nunit testing payload WILL write to NAND (in theory writes to areas that are\nunused) as a part of unit testing.\n\nTo compile it, change directory to test/, then execute `make test`. The\ngenerated test.bin is an A9LH compatible binary.\n\n\n--------------------------------------------------------------------------------\nIssues/Bugs\n--------------------------------------------------------------------------------\n\nPlease report these to the issue tracker at the repository, and these will be\naddressed as soon as possible, if not at least acknowledged. The more detailed\nthe reports, the more likely they are to be addressed quickly. In particular,\nthe following information can be quite useful when debugging bugs:\n\n - Type of 2/3DS system\n - Operating system being used to compile\n - Release/commit of library in use\n - Steps to reproduce issue\n - Expected behavior\n - Actual behavior\n - ARM9 entry point\n - How the ARM payload was launched and set up\n - Any modifications to the library, or extensions\n\n\n--------------------------------------------------------------------------------\nContributing\n--------------------------------------------------------------------------------\n\nPull requests are welcome. All requests will be looked at in detail, and must be\ndocumented in a similar fashion as the rest of the code for this project. In\nparticular, it is unlikely (but not impossible) that code that emmits warnings\nwith the warnings in use by this library would be merged without first fixing/\naddressing what is causing the warnings to be emitted.\n\n\n--------------------------------------------------------------------------------\nCredits\n--------------------------------------------------------------------------------\n\n - #3dshacks @ Rizon for starting me on my path to 3DS homebrew development\n - #Cakey @ Freenode for the continued development support\n - #3dsdev @ EFNet for the occasional help answering questions\n - d0k3 for some code use in this library and for suggestions\n - dark_samus for helping to develop A9LH stuff in Cakey, which drove for the\n    development of this library\n - Delebile for publishing the public arm9loaderhax implementation, making using\n    and testing this library possible (or less of a pain)\n - Aurora, et. al (you know who you are, I hope) for for general development\n    help and brainstorming\n - Normmatt for yelling at me for screwing up his sdmmc code :) Also a lot of\n    other general 3DS development stuff\n - bilis for his ctr library (a small amount of code from that is used) and for\n    his QEMU implementation of the 3DS ARM9 environment.\n\n - See COPYING for details about code usage from other sources\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgemarcano%2Flibctr_core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgemarcano%2Flibctr_core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgemarcano%2Flibctr_core/lists"}