aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2022-10-11 15:39:36 +0200
committerspicyjpeg <thatspicyjpeg@gmail.com>2022-10-11 15:39:36 +0200
commit8e92156bc6a977651771d2cf91ac5800a0e9a913 (patch)
treeca81708cfeedbca4e486148375600876f2760f7a /doc
parente0e608855b9b2e83a92047294e1f5a242ff51e88 (diff)
downloadpsn00bsdk-8e92156bc6a977651771d2cf91ac5800a0e9a913.tar.gz
Update preset files, README, docs and changelog
Diffstat (limited to 'doc')
-rw-r--r--doc/cmake_reference.md465
-rw-r--r--doc/installation.md6
-rw-r--r--doc/known_bugs.md26
3 files changed, 315 insertions, 182 deletions
diff --git a/doc/cmake_reference.md b/doc/cmake_reference.md
index 25a89ec..bceaac9 100644
--- a/doc/cmake_reference.md
+++ b/doc/cmake_reference.md
@@ -1,6 +1,15 @@
# PSn00bSDK CMake reference
+- [Setup](#setup)
+- [Targets](#targets)
+- [Commands](#commands)
+- [Target properties](#target-properties)
+- [Preprocessor definitions](#preprocessor-definitions)
+- [Cached settings](#cached-settings)
+- [Internal settings](#internal-settings)
+- [Read-only variables](#read-only-variables)
+
## Setup
The only requirement to use the SDK in CMake is to set the
@@ -10,32 +19,35 @@ This can be done on the command line (`-DCMAKE_TOOLCHAIN_FILE=...`), in
`CMakeLists.txt` (`set(CMAKE_TOOLCHAIN_FILE ...)` before `project()`) or using
[presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html).
-It's suggested to have a default preset that sets `CMAKE_TOOLCHAIN_FILE` to
+It's suggested to have a default preset that sets the toolchain file to
`$env{PSN00BSDK_LIBS}/cmake/sdk.cmake`, taking advantage of the
`PSN00BSDK_LIBS` environment variable (used by former PSn00bSDK versions) to
-automatically find the SDK. Such a preset can be created by placing a
+automatically find the SDK if set. Such a preset can be created by placing a
`CMakePresets.json` file in the project's root with the following contents:
```json
{
- "version": 2,
+ "version": 3,
"cmakeMinimumRequired": {
"major": 3,
- "minor": 20,
+ "minor": 21,
"patch": 0
},
"configurePresets": [
{
- "name": "default",
- "displayName": "Default configuration",
- "description": "Use this preset to build the project using PSn00bSDK.",
- "generator": "Ninja",
- "binaryDir": "${sourceDir}/build",
+ "name": "default",
+ "displayName": "Default configuration",
+ "description": "Use this preset to build the project using PSn00bSDK.",
+ "generator": "Ninja",
+ "toolchainFile": "$env{PSN00BSDK_LIBS}/cmake/sdk.cmake",
+ "binaryDir": "${sourceDir}/build",
"cacheVariables": {
- "CMAKE_BUILD_TYPE": "Debug",
- "CMAKE_TOOLCHAIN_FILE": "$env{PSN00BSDK_LIBS}/cmake/sdk.cmake",
- "PSN00BSDK_TC": "",
- "PSN00BSDK_TARGET": "mipsel-none-elf"
+ "CMAKE_BUILD_TYPE": "Debug",
+ "PSN00BSDK_TC": "",
+ "PSN00BSDK_TARGET": "mipsel-none-elf"
+ },
+ "warnings": {
+ "dev": false
}
}
]
@@ -43,230 +55,345 @@ automatically find the SDK. Such a preset can be created by placing a
```
To avoid having to pass variables to CMake each time the project is built, a
-second presets file named `CMakeUserPresets.json` can be created and populated
-with hardcoded values in the `cacheVariables` section. This file can be kept
-private (e.g. by adding it to `.gitignore`); CMake will automatically load
-presets from it instead of `CMakePresets.json` if it exists.
+second file named `CMakeUserPresets.json` can be created and populated with
+hardcoded values in the `cacheVariables` section. This file can be kept private
+(e.g. by adding it to `.gitignore`), and CMake will automatically load presets
+from it instead of `CMakePresets.json` if it exists.
See the [template](../template/CMakeLists.txt) for an example CMake script
showing how to build a simple project.
## Targets
-These targets are defined when using PSn00bSDK. There is no need to explicitly
-link against any of these, as the helper commands (see below) handle linking
-behind the scenes. To avoid conflicts, however, no target should be given any
-of these names.
-
-- `c`, `psxgpu`, `psxgte`, `psxspu`, `psxcd`, `psxsio`, `psxetc`, `psxapi`, `lzp`
-- `psn00bsdk_common`, `psn00bsdk_object_lib`
-- `psn00bsdk_static_exe`
-- `psn00bsdk_dynamic_exe`
-- `psn00bsdk_static_lib`
-- `psn00bsdk_shared_lib`, `psn00bsdk_module_lib`
+The toolchain script creates a target for each PSn00bSDK library. Currently
+the following targets are defined:
+
+- `psxgpu`
+- `psxgte`
+- `psxspu`
+- `psxcd`
+- `psxpress`
+- `psxsio`
+- `psxetc`
+- `psxapi`
+- `lzp`
+- `c`
+
+Note that these are not actual libraries but virtual targets that link to the
+appropriate version of the respective library, depending on the value of the
+`PSN00BSDK_TARGET_TYPE` property; refer to the target properties section for
+more information. Linking manually using the `target_link_libraries()` command
+is usually not necessary for executables as they are linked to all libraries
+by default (see `PSN00BSDK_EXECUTABLE_LINK_LIBRARIES`).
+
+Additionally, two "hidden" libraries named `gcc` and `psn00bsdk` are linked by
+default to all targets. The former is the GCC toolchain's `libgcc` (see
+`PSN00BSDK_LIBGCC`) while the latter is a virtual target used to set compiler
+flags and paths.
## Commands
-- `psn00bsdk_add_executable(<name> <STATIC|DYNAMIC> [EXCLUDE_FROM_ALL] [sources...])`
+### `psn00bsdk_add_executable`
- A wrapper around `add_executable()` to create PS1 executables. Three files
- will be generated for each call to this function:
+```cmake
+psn00bsdk_add_executable(
+ <target name> <GPREL|STATIC|NOGPREL|DYNAMIC>
+ [EXCLUDE_FROM_ALL]
+ [sources...]
+)
+```
- - `<name>.elf` (regular ELF executable)
- - `<name>.exe` (executable converted to the format expected by the PS1)
- - `<name>.map` (symbol map file for dynamic linking/introspection)
+A wrapper around `add_executable()` to create PS1 executables. Three files will
+be generated for each call to this function:
- The `.exe` and `.map` extensions can be customized by overriding
- `PSN00BSDK_EXECUTABLE_SUFFIX` and `PSN00BSDK_SYMBOL_MAP_SUFFIX` prior to
- creating the executable.
+- `<target name>.elf` (regular ELF executable)
+- `<target name>.exe` (executable converted to the format expected by the PS1)
+- `<target name>.map` (symbol map file for dynamic linking/introspection)
- The second argument (mandatory) specifies whether the executable is going to
- load DLLs at runtime. If set to `STATIC`, $gp-relative addressing (i.e.
- reusing the $gp register normally used for DLL addressing) will be enabled,
- slightly reducing executable size and RAM usage but breaking compatibility
- with the dynamic linker.
+The `.exe` and `.map` extensions can be customized by overriding
+`PSN00BSDK_EXECUTABLE_SUFFIX` and `PSN00BSDK_SYMBOL_MAP_SUFFIX` prior to
+creating the executable.
-- `psn00bsdk_add_library(<name> <STATIC|OBJECT|SHARED|MODULE> [EXCLUDE_FROM_ALL] [sources...])`
+The second argument (mandatory) specifies whether the executable is going to
+load DLLs at runtime. If set to `GPREL` or `STATIC`, $gp-relative addressing
+(i.e. reusing the $gp register normally used for DLL addressing to reference
+global variables) will be enabled, slightly reducing executable size and RAM
+usage but breaking compatibility with the dynamic linker.
- Wraps `add_library()` to create static libraries or dynamically-linked
- libraries (DLLs).
+All executables are automatically linked to the libraries listed in
+`PSN00BSDK_EXECUTABLE_LINK_LIBRARIES` (all SDK libraries by default). This
+variable can be modified prior to creating the executable to select which
+libraries to link.
- The second argument (mandatory, unlike `add_library()`) specifies the type of
- library to create. `STATIC` will create a static library named `lib<name>.a`.
- `SHARED` and `MODULE` will compile a DLL, producing the following files (note
- that there is no `lib` prefix for DLLs):
+### `psn00bsdk_add_library`
- - `<name>.so` (regular ELF shared library)
- - `<name>.dll` (raw binary with some ELF headers prepended)
+```cmake
+psn00bsdk_add_library(
+ <target name> <STATIC|OBJECT|SHARED|MODULE>
+ [EXCLUDE_FROM_ALL]
+ [sources...]
+)
+```
- As with executables, the `.dll` extension can be customized by setting
- `PSN00BSDK_SHARED_LIBRARY_SUFFIX`.
+Wraps `add_library()` to create static libraries or dynamically-linked
+libraries (DLLs).
-- `psn00bsdk_add_cd_image(<name> <image name> <config file> [DEPENDS ...] [...])`
+The second argument (mandatory, unlike CMake's regular `add_library()`)
+specifies the type of library to create. `STATIC` will create a static library
+named `lib<target name>.a`. `SHARED` and `MODULE` will compile a DLL, producing
+the following files (there is no `lib` prefix for DLLs):
- Creates a new target that will build a CD image using `mkpsxiso`.
+- `<target name>.so` (regular ELF shared library)
+- `<target name>.dll` (raw binary with some ELF headers prepended)
- The first argument is the name of the target to create; next up is the name
- of the generated image file (`<image name>.bin` + `<image name>.cue`). The
- third argument is the path to the XML file (relative to the source directory)
- passed to `mkpsxiso`.
+The `.dll` extension can be customized by setting
+`PSN00BSDK_SHARED_LIBRARY_SUFFIX` prior to creating the DLL.
- The XML file is "configured" by CMake, i.e. any `${var}` or `@var@`
- expressions are replaced with the values of the respective variables. In
- particular `${CD_IMAGE_NAME}` is replaced with the second argument passed to
- `psn00bsdk_add_cd_image()`; the file must properly set the output file names
- like this:
+All DLLs are automatically linked to the libraries listed in
+`PSN00BSDK_SHARED_LIBRARY_LINK_LIBRARIES` (none by default). This variable can
+be modified prior to creating the DLL to select which libraries to link.
- ```xml
- <?xml version="1.0" encoding="utf-8"?>
- <iso_project
- image_name="${CD_IMAGE_NAME}.bin"
- cue_sheet="${CD_IMAGE_NAME}.cue"
- >
- ```
+**IMPORTANT**: when adding a static library using this command (or CMake's
+`add_library()`), the `PSN00BSDK_TARGET_TYPE` property **must** be set on it
+afterwards in order to let CMake know whether the static library is going to be
+linked to an executable or a DLL. See `PSN00BSDK_TARGET_TYPE` for more
+information.
- Any additional argument is passed through to the underlying call to
- `add_custom_target()`, so most of the options supported by
- `add_custom_target()` (including `DEPENDS`) are also supported here.
+### `psn00bsdk_add_cd_image`
-- `psn00bsdk_target_incbin(<target> <PRIVATE|PUBLIC|INTERFACE> <symbol name> <binary file>)`
+```cmake
+psn00bsdk_add_cd_image(
+ <target name>
+ <image name>
+ <path to XML config file>
+ [DEPENDS <targets|files...>]
+ [other options...]
+)
+```
- Embeds the contents of a binary file into an executable or a library.
+Creates a new virtual target that will build a CD image using `mkpsxiso`. The
+CD image will always be considered out-of-date and built, even if none of its
+dependencies or any other files have been modified.
+
+The first argument is the name of the target to create; next up is the name of
+the generated image file (`<image name>.bin` + `<image name>.cue`). The third
+argument is the path to the XML file (relative to the source directory) passed
+to `mkpsxiso`.
+
+The XML file is "configured" by CMake, i.e. any `${var}` or `@var@` expressions
+are replaced with the values of the respective variables. In particular
+`${CD_IMAGE_NAME}` is replaced with the second argument passed to
+`psn00bsdk_add_cd_image()`; the file must properly set the output file names
+like this:
+
+```xml
+<?xml version="1.0" encoding="utf-8"?>
+<iso_project
+ image_name="${CD_IMAGE_NAME}.bin"
+ cue_sheet="${CD_IMAGE_NAME}.cue"
+>
+ <!-- ... -->
+</iso_project>
+```
- A new symbol/object will be created with the given name, escaped by replacing
- non-alphanumeric characters with underscores. The contents of the file will
- be aligned to 4 bytes and placed in the `.data` section. An unsigned 32-bit
- integer named `<symbol name>_size` will also be defined and set to the length
- of the file in bytes (without taking alignment/padding into account).
+Any additional argument is passed through to the underlying call to
+`add_custom_target()`, so most of the options supported by
+`add_custom_target()` (including `DEPENDS`) are also supported here.
- Once added the file and its size can be accessed by C/C++ code by declaring
- the respective symbols as an extern array and as an integer, like this:
+### `psn00bsdk_target_incbin`
- ```c
- extern const uint8_t my_file[];
- extern const size_t my_file_size;
- ```
+```cmake
+psn00bsdk_target_incbin(
+ <target name> <PRIVATE|PUBLIC|INTERFACE>
+ <data symbol name>
+ <path to binary file>
+)
+```
- The fourth argument specifies the path to the binary file relative to the
- source directory. This path can be prepended with `${PROJECT_BINARY_DIR}/` to
- reference a file generated by the build script (such as an LZP archive): in
- that case a file-level dependency will also be created, ensuring CMake does
- not attempt to compile the executable or library before the file is built.
+Embeds the contents of a binary file into an executable or a library.
- **IMPORTANT**: in order for this command to work, assembly language support
- must be enabled by specifying `LANGUAGES C ASM` (or `LANGUAGES C CXX ASM` if
- C++ is also used) when invoking `project()`.
+A new symbol/object will be created with the given name, escaped by replacing
+non-alphanumeric characters with underscores. The contents of the file will be
+aligned to 4 bytes and placed in the `.data` section. An unsigned 32-bit
+integer named `<symbol name>_size` will also be defined and set to the length
+of the file in bytes (without taking alignment/padding into account).
-- `psn00bsdk_target_incbin_a(<target> <PRIVATE|PUBLIC|INTERFACE> <symbol name> <size symbol name> <binary file> <alignment>)`
+Once added the file and its size can be accessed by C/C++ code by declaring the
+respective symbols as an extern array and as an integer, like this:
- Advanced variant of `psn00bsdk_target_incbin()` that allows specifying a
- custom name for the size symbol and changing the default alignment setting.
- Note that the size integer is always aligned to a multiple of 4 bytes as the
- MIPS architecture doesn't support unaligned reads.
+```c
+extern const uint8_t my_file[];
+extern const size_t my_file_size;
+```
-## Definitions
+The fourth argument specifies the path to the binary file relative to the
+source directory. This path can be prepended with `${PROJECT_BINARY_DIR}/` to
+reference a file generated by the build script (such as an LZP archive): in
+that case a file-level dependency will also be created, ensuring CMake does not
+attempt to compile the executable or library before the file is built.
+
+**IMPORTANT**: in order for this command to work, assembly language support
+must be enabled by specifying `LANGUAGES C ASM` (or `LANGUAGES C CXX ASM` to
+enable C++ support as well) when invoking `project()`.
+
+### `psn00bsdk_target_incbin_a`
+
+```cmake
+psn00bsdk_target_incbin_a(
+ <target name> <PRIVATE|PUBLIC|INTERFACE>
+ <data symbol name>
+ <size symbol name>
+ <path to binary file>
+ <section name>
+ <alignment>
+)
+```
-When compiling executables and libraries using the above commands the following
-preprocessor macros are automatically `#define`'d:
+Advanced variant of `psn00bsdk_target_incbin()` that allows specifying a custom
+name for the size symbol and changing the default alignment setting. The value
+of the size integer is always rounded up to a multiple of 4 bytes.
-- `PLAYSTATION`
+See `psn00bsdk_target_incbin()` above for more details.
- Always set to 1. Can be used to implement different options or code paths for
- libraries, so they can target both the host and PS1 (as it won't be defined
- when compiling outside of the SDK).
+## Target properties
-- `DEBUG`
+Each of the following properties can be set individually for each executable or
+library using CMake's `set_property()` and `set_target_properties()` commands.
- Defined and set to 1 in a debug configuration, i.e. when the
- `CMAKE_BUILD_TYPE` variable is set to `Debug`. This value is used by the
- PSn00bSDK libraries, and should be used in executables, to enable additional
- debug logging.
+### `PSN00BSDK_TARGET_TYPE`
- Note that the default CMake configuration is usually debug, so it's
- recommended to specify `-DCMAKE_BUILD_TYPE=Release` to get rid of the logging
- overhead in release builds and reduce executable size.
+Determines which SDK libraries are linked to and which compiler flags are added
+to the target. Must be set to `EXECUTABLE_GPREL`, `EXECUTABLE_NOGPREL` or
+`SHARED_LIBRARY`.
-## Cached settings
+This property is initialized automatically on executables and DLLs created via
+`psn00bsdk_add_executable()` or `psn00bsdk_add_library()`, but *not* on static
+libraries as CMake has no way to know about their intended usage (i.e. whether
+they are going to be linked to an executable with or without $gp-relative
+addressing, or to a DLL). Thus, `PSN00BSDK_TARGET_TYPE` must be set manually on
+all static libraries and must match the value set on any executable or DLL the
+static library is going to be linked to.
+
+There is no way to build a "hybrid" static library that can be linked to
+multiple target types, short of building multiple copies of it. A workaround
+(used internally by PSn00bSDK) is to create a virtual target and use CMake
+generator expressions to link to one of the copies depending on the value of
+`PSN00BSDK_TARGET_TYPE`.
-These variables are stored in CMake's cache and can be edited by the project's
-build script, from the CMake command line when configuring the project
-(`-Dname=value`) or using an editor such as the CMake GUI.
+## Preprocessor definitions
-- `PSN00BSDK_TARGET` (`STRING`)
+When compiling executables and libraries using the commands listed above the
+following C/C++ preprocessor macros are automatically `#define`d:
- The GCC toolchain's target triplet. PSn00bSDK assumes the toolchain targets
- `mipsel-none-elf` by default, however this can be changed to e.g. use a MIPS
- toolchain that was compiled for a slightly-different-but-equivalent target.
+### `PSN00BSDK`
- The following GCC target triplets have been confirmed to work with PSn00bSDK:
+Always set to 1. Can be used to implement different options or code paths for
+projects that target both PSn00bSDK and other platforms.
- - `mipsel-none-elf`
- - `mipsel-unknown-elf`
- - ~~`mipsel-linux-gnu`~~ (has issues with linking)
+### `NDEBUG`
-- `PSN00BSDK_TC` (`PATH`)
+Defined and set to 1 in a release configuration, i.e. when `CMAKE_BUILD_TYPE`
+is set to `Release` or when a multi-configuration generator is building the
+project in release mode; not defined if the project is being built in debug
+mode. This value is used by the PSn00bSDK libraries, and should be used in
+projects, to enable assertions and additional debug logging (the `assert()`
+macro already resolves to a no-op in release mode).
- Path to the GCC toolchain's installation prefix/directory. If not set, CMake
- will attempt to find the toolchain in the `PATH` environment variable and
- store its path in the project's variable cache (so the search does not have
- to be repeated). It is recommended to add the toolchain's `bin` subfolder to
- `PATH` rather than setting this variable.
+Note that the default CMake configuration is usually debug. It is recommended
+to build a project in release mode whenever appropriate (by specifying
+`-DCMAKE_BUILD_TYPE=Release` or using the Ninja multi-configuration generator)
+to get rid of logging overhead.
- **IMPORTANT**: if the toolchain's target is not `mipsel-none-elf`,
- `PSN00BSDK_TARGET` must be set regardless of whether or not `PSN00BSDK_TC` is
- also set.
+## Cached settings
+
+These variables are stored in CMake's cache and are meant to be set by the end
+user when building the project (rather than by the project itself). They can be
+modified by the build script after invoking `project()`, from the CMake command
+line when configuring (`-Dname=value`) or using an IDE or other editor such as
+the CMake GUI.
+
+### `PSN00BSDK_TARGET` (`STRING`)
+
+The GCC toolchain's target triplet. PSn00bSDK assumes the toolchain targets
+`mipsel-none-elf` by default, however this can be changed to e.g. use a MIPS
+toolchain that was compiled for `mipsel-unknown-elf` (as used by previous
+versions of PSn00bSDK).
+
+Toolchains that target `mipsel-linux-gnu` are not supported by PSn00bSDK.
+
+### `PSN00BSDK_TC` (`PATH`)
-- `PSN00BSDK_LIBGCC` (`FILEPATH`)
+Path to the GCC toolchain's installation prefix/directory. If not set, CMake
+will attempt to find the toolchain in the `PATH` environment variable and store
+its path in the project's variable cache (so the search does not have to be
+repeated). It is recommended to add the toolchain's `bin` subfolder to `PATH`
+rather than setting this variable.
- Path to the `libgcc.a` library bundled with the GCC toolchain. The contents
- of this library are merged into `libc` when building the SDK, so this
- variable is only actually needed when compiling `libpsn00b`. Setting this
- variable manually usually isn't necessary as CMake will locate `libgcc.a`
- automatically after finding the toolchain.
+**IMPORTANT**: if the toolchain's target triplet is not `mipsel-none-elf`,
+`PSN00BSDK_TARGET` must be set regardless of whether or not `PSN00BSDK_TC` is
+also set.
+
+### `PSN00BSDK_LIBGCC` (`FILEPATH`)
+
+Path to the `libgcc` library bundled with the GCC toolchain. As required by GCC
+this library is always linked to all targets, regardless of whether any SDK
+libraries are linked or not. CMake will attempt to locate `libgcc`
+automatically after finding the toolchain, so setting this variable manually is
+not required in most cases.
## Internal settings
These settings are not stored in CMake's cache and can only be set from within
-the build script.
+the build script after invoking `project()`.
+
+### `PSN00BSDK_EXECUTABLE_LINK_LIBRARIES`, `PSN00BSDK_SHARED_LIBRARY_LINK_LIBRARIES` (list of `STRING`)
-- `PSN00BSDK_LIBRARIES`
+Lists of SDK libraries to be linked automatically to all new executables and
+DLLs, respectively. By default `PSN00BSDK_EXECUTABLE_LINK_LIBRARIES` includes
+all libraries that ship with PSn00bSDK while
+`PSN00BSDK_SHARED_LIBRARY_LINK_LIBRARIES` is empty.
- List of libraries to link all created targets against. By default this
- includes all PSn00bSDK libraries.
+These variables can be modified before invoking `psn00bsdk_add_executable()` or
+`psn00bsdk_add_library()` to only link a subset of the SDK. Static libraries
+are *not* automatically linked to any SDK libraries.
-- `PSN00BSDK_EXECUTABLE_SUFFIX`, `PSN00BSDK_SHARED_LIBRARY_SUFFIX`,
- `PSN00BSDK_SYMBOL_MAP_SUFFIX`
+### `PSN00BSDK_EXECUTABLE_SUFFIX`, `PSN00BSDK_SHARED_LIBRARY_SUFFIX`, `PSN00BSDK_SYMBOL_MAP_SUFFIX` (`STRING`)
- File extensions to use for generated PS1 files. The default values are
- `.exe`, `.dll` and `.map` respectively. Note that file names and extensions
- can be changed anyway when building a CD image.
+File extensions to use for generated PS1 files. The default values are `.exe`,
+`.dll` and `.map` respectively. These extensions do not have to match the ones
+used in the CD image (if any).
## Read-only variables
-- `PSN00BSDK_VERSION`, `PSN00BSDK_BUILD_DATE`, `PSN00BSDK_GIT_TAG`,
- `PSN00BSDK_GIT_COMMIT`
+### `PSN00BSDK_VERSION`, `PSN00BSDK_BUILD_DATE`, `PSN00BSDK_GIT_TAG`, `PSN00BSDK_GIT_COMMIT` (`STRING`)
+
+These variables are loaded from `lib/libpsn00b/build.json` and contain
+information about the SDK's version. `PSN00BSDK_GIT_TAG` and
+`PSN00BSDK_GIT_COMMIT` might be empty strings as they are only populated in CI
+builds of PSn00bSDK.
+
+### `PSN00BSDK_LIBRARIES` (list of `STRING`)
- These variables are loaded from `lib/libpsn00b/build.json` and contain
- information about the SDK's version. Note that `PSN00BSDK_GIT_TAG` and
- `PSN00BSDK_GIT_COMMIT` are not populated by default when building PSn00bSDK
- manually from source, so they might be empty strings.
+List of all libraries that ship with PSn00bSDK, excluding `libgcc`. Each
+library in this list is also defined as a target. See the targets section for
+more details.
-- `PSN00BSDK_TOOLS`, `PSN00BSDK_INCLUDE`, `PSN00BSDK_LDSCRIPTS`
+### `PSN00BSDK_TOOLS`, `PSN00BSDK_INCLUDE`, `PSN00BSDK_LDSCRIPTS` (list of `PATH`)
- Lists of paths used internally. Should not be set, manipulated or overridden
- by scripts.
+Lists of paths used internally. Should not be set, manipulated or overridden by
+scripts.
-- `TOOLCHAIN_NM`
+### `TOOLCHAIN_NM` (`FILEPATH`)
- Path to the `nm` executable used to generate symbol maps. Although not used
- internally by CMake, this program is part of the GCC toolchain.
+Path to the `nm` executable used to generate symbol maps. Although not used
+internally by CMake, this program is part of the GCC toolchain.
-- `ELF2X`, `ELF2CPE`, `MKPSXISO`, `LZPACK`, `SMXLINK`
+### `ELF2X`, `ELF2CPE`, `MKPSXISO`, `LZPACK`, `SMXLINK` (`FILEPATH`)
- Paths to the PSn00bSDK tools' executables. As no functions are currently
- provided for building assets, `LZPACK` and `SMXLINK` can be used with
- `add_custom_command()`/`add_custom_target()` to convert models and generate
- LZP archives as part of the build pipeline.
+Paths to the PSn00bSDK tools' executables. As no functions are currently
+provided for building assets, `LZPACK` and `SMXLINK` can be used manually with
+CMake's `add_custom_command()` and `add_custom_target()` to convert models and
+generate LZP archives as part of the build pipeline.
-----------------------------------------
-_Last updated on 2022-02-26 by spicyjpeg_
+_Last updated on 2022-10-11 by spicyjpeg_
diff --git a/doc/installation.md b/doc/installation.md
index 382c721..70b7f3e 100644
--- a/doc/installation.md
+++ b/doc/installation.md
@@ -5,7 +5,7 @@
1. Install prerequisites. Currently CMake is the only external dependency; you
can install it from [here](https://cmake.org/download) or using MSys2 or
- your distro's package manager. Make sure you have at least CMake 3.20.
+ your distro's package manager. Make sure you have at least CMake 3.21.
2. Head over to the releases page, download the latest release's ZIP for your
operating system and extract its contents to a directory of your choice,
@@ -44,7 +44,7 @@ being built without support for ripping CD audio tracks to FLAC, however the
- `git`
- `build-essential`, `base-devel` or similar
- `make` or `ninja-build`
- - `cmake` (3.20+ is required, download it from
+ - `cmake` (3.21 or later is required, download it from
[here](https://cmake.org/download) if your package manager only provides
older versions)
@@ -185,4 +185,4 @@ The toolchain script defines a few CMake macros to create PS1 executables, DLLs
and CD images. See the [reference](cmake_reference.md) for details.
-----------------------------------------
-_Last updated on 2022-09-21 by spicyjpeg_
+_Last updated on 2022-10-11 by spicyjpeg_
diff --git a/doc/known_bugs.md b/doc/known_bugs.md
index 3fbfdc2..9e4785c 100644
--- a/doc/known_bugs.md
+++ b/doc/known_bugs.md
@@ -7,14 +7,15 @@ fixed.
## Toolchain
-- It is currently not possible to link static libraries (including the SDK
- libraries themselves) with DLLs, since the build scripts currently assume that
- static library object files are always going to be linked into executables.
- This can be worked around by linking all static libraries as part of the main
- executable rather than the DLLs: the dynamic linker will automatically search
- the executable for undefined symbols used by a DLL and patch the code to use
- them. It might be necessary to list such symbols in a dummy array to prevent
- the compiler from stripping them away from the executable.
+- ~~It is currently not possible to link static libraries (including the SDK~~
+ ~~libraries themselves) with DLLs, since the build scripts currently assume~~
+ ~~that static library object files are always going to be linked into~~
+ ~~executables. This can be worked around by linking all static libraries as~~
+ ~~part of the main executable rather than the DLLs: the dynamic linker will~~
+ ~~automatically search the executable for undefined symbols used by a DLL~~
+ ~~and patch the code to use them.~~ Static libraries are now fully supported,
+ and SDK libraries can be linked to both executables and DLLs. See the CMake
+ reference for more details.
- Link-time optimization is broken due to GCC not supporting it when linking
weak functions written in assembly.
@@ -28,7 +29,7 @@ fixed.
the length of the data *must* be a multiple of 32 bytes. Attempting to
transfer any data whose length isn't a multiple of 32 bytes will result in
`DrawSync()` hanging and never returning, however a warning will be printed
- on the debug console.
+ on the debug console if the executable is built in debug mode.
`psxspu`:
@@ -36,6 +37,11 @@ fixed.
due to the SPU status register being emulated incorrectly. They work as
expected on other emulators as well as on real hardware.
+`psxcd`:
+
+- Custom callbacks registered using `CdReadyCallback()` seem to be unstable on
+ DuckStation (and possibly on real hardware), occasionally dropping sectors.
+
`psxetc`:
- `DL_LoadSymbolMapFromFile()`, `DL_LoadDLLFromFile()` and `dlopen()` have been
@@ -48,4 +54,4 @@ fixed.
See [README.md in the examples directory](../examples/README.md#examples-summary).
-----------------------------------------
-_Last updated on 2022-08-21 by spicyjpeg_
+_Last updated on 2022-10-11 by spicyjpeg_