Compare commits
33 Commits
1800_suppo
...
pc_testing
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34acb80635 | ||
|
|
99fc16bfd0 | ||
|
|
3c07819cd2 | ||
|
|
1313427b5d | ||
|
|
13b63af15e | ||
|
|
76910e8954 | ||
|
|
09a44fa680 | ||
|
|
244a396b16 | ||
|
|
6e6b86eabc | ||
|
|
82620f95a3 | ||
|
|
b7ed9c58bb | ||
|
|
46f2d34f25 | ||
|
|
f58eca5f7b | ||
|
|
6cf31486e1 | ||
|
|
d6dbfd356d | ||
|
|
d76e678da2 | ||
|
|
1d0c9ae71a | ||
|
|
502a89e1e3 | ||
|
|
f8409680c2 | ||
|
|
22f30e4e51 | ||
|
|
6c4960d5a9 | ||
|
|
242577f90d | ||
|
|
fd02c9bd22 | ||
|
|
753434ff2d | ||
|
|
f817178081 | ||
|
|
87764613f2 | ||
|
|
5c5789eadf | ||
|
|
a3ba767fba | ||
|
|
100bead52b | ||
|
|
a4895a1e79 | ||
|
|
453e70bc6f | ||
|
|
ddf80b29f2 | ||
|
|
01c939f774 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -84,12 +84,16 @@ dkms.conf
|
|||||||
|
|
||||||
.**/
|
.**/
|
||||||
|
|
||||||
|
# macOS horseshittery
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
# NOTE: make sure to make exceptions to this pattern when needed!
|
# NOTE: make sure to make exceptions to this pattern when needed!
|
||||||
*.bin
|
*.bin
|
||||||
*.enc
|
*.enc
|
||||||
|
|
||||||
**/out
|
**/out
|
||||||
**/build
|
**/build
|
||||||
|
**/lib
|
||||||
**/build_nintendo_nx_arm64
|
**/build_nintendo_nx_arm64
|
||||||
**/build_nintendo_nx_arm64_armv8a
|
**/build_nintendo_nx_arm64_armv8a
|
||||||
**/build_nintendo_nx_arm
|
**/build_nintendo_nx_arm
|
||||||
@@ -99,6 +103,8 @@ dkms.conf
|
|||||||
**/build_nintendo_nx_x64
|
**/build_nintendo_nx_x64
|
||||||
**/build_nintendo_nx_x86
|
**/build_nintendo_nx_x86
|
||||||
|
|
||||||
|
tools/*/
|
||||||
|
|
||||||
package3
|
package3
|
||||||
|
|
||||||
stratosphere/test/
|
stratosphere/test/
|
||||||
|
|||||||
200
Makefile
200
Makefile
@@ -1,186 +1,42 @@
|
|||||||
ifeq ($(strip $(DEVKITPRO)),)
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
|
all: nx_release
|
||||||
endif
|
clean: clean-nx_release
|
||||||
|
|
||||||
include $(DEVKITPRO)/devkitA64/base_tools
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
|
||||||
TOPTARGETS := all clean dist-no-debug dist
|
define ATMOSPHERE_ADD_TARGET
|
||||||
AMSBRANCH := $(shell git symbolic-ref --short HEAD)
|
|
||||||
AMSHASH := $(shell git rev-parse --short HEAD)
|
|
||||||
AMSREV := $(AMSBRANCH)-$(AMSHASH)
|
|
||||||
|
|
||||||
ifneq (, $(strip $(shell git status --porcelain 2>/dev/null)))
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
AMSREV := $(AMSREV)-dirty
|
|
||||||
endif
|
|
||||||
|
|
||||||
COMPONENTS := fusee stratosphere mesosphere exosphere emummc thermosphere troposphere libraries
|
$(strip $1):
|
||||||
|
@echo "Building $(strip $1)"
|
||||||
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/atmosphere.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
all: $(COMPONENTS)
|
clean-$(strip $1):
|
||||||
$(eval MAJORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
@echo "Cleaning $(strip $1)"
|
||||||
| tr -s [:blank:] \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/atmosphere.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval MINORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MINOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval MICROVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MICRO\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval S_MAJORVER = $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval S_MINORVER = $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval S_MICROVER = $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
@python fusee/build_package3.py $(CURDIR) release $(AMSHASH) $(MAJORVER) $(MINORVER) $(MICROVER) 0 $(S_MAJORVER) $(S_MINORVER) $(S_MICROVER) 0
|
|
||||||
@echo "Built package3!"
|
|
||||||
|
|
||||||
thermosphere:
|
endef
|
||||||
$(MAKE) -C thermosphere all
|
|
||||||
|
|
||||||
exosphere: thermosphere
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
$(MAKE) -C exosphere all
|
|
||||||
|
|
||||||
stratosphere: exosphere libraries
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
$(MAKE) -C stratosphere all
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
|
))
|
||||||
|
|
||||||
mesosphere: exosphere libraries
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
$(MAKE) -C mesosphere all
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
troposphere: stratosphere
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
$(MAKE) -C troposphere all
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
emummc:
|
endef
|
||||||
$(MAKE) -C emummc all
|
|
||||||
|
|
||||||
fusee: exosphere mesosphere stratosphere
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
$(MAKE) -C $@ all
|
|
||||||
|
|
||||||
libraries:
|
clean-all: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
$(MAKE) -C libraries all
|
|
||||||
|
|
||||||
clean:
|
.PHONY: all clean clean-all $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
$(MAKE) -C fusee clean
|
|
||||||
$(MAKE) -C emummc clean
|
|
||||||
$(MAKE) -C libraries clean
|
|
||||||
$(MAKE) -C exosphere clean
|
|
||||||
$(MAKE) -C thermosphere clean
|
|
||||||
$(MAKE) -C mesosphere clean
|
|
||||||
$(MAKE) -C stratosphere clean
|
|
||||||
rm -rf out
|
|
||||||
|
|
||||||
dist-no-debug: all
|
|
||||||
$(eval MAJORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval MINORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MINOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval MICROVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MICRO\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval AMSVER = $(MAJORVER).$(MINORVER).$(MICROVER)-$(AMSREV))
|
|
||||||
rm -rf atmosphere-$(AMSVER)
|
|
||||||
rm -rf out
|
|
||||||
mkdir atmosphere-$(AMSVER)
|
|
||||||
mkdir atmosphere-$(AMSVER)/atmosphere
|
|
||||||
mkdir atmosphere-$(AMSVER)/switch
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/fatal_errors
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/config_templates
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/config
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/atmosphere/flags
|
|
||||||
cp fusee/fusee.bin atmosphere-$(AMSVER)/atmosphere/reboot_payload.bin
|
|
||||||
cp fusee/package3 atmosphere-$(AMSVER)/atmosphere/package3
|
|
||||||
cp config_templates/stratosphere.ini atmosphere-$(AMSVER)/atmosphere/config_templates/stratosphere.ini
|
|
||||||
cp config_templates/override_config.ini atmosphere-$(AMSVER)/atmosphere/config_templates/override_config.ini
|
|
||||||
cp config_templates/system_settings.ini atmosphere-$(AMSVER)/atmosphere/config_templates/system_settings.ini
|
|
||||||
cp config_templates/exosphere.ini atmosphere-$(AMSVER)/atmosphere/config_templates/exosphere.ini
|
|
||||||
mkdir -p config_templates/kip_patches
|
|
||||||
cp -r config_templates/kip_patches atmosphere-$(AMSVER)/atmosphere/kip_patches
|
|
||||||
cp -r config_templates/hbl_html atmosphere-$(AMSVER)/atmosphere/hbl_html
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000008
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000000D
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000017
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000002B
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000032
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000034
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000036
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000037
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000003C
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000042
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000420
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000B240
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000D609
|
|
||||||
mkdir -p atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000D623
|
|
||||||
cp stratosphere/boot2/boot2.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000008/exefs.nsp
|
|
||||||
cp stratosphere/dmnt/dmnt.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000000D/exefs.nsp
|
|
||||||
cp stratosphere/cs/cs.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000017/exefs.nsp
|
|
||||||
cp stratosphere/erpt/erpt.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000002B/exefs.nsp
|
|
||||||
cp stratosphere/eclct.stub/eclct.stub.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000032/exefs.nsp
|
|
||||||
cp stratosphere/fatal/fatal.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000034/exefs.nsp
|
|
||||||
cp stratosphere/creport/creport.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000036/exefs.nsp
|
|
||||||
cp stratosphere/ro/ro.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000037/exefs.nsp
|
|
||||||
cp stratosphere/jpegdec/jpegdec.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000003C/exefs.nsp
|
|
||||||
cp stratosphere/pgl/pgl.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000042/exefs.nsp
|
|
||||||
cp stratosphere/LogManager/LogManager.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/0100000000000420/exefs.nsp
|
|
||||||
cp stratosphere/htc/htc.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000B240/exefs.nsp
|
|
||||||
cp stratosphere/dmnt.gen2/dmnt.gen2.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000D609/exefs.nsp
|
|
||||||
cp stratosphere/TioServer/TioServer.nsp atmosphere-$(AMSVER)/stratosphere_romfs/atmosphere/contents/010000000000D623/exefs.nsp
|
|
||||||
@build_romfs atmosphere-$(AMSVER)/stratosphere_romfs atmosphere-$(AMSVER)/atmosphere/stratosphere.romfs
|
|
||||||
rm -r atmosphere-$(AMSVER)/stratosphere_romfs
|
|
||||||
cp troposphere/reboot_to_payload/reboot_to_payload.nro atmosphere-$(AMSVER)/switch/reboot_to_payload.nro
|
|
||||||
cp troposphere/daybreak/daybreak.nro atmosphere-$(AMSVER)/switch/daybreak.nro
|
|
||||||
cd atmosphere-$(AMSVER); zip -r ../atmosphere-$(AMSVER).zip ./*; cd ../;
|
|
||||||
rm -rf atmosphere-$(AMSVER)
|
|
||||||
mkdir out
|
|
||||||
mv atmosphere-$(AMSVER).zip out/atmosphere-$(AMSVER).zip
|
|
||||||
cp fusee/fusee.bin out/fusee.bin
|
|
||||||
|
|
||||||
dist: dist-no-debug
|
|
||||||
$(eval MAJORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval MINORVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MINOR\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval MICROVER = $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MICRO\b' libraries/libvapours/include/vapours/ams/ams_api_version.h \
|
|
||||||
| tr -s [:blank:] \
|
|
||||||
| cut -d' ' -f3))
|
|
||||||
$(eval AMSVER = $(MAJORVER).$(MINORVER).$(MICROVER)-$(AMSREV))
|
|
||||||
rm -rf atmosphere-$(AMSVER)-debug
|
|
||||||
mkdir atmosphere-$(AMSVER)-debug
|
|
||||||
cp fusee/loader_stub/loader_stub.elf atmosphere-$(AMSVER)-debug/fusee-loader-stub.elf
|
|
||||||
cp fusee/program/program.elf atmosphere-$(AMSVER)-debug/fusee-program.elf
|
|
||||||
cp exosphere/loader_stub/loader_stub.elf atmosphere-$(AMSVER)-debug/exosphere-loader-stub.elf
|
|
||||||
cp exosphere/program/program.elf atmosphere-$(AMSVER)-debug/exosphere-program.elf
|
|
||||||
cp exosphere/warmboot/warmboot.elf atmosphere-$(AMSVER)-debug/exosphere-warmboot.elf
|
|
||||||
cp exosphere/mariko_fatal/mariko_fatal.elf atmosphere-$(AMSVER)-debug/exosphere-mariko-fatal.elf
|
|
||||||
cp exosphere/program/sc7fw/sc7fw.elf atmosphere-$(AMSVER)-debug/exosphere-sc7fw.elf
|
|
||||||
cp exosphere/program/rebootstub/rebootstub.elf atmosphere-$(AMSVER)-debug/exosphere-rebootstub.elf
|
|
||||||
cp mesosphere/kernel_ldr/kernel_ldr.elf atmosphere-$(AMSVER)-debug/kernel_ldr.elf
|
|
||||||
cp mesosphere/kernel/kernel.elf atmosphere-$(AMSVER)-debug/kernel.elf
|
|
||||||
cp stratosphere/ams_mitm/ams_mitm.elf atmosphere-$(AMSVER)-debug/ams_mitm.elf
|
|
||||||
cp stratosphere/boot/boot.elf atmosphere-$(AMSVER)-debug/boot.elf
|
|
||||||
cp stratosphere/boot2/boot2.elf atmosphere-$(AMSVER)-debug/boot2.elf
|
|
||||||
cp stratosphere/creport/creport.elf atmosphere-$(AMSVER)-debug/creport.elf
|
|
||||||
cp stratosphere/dmnt/dmnt.elf atmosphere-$(AMSVER)-debug/dmnt.elf
|
|
||||||
cp stratosphere/eclct.stub/eclct.stub.elf atmosphere-$(AMSVER)-debug/eclct.stub.elf
|
|
||||||
cp stratosphere/erpt/erpt.elf atmosphere-$(AMSVER)-debug/erpt.elf
|
|
||||||
cp stratosphere/fatal/fatal.elf atmosphere-$(AMSVER)-debug/fatal.elf
|
|
||||||
cp stratosphere/jpegdec/jpegdec.elf atmosphere-$(AMSVER)-debug/jpegdec.elf
|
|
||||||
cp stratosphere/loader/loader.elf atmosphere-$(AMSVER)-debug/loader.elf
|
|
||||||
cp stratosphere/ncm/ncm.elf atmosphere-$(AMSVER)-debug/ncm.elf
|
|
||||||
cp stratosphere/pgl/pgl.elf atmosphere-$(AMSVER)-debug/pgl.elf
|
|
||||||
cp stratosphere/pm/pm.elf atmosphere-$(AMSVER)-debug/pm.elf
|
|
||||||
cp stratosphere/ro/ro.elf atmosphere-$(AMSVER)-debug/ro.elf
|
|
||||||
cp stratosphere/sm/sm.elf atmosphere-$(AMSVER)-debug/sm.elf
|
|
||||||
cp stratosphere/spl/spl.elf atmosphere-$(AMSVER)-debug/spl.elf
|
|
||||||
cp troposphere/daybreak/daybreak.elf atmosphere-$(AMSVER)-debug/daybreak.elf
|
|
||||||
cd atmosphere-$(AMSVER)-debug; zip -r ../atmosphere-$(AMSVER)-debug.zip ./*; cd ../;
|
|
||||||
rm -r atmosphere-$(AMSVER)-debug
|
|
||||||
mv atmosphere-$(AMSVER)-debug.zip out/atmosphere-$(AMSVER)-debug.zip
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: $(TOPTARGETS) $(COMPONENTS)
|
|
||||||
|
|||||||
167
atmosphere.mk
Normal file
167
atmosphere.mk
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/libraries/config/common.mk
|
||||||
|
|
||||||
|
# Get Atmosphere version fields
|
||||||
|
ATMOSPHERE_MAJOR_VERSION := $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MAJOR\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
ATMOSPHERE_MINOR_VERSION := $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MINOR\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
ATMOSPHERE_MICRO_VERSION := $(shell grep 'define ATMOSPHERE_RELEASE_VERSION_MICRO\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
ATMOSPHERE_SUPPORTED_HOS_MAJOR_VERSION := $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
ATMOSPHERE_SUPPORTED_HOS_MINOR_VERSION := $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
ATMOSPHERE_SUPPORTED_HOS_MICRO_VERSION := $(shell grep 'define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO\b' $(ATMOSPHERE_LIBRARIES_DIR)/libvapours/include/vapours/ams/ams_api_version.h | tr -s [:blank:] | cut -d' ' -f3)
|
||||||
|
|
||||||
|
ATMOSPHERE_VERSION := $(ATMOSPHERE_MAJOR_VERSION).$(ATMOSPHERE_MINOR_VERSION).$(ATMOSPHERE_MICRO_VERSION)-$(ATMOSPHERE_GIT_REVISION)
|
||||||
|
|
||||||
|
dist: dist-no-debug
|
||||||
|
$(eval DIST_DIR = $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/atmosphere-$(ATMOSPHERE_VERSION)-debug)
|
||||||
|
rm -rf $(DIST_DIR)
|
||||||
|
mkdir $(DIST_DIR)
|
||||||
|
cp $(CURRENT_DIRECTORY)/fusee/loader_stub/$(ATMOSPHERE_BOOT_OUT_DIR)/loader_stub.elf $(DIST_DIR)/fusee-loader-stub.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/fusee/program/$(ATMOSPHERE_BOOT_OUT_DIR)/program.elf $(DIST_DIR)/fusee-program.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.elf $(DIST_DIR)/exosphere-loader-stub.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/program/$(ATMOSPHERE_OUT_DIR)/program.elf $(DIST_DIR)/exosphere-program.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/warmboot/$(ATMOSPHERE_BOOT_OUT_DIR)/warmboot.elf $(DIST_DIR)/exosphere-warmboot.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/mariko_fatal/$(ATMOSPHERE_OUT_DIR)/mariko_fatal.elf $(DIST_DIR)/exosphere-mariko-fatal.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/program/sc7fw/$(ATMOSPHERE_BOOT_OUT_DIR)/sc7fw.elf $(DIST_DIR)/exosphere-sc7fw.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/exosphere/program/rebootstub/$(ATMOSPHERE_BOOT_OUT_DIR)/rebootstub.elf $(DIST_DIR)/exosphere-rebootstub.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/mesosphere/kernel_ldr/$(ATMOSPHERE_OUT_DIR)/kernel_ldr.elf $(DIST_DIR)/kernel_ldr.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/mesosphere/kernel/$(ATMOSPHERE_OUT_DIR)/kernel.elf $(DIST_DIR)/kernel.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/ams_mitm/$(ATMOSPHERE_OUT_DIR)/ams_mitm.elf $(DIST_DIR)/ams_mitm.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/boot/$(ATMOSPHERE_OUT_DIR)/boot.elf $(DIST_DIR)/boot.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/boot2/$(ATMOSPHERE_OUT_DIR)/boot2.elf $(DIST_DIR)/boot2.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/creport/$(ATMOSPHERE_OUT_DIR)/creport.elf $(DIST_DIR)/creport.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/cs/$(ATMOSPHERE_OUT_DIR)/cs.elf $(DIST_DIR)/cs.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/dmnt/$(ATMOSPHERE_OUT_DIR)/dmnt.elf $(DIST_DIR)/dmnt.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/dmnt.gen2/$(ATMOSPHERE_OUT_DIR)/dmnt.gen2.elf $(DIST_DIR)/dmnt.gen2.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/eclct.stub/$(ATMOSPHERE_OUT_DIR)/eclct.stub.elf $(DIST_DIR)/eclct.stub.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/erpt/$(ATMOSPHERE_OUT_DIR)/erpt.elf $(DIST_DIR)/erpt.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/fatal/$(ATMOSPHERE_OUT_DIR)/fatal.elf $(DIST_DIR)/fatal.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/htc/$(ATMOSPHERE_OUT_DIR)/htc.elf $(DIST_DIR)/htc.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/jpegdec/$(ATMOSPHERE_OUT_DIR)/jpegdec.elf $(DIST_DIR)/jpegdec.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/loader/$(ATMOSPHERE_OUT_DIR)/loader.elf $(DIST_DIR)/loader.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/LogManager/$(ATMOSPHERE_OUT_DIR)/LogManager.elf $(DIST_DIR)/LogManager.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/ncm/$(ATMOSPHERE_OUT_DIR)/ncm.elf $(DIST_DIR)/ncm.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/pgl/$(ATMOSPHERE_OUT_DIR)/pgl.elf $(DIST_DIR)/pgl.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/pm/$(ATMOSPHERE_OUT_DIR)/pm.elf $(DIST_DIR)/pm.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/ro/$(ATMOSPHERE_OUT_DIR)/ro.elf $(DIST_DIR)/ro.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/sm/$(ATMOSPHERE_OUT_DIR)/sm.elf $(DIST_DIR)/sm.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/spl/$(ATMOSPHERE_OUT_DIR)/spl.elf $(DIST_DIR)/spl.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/stratosphere/TioServer/$(ATMOSPHERE_OUT_DIR)/TioServer.elf $(DIST_DIR)/TioServer.elf
|
||||||
|
cp $(CURRENT_DIRECTORY)/troposphere/daybreak/daybreak.elf $(DIST_DIR)/daybreak.elf
|
||||||
|
cd $(DIST_DIR); zip -r ../atmosphere-$(ATMOSPHERE_VERSION)-debug.zip ./*; cd ../;
|
||||||
|
rm -rf $(DIST_DIR)
|
||||||
|
|
||||||
|
dist-no-debug: package3 $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
$(eval DIST_DIR = $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/atmosphere-$(ATMOSPHERE_VERSION))
|
||||||
|
rm -rf $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/*
|
||||||
|
rm -rf $(DIST_DIR)
|
||||||
|
mkdir $(DIST_DIR)
|
||||||
|
mkdir $(DIST_DIR)/atmosphere
|
||||||
|
mkdir $(DIST_DIR)/switch
|
||||||
|
mkdir -p $(DIST_DIR)/atmosphere/fatal_errors
|
||||||
|
mkdir -p $(DIST_DIR)/atmosphere/config_templates
|
||||||
|
mkdir -p $(DIST_DIR)/atmosphere/config
|
||||||
|
mkdir -p $(DIST_DIR)/atmosphere/flags
|
||||||
|
cp fusee/$(ATMOSPHERE_BOOT_OUT_DIR)/fusee.bin $(DIST_DIR)/atmosphere/reboot_payload.bin
|
||||||
|
cp fusee/$(ATMOSPHERE_BOOT_OUT_DIR)/package3 $(DIST_DIR)/atmosphere/package3
|
||||||
|
cp config_templates/stratosphere.ini $(DIST_DIR)/atmosphere/config_templates/stratosphere.ini
|
||||||
|
cp config_templates/override_config.ini $(DIST_DIR)/atmosphere/config_templates/override_config.ini
|
||||||
|
cp config_templates/system_settings.ini $(DIST_DIR)/atmosphere/config_templates/system_settings.ini
|
||||||
|
cp config_templates/exosphere.ini $(DIST_DIR)/atmosphere/config_templates/exosphere.ini
|
||||||
|
mkdir -p config_templates/kip_patches
|
||||||
|
cp -r config_templates/kip_patches $(DIST_DIR)/atmosphere/kip_patches
|
||||||
|
cp -r config_templates/hbl_html $(DIST_DIR)/atmosphere/hbl_html
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000008
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000000D
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000017
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000002B
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000032
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000034
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000036
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000037
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000003C
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000042
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000420
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000B240
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000D609
|
||||||
|
mkdir -p $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000D623
|
||||||
|
cp stratosphere/boot2/$(ATMOSPHERE_OUT_DIR)/boot2.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000008/exefs.nsp
|
||||||
|
cp stratosphere/dmnt/$(ATMOSPHERE_OUT_DIR)/dmnt.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000000D/exefs.nsp
|
||||||
|
cp stratosphere/cs/$(ATMOSPHERE_OUT_DIR)/cs.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000017/exefs.nsp
|
||||||
|
cp stratosphere/erpt/$(ATMOSPHERE_OUT_DIR)/erpt.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000002B/exefs.nsp
|
||||||
|
cp stratosphere/eclct.stub/$(ATMOSPHERE_OUT_DIR)/eclct.stub.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000032/exefs.nsp
|
||||||
|
cp stratosphere/fatal/$(ATMOSPHERE_OUT_DIR)/fatal.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000034/exefs.nsp
|
||||||
|
cp stratosphere/creport/$(ATMOSPHERE_OUT_DIR)/creport.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000036/exefs.nsp
|
||||||
|
cp stratosphere/ro/$(ATMOSPHERE_OUT_DIR)/ro.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000037/exefs.nsp
|
||||||
|
cp stratosphere/jpegdec/$(ATMOSPHERE_OUT_DIR)/jpegdec.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000003C/exefs.nsp
|
||||||
|
cp stratosphere/pgl/$(ATMOSPHERE_OUT_DIR)/pgl.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000042/exefs.nsp
|
||||||
|
cp stratosphere/LogManager/$(ATMOSPHERE_OUT_DIR)/LogManager.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/0100000000000420/exefs.nsp
|
||||||
|
cp stratosphere/htc/$(ATMOSPHERE_OUT_DIR)/htc.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000B240/exefs.nsp
|
||||||
|
cp stratosphere/dmnt.gen2/$(ATMOSPHERE_OUT_DIR)/dmnt.gen2.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000D609/exefs.nsp
|
||||||
|
cp stratosphere/TioServer/$(ATMOSPHERE_OUT_DIR)/TioServer.nsp $(DIST_DIR)/stratosphere_romfs/atmosphere/contents/010000000000D623/exefs.nsp
|
||||||
|
@build_romfs $(DIST_DIR)/stratosphere_romfs $(DIST_DIR)/atmosphere/stratosphere.romfs
|
||||||
|
rm -r $(DIST_DIR)/stratosphere_romfs
|
||||||
|
cp troposphere/reboot_to_payload/reboot_to_payload.nro $(DIST_DIR)/switch/reboot_to_payload.nro
|
||||||
|
cp troposphere/daybreak/daybreak.nro $(DIST_DIR)/switch/daybreak.nro
|
||||||
|
cd $(DIST_DIR); zip -r ../atmosphere-$(ATMOSPHERE_VERSION).zip ./*; cd ../;
|
||||||
|
rm -rf $(DIST_DIR)
|
||||||
|
cp fusee/$(ATMOSPHERE_BOOT_OUT_DIR)/fusee.bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/fusee.bin
|
||||||
|
|
||||||
|
package3: emummc fusee stratosphere mesosphere exosphere troposphere
|
||||||
|
@python fusee/build_package3.py $(CURRENT_DIRECTORY) $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BOOT_OUT_DIR) $(ATMOSPHERE_GIT_HASH) $(ATMOSPHERE_MAJOR_VERSION) $(ATMOSPHERE_MINOR_VERSION) $(ATMOSPHERE_MICRO_VERSION) 0 $(ATMOSPHERE_SUPPORTED_HOS_MAJOR_VERSION) $(ATMOSPHERE_SUPPORTED_HOS_MINOR_VERSION) $(ATMOSPHERE_SUPPORTED_HOS_MICRO_VERSION) 0
|
||||||
|
@echo "Built package3!"
|
||||||
|
|
||||||
|
emummc:
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/emummc all
|
||||||
|
|
||||||
|
fusee: libexosphere_boot
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/fusee -f $(CURRENT_DIRECTORY)/fusee/fusee.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
|
||||||
|
exosphere: libexosphere libexosphere_boot
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/exosphere -f $(CURRENT_DIRECTORY)/exosphere/exosphere.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1
|
||||||
|
|
||||||
|
stratosphere: fusee libstratosphere
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/stratosphere -f $(CURRENT_DIRECTORY)/stratosphere/stratosphere.mk ATMOSPHERE_CHECKED_LIBSTRATOSPHERE=1 ATMOSPHERE_CHECKED_FUSEE=1
|
||||||
|
|
||||||
|
mesosphere: libmesosphere
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/mesosphere -f $(CURRENT_DIRECTORY)/mesosphere/mesosphere.mk ATMOSPHERE_CHECKED_LIBMESOSPHERE=1
|
||||||
|
|
||||||
|
troposphere:
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/troposphere all
|
||||||
|
|
||||||
|
libexosphere:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
|
||||||
|
ifneq ($(strip $(ATMOSPHERE_LIBRARY_DIR)),$(strip $(ATMOSPHERE_BOOT_LIBRARY_DIR)))
|
||||||
|
libexosphere_boot:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
else
|
||||||
|
libexosphere_boot: libexosphere
|
||||||
|
endif
|
||||||
|
|
||||||
|
libmesosphere:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libmesosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libmesosphere/libmesosphere.mk
|
||||||
|
|
||||||
|
libstratosphere:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/libstratosphere.mk
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/fusee -f $(CURRENT_DIRECTORY)/fusee/fusee.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/emummc clean
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/exosphere -f $(CURRENT_DIRECTORY)/exosphere/exosphere.mk clean
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/mesosphere -f $(CURRENT_DIRECTORY)/mesosphere/mesosphere.mk clean
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/stratosphere -f $(CURRENT_DIRECTORY)/stratosphere/stratosphere.mk clean
|
||||||
|
$(MAKE) -C $(CURRENT_DIRECTORY)/troposphere clean
|
||||||
|
$(MAKE) -C $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/libstratosphere.mk clean
|
||||||
|
$(MAKE) -C $(ATMOSPHERE_LIBRARIES_DIR)/libmesosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libmesosphere/libmesosphere.mk clean
|
||||||
|
$(MAKE) -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk clean
|
||||||
|
$(MAKE) -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
rm -rf $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR) $(CURRENT_DIRECTORY)/$(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
.PHONY: dist dist-no-debug clean package3 emummc fusee stratosphere mesosphere exosphere troposphere
|
||||||
@@ -1,75 +1,41 @@
|
|||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
all: release
|
all: nx_release
|
||||||
|
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): exosphere$(strip $2).bin warmboot$(strip $2).bin mariko_fatal$(strip $2).bin
|
$(strip $1):
|
||||||
|
@echo "Building $(strip $1)"
|
||||||
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/exosphere.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
exosphere$(strip $2).bin: loader_stub/loader_stub$(strip $2).bin
|
clean-$(strip $1):
|
||||||
@cp loader_stub/loader_stub$(strip $2).bin exosphere$(strip $2).bin
|
@echo "Cleaning $(strip $1)"
|
||||||
@printf LENY >> exosphere$(strip $2).bin
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/exosphere.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
@echo "Built exosphere$(strip $2).bin..."
|
|
||||||
|
|
||||||
warmboot$(strip $2).bin: warmboot/warmboot$(strip $2).bin
|
|
||||||
@cp warmboot/warmboot$(strip $2).bin warmboot$(strip $2).bin
|
|
||||||
@echo "Built warmboot$(strip $2).bin..."
|
|
||||||
|
|
||||||
mariko_fatal$(strip $2).bin: mariko_fatal/mariko_fatal$(strip $2).bin
|
|
||||||
@cp mariko_fatal/mariko_fatal$(strip $2).bin mariko_fatal$(strip $2).bin
|
|
||||||
@echo "Built mariko_fatal$(strip $2).bin..."
|
|
||||||
|
|
||||||
check_program_$(strip $1):
|
|
||||||
@$$(MAKE) -C program $(strip $1)
|
|
||||||
|
|
||||||
check_warmboot_$(strip $1):
|
|
||||||
@$$(MAKE) -C warmboot $(strip $1)
|
|
||||||
|
|
||||||
check_mariko_fatal_$(strip $1):
|
|
||||||
@$$(MAKE) -C mariko_fatal $(strip $1)
|
|
||||||
|
|
||||||
loader_stub/loader_stub$(strip $2).bin: check_program_$(strip $1)
|
|
||||||
@$$(MAKE) -C loader_stub $(strip $1)
|
|
||||||
|
|
||||||
warmboot/warmboot$(strip $2).bin: check_warmboot_$(strip $1)
|
|
||||||
|
|
||||||
mariko_fatal/mariko_fatal$(strip $2).bin: check_mariko_fatal_$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1): clean-program-$(strip $1) clean-loader_stub-$(strip $1) clean-warmboot-$(strip $1) clean-mariko_fatal-$(strip $1)
|
|
||||||
@rm -rf exosphere$(strip $2).bin warmboot$(strip $2).bin mariko_fatal$(strip $2).bin
|
|
||||||
|
|
||||||
clean-program-$(strip $1):
|
|
||||||
@$$(MAKE) -C program clean-$(strip $1)
|
|
||||||
|
|
||||||
clean-loader_stub-$(strip $1):
|
|
||||||
@$$(MAKE) -C loader_stub clean-$(strip $1)
|
|
||||||
|
|
||||||
clean-warmboot-$(strip $1):
|
|
||||||
@$$(MAKE) -C warmboot clean-$(strip $1)
|
|
||||||
|
|
||||||
clean-mariko_fatal-$(strip $1):
|
|
||||||
@$$(MAKE) -C mariko_fatal clean-$(strip $1)
|
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, ))
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug))
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit))
|
|
||||||
|
|
||||||
clean: clean-program clean-loader_stub clean-warmboot
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
@rm -rf exosphere*.bin warmboot*.bin mariko_fatal*.bin
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
|
))
|
||||||
|
|
||||||
clean-program:
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
@$(MAKE) -C program clean
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
clean-loader_stub:
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
@$(MAKE) -C loader_stub clean
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
clean-warmboot:
|
endef
|
||||||
@$(MAKE) -C warmboot clean
|
|
||||||
|
|
||||||
clean-mariko_fatal:
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
@$(MAKE) -C mariko_fatal clean
|
|
||||||
|
|
||||||
.PHONY: all clean clean-program clean-loader_stub clean-warmboot $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),check_program_$(config) check_warmboot_$(strip $1) clean-$(config) clean-program-$(config) clean-loader_stub-$(config) clean-warmboot-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|||||||
75
exosphere/exosphere.mk
Normal file
75
exosphere/exosphere.mk
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../libraries/config/common.mk
|
||||||
|
|
||||||
|
all: $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/exosphere.bin $(CURRENT_DIRECTORY)/warmboot/$(ATMOSPHERE_BOOT_OUT_DIR)/warmboot.bin $(CURRENT_DIRECTORY)/mariko_fatal/$(ATMOSPHERE_OUT_DIR)/mariko_fatal.bin
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/exosphere.bin: $(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
@cp $(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/exosphere.bin
|
||||||
|
@printf LENY >> $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/exosphere.bin
|
||||||
|
@echo "Built exosphere.bin..."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin: check_loader_stub
|
||||||
|
@$(SILENTCMD)echo "Checked loader stub."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/program/$(ATMOSPHERE_OUT_DIR)/program.lz4: check_program
|
||||||
|
@$(SILENTCMD)echo "Checked program."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/warmboot/$(ATMOSPHERE_BOOT_OUT_DIR)/warmboot.bin: check_warmboot
|
||||||
|
@$(SILENTCMD)echo "Checked warmboot."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/mariko_fatal/$(ATMOSPHERE_OUT_DIR)/mariko_fatal.bin: check_mariko_fatal
|
||||||
|
@$(SILENTCMD)echo "Checked mariko fatal."
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifneq ($(strip $(ATMOSPHERE_LIBRARY_DIR)),$(strip $(ATMOSPHERE_BOOT_LIBRARY_DIR)))
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a: check_boot_lib
|
||||||
|
@$(SILENTCMD)echo "Checked boot library."
|
||||||
|
endif
|
||||||
|
|
||||||
|
check_loader_stub: $(CURRENT_DIRECTORY)/program/$(ATMOSPHERE_OUT_DIR)/program.lz4
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/loader_stub -f $(CURRENT_DIRECTORY)/loader_stub/loader_stub.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_EXOSPHERE_PROGRAM=1
|
||||||
|
|
||||||
|
check_program: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/program -f $(CURRENT_DIRECTORY)/program/program.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1
|
||||||
|
|
||||||
|
check_mariko_fatal: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/mariko_fatal -f $(CURRENT_DIRECTORY)/mariko_fatal/mariko_fatal.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1
|
||||||
|
|
||||||
|
check_warmboot: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/warmboot -f $(CURRENT_DIRECTORY)/warmboot/warmboot.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1 ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE),1)
|
||||||
|
check_boot_lib:
|
||||||
|
else
|
||||||
|
check_boot_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/loader_stub -f $(CURRENT_DIRECTORY)/loader_stub/loader_stub.mk clean
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/program -f $(CURRENT_DIRECTORY)/program/program.mk clean
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/mariko_fatal -f $(CURRENT_DIRECTORY)/mariko_fatal/mariko_fatal.mk clean
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/warmboot -f $(CURRENT_DIRECTORY)/warmboot/warmboot.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk clean
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
@rm -fr $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
@for i in $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR); do [ -d $$i ] && rmdir --ignore-fail-on-non-empty $$i || true; done
|
||||||
|
|
||||||
|
.PHONY: all clean check_lib check_boot_lib check_loader_stub check_program check_mariko_fatal check_warmboot
|
||||||
@@ -1,158 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm-cortex-a57
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_SRC) program.lz4.o boot_code.lz4.o
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
ATMOSPHERE_BUILD_TARGET_IDENTIFIER=$(strip $1)\
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/loader_stub.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX=$(strip $2)\
|
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf $$(OUTPUT_BASE)$(strip $2).lz4 boot_code$(strip $2).lz4
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/loader_stub.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
|
|
||||||
program.lz4.o: program_lz4.h
|
|
||||||
|
|
||||||
program_lz4.h: $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@rm -rf tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@mkdir -p tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@cp $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4 tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/program.lz4
|
|
||||||
@bin2s -a 8 -H program_lz4.h tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/program.lz4 | $(AS) -o program.lz4.o
|
|
||||||
@rm -rf tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
$(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4:
|
|
||||||
@$(MAKE) __RECURSIVE__=0 --no-print-directory -C $(TOPDIR)/../program $(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
boot_code.lz4.o: boot_code_lz4.h
|
|
||||||
|
|
||||||
boot_code_lz4.h: $(TOPDIR)/../program/boot_code$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@rm -rf tmp_boot_code_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@mkdir -p tmp_boot_code_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@cp $(TOPDIR)/../program/boot_code$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4 tmp_boot_code_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/boot_code.lz4
|
|
||||||
@bin2s -a 8 -H boot_code_lz4.h tmp_boot_code_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/boot_code.lz4 | $(AS) -o boot_code.lz4.o
|
|
||||||
@rm -rf tmp_boot_code_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
$(TOPDIR)/../program/boot_code$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4: $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : program_lz4.h boot_code_lz4.h
|
|
||||||
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
132
exosphere/loader_stub/loader_stub.mk
Normal file
132
exosphere/loader_stub/loader_stub.mk
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
|
||||||
|
$(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES := program.lz4 boot_code.lz4
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib check_exo_program
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a $(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)/program.lz4
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)/program.lz4: check_exo_program
|
||||||
|
@$(SILENTCMD)echo "Checked exosphere program."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_EXOSPHERE_PROGRAM),1)
|
||||||
|
check_exo_program:
|
||||||
|
else
|
||||||
|
check_exo_program: check_lib
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/../program -f $(CURRENT_DIRECTORY)/../program/program.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
program.lz4.o: program.lz4
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
boot_code.lz4.o: boot_code.lz4
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(OFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /loader_stub.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /loader_stub.ld) --gc-sections --nmagic
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
NORETURN void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) {
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line) {
|
||||||
AMS_UNUSED(file, line, func, expr, value, format);
|
AMS_UNUSED(expr, func, line, file);
|
||||||
ams::secmon::loader::ErrorReboot();
|
ams::secmon::loader::ErrorReboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value) {
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||||
AMS_UNUSED(file, line, func, expr, value);
|
AMS_UNUSED(expr, func, line, file, format);
|
||||||
ams::secmon::loader::ErrorReboot();
|
ams::secmon::loader::ErrorReboot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,141 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm-cortex-a57
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/mariko_fatal.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/mariko_fatal.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
diskio.o ff.o: CFLAGS += -Wno-error
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
115
exosphere/mariko_fatal/mariko_fatal.mk
Normal file
115
exosphere/mariko_fatal/mariko_fatal.mk
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
diskio.o ff.o: CFLAGS += -Wno-error -Wno-unused-parameter -Wno-implicit-fallthrough
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /mariko_fatal.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /mariko_fatal.ld) --gc-sections --nmagic
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
AMS_SECMON_LOG("AbortImpl was called\n");
|
AMS_SECMON_LOG("AbortImpl was called\n");
|
||||||
AMS_LOG_FLUSH();
|
AMS_LOG_FLUSH();
|
||||||
reg::Write(0x4, 0xAAAAAAAA);
|
reg::Write(0x4, 0xAAAAAAAA);
|
||||||
|
|||||||
@@ -1,163 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm-cortex-a57
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_SRC) rebootstub.bin.o sc7fw.bin.o
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
ATMOSPHERE_BUILD_TARGET_IDENTIFIER=$(strip $1)\
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/program.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX=$(strip $2)\
|
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf $$(OUTPUT_BASE)$(strip $2).lz4 boot_code$(strip $2).lz4
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/program.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).lz4 : $(OUTPUT).bin
|
|
||||||
@python $(TOPDIR)/split_program.py $(OUTPUT).bin "$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX)" $(dir $(OUTPUT))
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
secmon_crt0_cpp.o secmon_make_page_table.o : CFLAGS += -fno-builtin
|
|
||||||
|
|
||||||
rebootstub.bin.o: rebootstub_bin.h
|
|
||||||
|
|
||||||
rebootstub_bin.h: $(TOPDIR)/rebootstub/rebootstub$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@rm -rf tmp_rebootstub_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@mkdir -p tmp_rebootstub_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@cp $(TOPDIR)/rebootstub/rebootstub$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin tmp_rebootstub_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/rebootstub.bin
|
|
||||||
@bin2s -a 8 -H rebootstub_bin.h tmp_rebootstub_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/rebootstub.bin | $(AS) -o rebootstub.bin.o
|
|
||||||
@rm -rf tmp_rebootstub_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
$(TOPDIR)/rebootstub/rebootstub$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin:
|
|
||||||
@$(MAKE) __RECURSIVE__=0 --no-print-directory -C $(TOPDIR)/rebootstub $(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
sc7fw.bin.o: sc7fw_bin.h
|
|
||||||
|
|
||||||
sc7fw.bin.o sc7fw_bin.h: $(TOPDIR)/sc7fw/sc7fw$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@rm -rf tmp_sc7fw_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@mkdir -p tmp_sc7fw_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@cp $(TOPDIR)/sc7fw/sc7fw$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin tmp_sc7fw_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/sc7fw.bin
|
|
||||||
@bin2s -a 8 -H sc7fw_bin.h tmp_sc7fw_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/sc7fw.bin | $(AS) -o sc7fw.bin.o
|
|
||||||
@rm -rf tmp_sc7fw_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
$(TOPDIR)/sc7fw/sc7fw$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).bin:
|
|
||||||
@$(MAKE) __RECURSIVE__=0 --no-print-directory -C $(TOPDIR)/sc7fw $(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : rebootstub_bin.h sc7fw_bin.h
|
|
||||||
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
162
exosphere/program/program.mk
Normal file
162
exosphere/program/program.mk
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
|
||||||
|
$(CURRENT_DIRECTORY)/sc7fw/$(ATMOSPHERE_BOOT_OUT_DIR) \
|
||||||
|
$(CURRENT_DIRECTORY)/rebootstub/$(ATMOSPHERE_BOOT_OUT_DIR)
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES := sc7fw.bin rebootstub.bin
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib check_boot_lib check_sc7fw check_rebootstub
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a $(CURRENT_DIRECTORY)/sc7fw/$(ATMOSPHERE_BOOT_OUT_DIR)/sc7fw.bin $(CURRENT_DIRECTORY)/rebootstub/$(ATMOSPHERE_BOOT_OUT_DIR)/rebootstub.bin
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
|
||||||
|
ifneq ($(strip $(ATMOSPHERE_LIBRARY_DIR)),$(strip $(ATMOSPHERE_BOOT_LIBRARY_DIR)))
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a: check_boot_lib
|
||||||
|
@$(SILENTCMD)echo "Checked boot library."
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/sc7fw/$(ATMOSPHERE_BOOT_OUT_DIR)/sc7fw.bin: check_sc7fw
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/rebootstub/$(ATMOSPHERE_BOOT_OUT_DIR)/rebootstub.bin: check_rebootstub
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_SC7FW),1)
|
||||||
|
check_sc7fw:
|
||||||
|
else
|
||||||
|
check_sc7fw: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/sc7fw -f $(CURRENT_DIRECTORY)/sc7fw/sc7fw.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))" ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_REBOOTSTUB),1)
|
||||||
|
check_rebootstub:
|
||||||
|
else
|
||||||
|
check_rebootstub: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_BOOT_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/rebootstub -f $(CURRENT_DIRECTORY)/rebootstub/rebootstub.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))" ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_BOOT_LIBEXOSPHERE),1)
|
||||||
|
check_boot_lib:
|
||||||
|
else
|
||||||
|
check_boot_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/rebootstub -f $(CURRENT_DIRECTORY)/rebootstub/rebootstub.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/sc7fw -f $(CURRENT_DIRECTORY)/sc7fw/sc7fw.mk clean ATMOSPHERE_CPU="$(strip $(ATMOSPHERE_BOOT_CPU))"
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).lz4 : $(OUTPUT).bin
|
||||||
|
@python $(CURRENT_DIRECTORY)/split_program.py $(OUTPUT).bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
secmon_crt0_cpp.o secmon_make_page_table.o : CFLAGS += -fno-builtin
|
||||||
|
|
||||||
|
sc7fw.bin.o: sc7fw.bin
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
rebootstub.bin.o: rebootstub.bin
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(OFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /program.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /program.ld) --gc-sections --nmagic
|
||||||
@@ -1,139 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/rebootstub.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/rebootstub.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
113
exosphere/program/rebootstub/rebootstub.mk
Normal file
113
exosphere/program/rebootstub/rebootstub.mk
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /rebootstub.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /rebootstub.ld) --gc-sections --nmagic
|
||||||
@@ -50,7 +50,7 @@ namespace ams::rebootstub {
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
/* Halt the bpmp. */
|
/* Halt the bpmp. */
|
||||||
rebootstub::Halt();
|
rebootstub::Halt();
|
||||||
|
|
||||||
|
|||||||
@@ -1,139 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/sc7fw.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/sc7fw.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
113
exosphere/program/sc7fw/sc7fw.mk
Normal file
113
exosphere/program/sc7fw/sc7fw.mk
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /sc7fw.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /sc7fw.ld) --gc-sections --nmagic
|
||||||
@@ -111,7 +111,7 @@ namespace ams::sc7fw {
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
sc7fw::ExceptionHandler();
|
sc7fw::ExceptionHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace ams::diag {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
/* Perform any necessary (typically none) debugging. */
|
/* Perform any necessary (typically none) debugging. */
|
||||||
if constexpr (SaveSystemStateForDebug) {
|
if constexpr (SaveSystemStateForDebug) {
|
||||||
SaveSystemStateForDebugAbort();
|
SaveSystemStateForDebugAbort();
|
||||||
|
|||||||
@@ -408,6 +408,7 @@ namespace ams::secmon::smc {
|
|||||||
/* Log our suspension. */
|
/* Log our suspension. */
|
||||||
/* NOTE: Nintendo only does this on dev, but we will always do it. */
|
/* NOTE: Nintendo only does this on dev, but we will always do it. */
|
||||||
if (true /* !pkg1::IsProduction() */) {
|
if (true /* !pkg1::IsProduction() */) {
|
||||||
|
log::Initialize(secmon::GetLogPort(), secmon::GetLogBaudRate(), secmon::GetLogFlags());
|
||||||
log::SendText("OYASUMI\n", 8);
|
log::SendText("OYASUMI\n", 8);
|
||||||
log::Flush();
|
log::Flush();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,17 +20,17 @@ def split_binary(data):
|
|||||||
#print ('%X %X %X %X' % (START, BOOT_CODE_START, BOOT_CODE_END, PROGRAM_START))
|
#print ('%X %X %X %X' % (START, BOOT_CODE_START, BOOT_CODE_END, PROGRAM_START))
|
||||||
boot_code = data[BOOT_CODE_START - START:BOOT_CODE_END - BOOT_CODE_START]
|
boot_code = data[BOOT_CODE_START - START:BOOT_CODE_END - BOOT_CODE_START]
|
||||||
program = data[PROGRAM_START - START:]
|
program = data[PROGRAM_START - START:]
|
||||||
return [('boot_code%s.lz4', lz4_compress(boot_code)), ('program%s.lz4', lz4_compress(program))]
|
return [('boot_code.lz4', lz4_compress(boot_code)), ('program.lz4', lz4_compress(program))]
|
||||||
|
|
||||||
def main(argc, argv):
|
def main(argc, argv):
|
||||||
if argc != 4:
|
if argc != 3:
|
||||||
print('Usage: %s in suffix outdir' % argv[0])
|
print('Usage: %s in outdir' % argv[0])
|
||||||
return 1
|
return 1
|
||||||
with open(argv[1], 'rb') as f:
|
with open(argv[1], 'rb') as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
assert len(data) >= 0x40
|
assert len(data) >= 0x40
|
||||||
for (fn, fdata) in split_binary(data):
|
for (fn, fdata) in split_binary(data):
|
||||||
with open('%s/%s' % (argv[3], fn % argv[2]), 'wb') as f:
|
with open('%s/%s' % (argv[2], fn), 'wb') as f:
|
||||||
f.write(fdata)
|
f.write(fdata)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
@@ -1,139 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/warmboot.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/warmboot.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace ams::warmboot {
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
warmboot::ExceptionHandler();
|
warmboot::ExceptionHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
113
exosphere/warmboot/warmboot.mk
Normal file
113
exosphere/warmboot/warmboot.mk
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /warmboot.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /warmboot.ld) --gc-sections --nmagic
|
||||||
@@ -1,44 +1,41 @@
|
|||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
all: release
|
all: nx_release
|
||||||
|
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): fusee$(strip $2).bin
|
$(strip $1):
|
||||||
|
@echo "Building $(strip $1)"
|
||||||
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/fusee.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
fusee$(strip $2).bin: loader_stub/loader_stub$(strip $2).bin
|
clean-$(strip $1):
|
||||||
@cp loader_stub/loader_stub$(strip $2).bin fusee$(strip $2).bin
|
@echo "Cleaning $(strip $1)"
|
||||||
@echo "Built fusee$(strip $2).bin..."
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/fusee.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
check_program_$(strip $1):
|
|
||||||
@$$(MAKE) -C program $(strip $1)
|
|
||||||
|
|
||||||
loader_stub/loader_stub$(strip $2).bin: check_program_$(strip $1)
|
|
||||||
@$$(MAKE) -C loader_stub $(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1): clean-program-$(strip $1) clean-loader_stub-$(strip $1)
|
|
||||||
@rm -rf fusee$(strip $2).bin
|
|
||||||
|
|
||||||
clean-program-$(strip $1):
|
|
||||||
@$$(MAKE) -C program clean-$(strip $1)
|
|
||||||
|
|
||||||
clean-loader_stub-$(strip $1):
|
|
||||||
@$$(MAKE) -C loader_stub clean-$(strip $1)
|
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, ))
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug))
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit))
|
|
||||||
|
|
||||||
clean: clean-program clean-loader_stub
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
@rm -rf fusee*.bin package3*
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
|
))
|
||||||
|
|
||||||
clean-program:
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
@$(MAKE) -C program clean
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
clean-loader_stub:
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
@$(MAKE) -C loader_stub clean
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
.PHONY: all clean clean-program clean-loader_stub $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),check_program_$(config) check_warmboot_$(strip $1) clean-$(config) clean-program-$(config) clean-loader_stub-$(config) clean-warmboot-$(config))
|
endef
|
||||||
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ def get_overlay(program, i):
|
|||||||
|
|
||||||
KIP_NAMES = [b'Loader', b'NCM', b'ProcessManager', b'sm', b'boot', b'spl', b'ams_mitm']
|
KIP_NAMES = [b'Loader', b'NCM', b'ProcessManager', b'sm', b'boot', b'spl', b'ams_mitm']
|
||||||
|
|
||||||
def get_kips(ams_dir):
|
def get_kips(ams_dir, build_out_dir):
|
||||||
emummc = read_file(os.path.join(ams_dir, 'emummc/emummc_unpacked.kip'))
|
emummc = read_file(os.path.join(ams_dir, 'emummc/emummc_unpacked.kip'))
|
||||||
loader = read_file(os.path.join(ams_dir, 'stratosphere/loader/loader.kip'))
|
loader = read_file(os.path.join(ams_dir, 'stratosphere/loader/%s/loader.kip' % build_out_dir))
|
||||||
ncm = read_file(os.path.join(ams_dir, 'stratosphere/ncm/ncm.kip'))
|
ncm = read_file(os.path.join(ams_dir, 'stratosphere/ncm/%s/ncm.kip' % build_out_dir))
|
||||||
pm = read_file(os.path.join(ams_dir, 'stratosphere/pm/pm.kip'))
|
pm = read_file(os.path.join(ams_dir, 'stratosphere/pm/%s/pm.kip' % build_out_dir))
|
||||||
sm = read_file(os.path.join(ams_dir, 'stratosphere/sm/sm.kip'))
|
sm = read_file(os.path.join(ams_dir, 'stratosphere/sm/%s/sm.kip' % build_out_dir))
|
||||||
boot = read_file(os.path.join(ams_dir, 'stratosphere/boot/boot.kip'))
|
boot = read_file(os.path.join(ams_dir, 'stratosphere/boot/%s/boot.kip' % build_out_dir))
|
||||||
spl = read_file(os.path.join(ams_dir, 'stratosphere/spl/spl.kip'))
|
spl = read_file(os.path.join(ams_dir, 'stratosphere/spl/%s/spl.kip' % build_out_dir))
|
||||||
ams_mitm = read_file(os.path.join(ams_dir, 'stratosphere/ams_mitm/ams_mitm.kip'))
|
ams_mitm = read_file(os.path.join(ams_dir, 'stratosphere/ams_mitm/%s/ams_mitm.kip' % build_out_dir))
|
||||||
return (emummc, {
|
return (emummc, {
|
||||||
b'Loader' : loader,
|
b'Loader' : loader,
|
||||||
b'NCM' : ncm,
|
b'NCM' : ncm,
|
||||||
@@ -134,39 +134,40 @@ def write_kips(f, all_kips):
|
|||||||
f.write(b'\xCC' * (0x300000 - tot))
|
f.write(b'\xCC' * (0x300000 - tot))
|
||||||
|
|
||||||
def main(argc, argv):
|
def main(argc, argv):
|
||||||
if argc != 12:
|
if argc != 13:
|
||||||
print('Usage: %s ams_dir target revision major minor micro relstep s_major s_minor s_micro s_relstep' % argv[0])
|
print('Usage: %s ams_dir build_out_dir build_boot_out_dir revision major minor micro relstep s_major s_minor s_micro s_relstep' % argv[0])
|
||||||
return 1
|
return 1
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
ams_dir = argv[1]
|
ams_dir = argv[1]
|
||||||
target = '' if argv[2] == 'release' else ('_%s' % argv[2])
|
build_out_dir = argv[2]
|
||||||
revision = int(argv[3][:8], 16)
|
build_boot_out_dir = argv[3]
|
||||||
major = int(argv[4])
|
revision = int(argv[4][:8], 16)
|
||||||
minor = int(argv[5])
|
major = int(argv[5])
|
||||||
micro = int(argv[6])
|
minor = int(argv[6])
|
||||||
relstep = int(argv[7])
|
micro = int(argv[7])
|
||||||
s_major = int(argv[8])
|
relstep = int(argv[8])
|
||||||
s_minor = int(argv[9])
|
s_major = int(argv[9])
|
||||||
s_micro = int(argv[10])
|
s_minor = int(argv[10])
|
||||||
s_relstep = int(argv[11])
|
s_micro = int(argv[11])
|
||||||
|
s_relstep = int(argv[12])
|
||||||
# Read/parse fusee
|
# Read/parse fusee
|
||||||
fusee_program = read_file(os.path.join(ams_dir, 'fusee/program/program%s.bin' % target))
|
fusee_program = read_file(os.path.join(ams_dir, 'fusee/program/%s/program.bin' % build_boot_out_dir))
|
||||||
fusee_bin = read_file(os.path.join(ams_dir, 'fusee/fusee%s.bin' % target))
|
fusee_bin = read_file(os.path.join(ams_dir, 'fusee/%s/fusee.bin' % build_boot_out_dir))
|
||||||
erista_mtc = get_overlay(fusee_program, 1)
|
erista_mtc = get_overlay(fusee_program, 1)
|
||||||
mariko_mtc = get_overlay(fusee_program, 2)
|
mariko_mtc = get_overlay(fusee_program, 2)
|
||||||
erista_hsh = hashlib.sha256(erista_mtc[:-4]).digest()[:4]
|
erista_hsh = hashlib.sha256(erista_mtc[:-4]).digest()[:4]
|
||||||
mariko_hsh = hashlib.sha256(mariko_mtc[:-4]).digest()[:4]
|
mariko_hsh = hashlib.sha256(mariko_mtc[:-4]).digest()[:4]
|
||||||
# Read other files
|
# Read other files
|
||||||
exosphere = read_file(os.path.join(ams_dir, 'exosphere/exosphere%s.bin' % target))
|
exosphere = read_file(os.path.join(ams_dir, 'exosphere/%s/exosphere.bin' % build_out_dir))
|
||||||
warmboot = read_file(os.path.join(ams_dir, 'exosphere/warmboot%s.bin' % target))
|
warmboot = read_file(os.path.join(ams_dir, 'exosphere/warmboot/%s/warmboot.bin' % build_boot_out_dir))
|
||||||
mariko_fatal = read_file(os.path.join(ams_dir, 'exosphere/mariko_fatal%s.bin' % target))
|
mariko_fatal = read_file(os.path.join(ams_dir, 'exosphere/mariko_fatal/%s/mariko_fatal.bin' % build_out_dir))
|
||||||
rebootstub = read_file(os.path.join(ams_dir, 'exosphere/program/rebootstub/rebootstub%s.bin' % target))
|
rebootstub = read_file(os.path.join(ams_dir, 'exosphere/program/rebootstub/%s/rebootstub.bin' % build_boot_out_dir))
|
||||||
mesosphere = read_file(os.path.join(ams_dir, 'mesosphere/mesosphere%s.bin' % target))
|
mesosphere = read_file(os.path.join(ams_dir, 'mesosphere/%s/mesosphere.bin' % build_out_dir))
|
||||||
all_kips = get_kips(ams_dir)
|
all_kips = get_kips(ams_dir, build_out_dir)
|
||||||
tsec_keygen = read_file(os.path.join(ams_dir, 'fusee/program/tsec_keygen/tsec_keygen.bin'))
|
tsec_keygen = read_file(os.path.join(ams_dir, 'fusee/program/tsec_keygen/tsec_keygen.bin'))
|
||||||
splash_bin = read_file(os.path.join(ams_dir, 'img/splash.bin'))
|
splash_bin = read_file(os.path.join(ams_dir, 'img/splash.bin'))
|
||||||
assert len(splash_bin) == 0x3C0000
|
assert len(splash_bin) == 0x3C0000
|
||||||
with open(os.path.join(ams_dir, 'fusee/package3%s' % target), 'wb') as f:
|
with open(os.path.join(ams_dir, 'fusee/%s/package3' % build_boot_out_dir), 'wb') as f:
|
||||||
# Write header
|
# Write header
|
||||||
write_header(f, all_kips, len(warmboot), len(tsec_keygen), len(mariko_fatal), len(exosphere), len(mesosphere), len(fusee_bin), len(rebootstub), revision, major, minor, micro, relstep, s_major, s_minor, s_micro, s_relstep)
|
write_header(f, all_kips, len(warmboot), len(tsec_keygen), len(mariko_fatal), len(exosphere), len(mesosphere), len(fusee_bin), len(rebootstub), revision, major, minor, micro, relstep, s_major, s_minor, s_micro, s_relstep)
|
||||||
# Write warmboot
|
# Write warmboot
|
||||||
|
|||||||
48
fusee/fusee.mk
Normal file
48
fusee/fusee.mk
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../libraries/config/common.mk
|
||||||
|
|
||||||
|
all: $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/fusee.bin
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/fusee.bin: $(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
@cp $(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/fusee.bin
|
||||||
|
@echo "Built fusee.bin..."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/loader_stub/$(ATMOSPHERE_OUT_DIR)/loader_stub.bin: check_loader_stub
|
||||||
|
@$(SILENTCMD)echo "Checked loader stub."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/program/$(ATMOSPHERE_OUT_DIR)/program.bin: check_program
|
||||||
|
@$(SILENTCMD)echo "Checked program."
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
check_loader_stub: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a $(CURRENT_DIRECTORY)/program/$(ATMOSPHERE_OUT_DIR)/program.bin
|
||||||
|
@$(SILENTCMD)echo "Checking loader stub..."
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/loader_stub -f $(CURRENT_DIRECTORY)/loader_stub/loader_stub.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1 ATMOSPHERE_CHECKED_FUSEE_PROGRAM=1
|
||||||
|
|
||||||
|
check_program: $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(SILENTCMD)echo "Checking program..."
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/program -f $(CURRENT_DIRECTORY)/program/program.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/loader_stub -f $(CURRENT_DIRECTORY)/loader_stub/loader_stub.mk clean
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/program -f $(CURRENT_DIRECTORY)/program/program.mk clean
|
||||||
|
@rm -fr $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
@for i in $(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR); do [ -d $$i ] && rmdir --ignore-fail-on-non-empty $$i || true; done
|
||||||
|
|
||||||
|
.PHONY: all clean check_lib check_loader_stub check_program
|
||||||
@@ -1,154 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC) program.lz4.o
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
ATMOSPHERE_BUILD_TARGET_IDENTIFIER=$(strip $1) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/loader_stub.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX=$(strip $2) \
|
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/loader_stub.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
program.lz4.o: program_lz4.h
|
|
||||||
|
|
||||||
program_lz4.h: $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@rm -rf tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@mkdir -p tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
@cp $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4 tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/program.lz4
|
|
||||||
@bin2s -a 8 -H program_lz4.h tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)/program.lz4 | $(AS) -o program.lz4.o
|
|
||||||
@rm -rf tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
$(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4:
|
|
||||||
@$(MAKE) __RECURSIVE__=0 --no-print-directory -C $(TOPDIR)/../program $(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN) program_lz4.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
127
fusee/loader_stub/loader_stub.mk
Normal file
127
fusee/loader_stub/loader_stub.mk
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) $(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES := program.lz4
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a $(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)/program.lz4
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
$(CURRENT_DIRECTORY)/../program/$(ATMOSPHERE_OUT_DIR)/program.lz4: check_fusee_program
|
||||||
|
@$(SILENTCMD)echo "Checked fusee program."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_FUSEE_PROGRAM),1)
|
||||||
|
check_fusee_program:
|
||||||
|
else
|
||||||
|
check_fusee_program: check_lib
|
||||||
|
@$(MAKE) --no-print-directory -C $(CURRENT_DIRECTORY)/../program -f $(CURRENT_DIRECTORY)/../program/program.mk ATMOSPHERE_CHECKED_LIBEXOSPHERE=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
program.lz4.o: program.lz4
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(OFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /loader_stub.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /loader_stub.ld) --gc-sections --nmagic
|
||||||
@@ -18,13 +18,15 @@
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
NORETURN void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) {
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line) {
|
||||||
AMS_UNUSED(file, line, func, expr, value, format);
|
AMS_UNUSED(expr, func, line, file);
|
||||||
|
|
||||||
ams::nxboot::loader::ErrorStop();
|
ams::nxboot::loader::ErrorStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value) {
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||||
AMS_UNUSED(file, line, func, expr, value);
|
AMS_UNUSED(expr, func, line, file, format);
|
||||||
|
|
||||||
ams::nxboot::loader::ErrorStop();
|
ams::nxboot::loader::ErrorStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,144 +1,41 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# Define the atmosphere board and cpu
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common atmosphere configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/exosphere.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
BINFILES :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export TOPDIR := $(CURRENT_DIRECTORY)
|
|
||||||
|
|
||||||
OUTPUT_BASE := $(TOPDIR)/$(notdir $(TOPDIR))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): check_libexo_$(strip $1) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1)
|
$(strip $1):
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(OUTPUT_BASE)$(strip $2) $(3) \
|
@echo "Building $(strip $1)"
|
||||||
ATMOSPHERE_BUILD_TARGET=$(strip $2) \
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/program.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
LIBEXOSPHERE_NAME=exosphere$(strip $2) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
check_libexo_$(strip $1):
|
|
||||||
@$$(MAKE) --no-print-directory -C $$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere $$(ATMOSPHERE_ARCH_NAME)-$(strip $1)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(OUTPUT_BASE)$(strip $2).bin $$(OUTPUT_BASE)$(strip $2).lz4 $$(OUTPUT_BASE)$(strip $2).elf
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/program.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, , \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, _debug, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, _audit, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
endef
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(config) clean-$(config))
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
$(OUTPUT).lz4 : $(OUTPUT).bin
|
|
||||||
@python $(TOPDIR)/lz4_compress.py $(OUTPUT).bin $(OUTPUT).lz4
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
|
||||||
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/lib$(LIBEXOSPHERE_NAME).a
|
|
||||||
|
|
||||||
%.elf:
|
|
||||||
@echo linking $(notdir $@)
|
|
||||||
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
|
||||||
@$(NM) -CSn $@ > $(notdir $*.lst)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o %_bin.h: %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|||||||
117
fusee/program/program.mk
Normal file
117
fusee/program/program.mk
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../../libraries/config/templates/exosphere.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export ATMOSPHERE_TOPDIR := $(CURRENT_DIRECTORY)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
BINFILES :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(subst -,_,$(BINFILES))))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
||||||
|
|
||||||
|
.PHONY: clean all check_lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURRENT_DIRECTORY)/$(ATMOSPHERE_OUT_DIR)/$(notdir $(ATMOSPHERE_TOPDIR)) \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a: check_lib
|
||||||
|
@$(SILENTCMD)echo "Checked library."
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CHECKED_LIBEXOSPHERE),1)
|
||||||
|
check_lib:
|
||||||
|
else
|
||||||
|
check_lib:
|
||||||
|
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/libexosphere.mk
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OUTPUT).lz4 : $(OUTPUT).bin
|
||||||
|
@python $(CURRENT_DIRECTORY)/lz4_compress.py $(OUTPUT).bin $(OUTPUT).lz4
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
$(OBJCOPY) -S -O binary --set-section-flags .bss=alloc,load,contents $< $@
|
||||||
|
@echo built ... $(notdir $@)
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/libexosphere.a
|
||||||
|
|
||||||
|
%.elf:
|
||||||
|
@echo linking $(notdir $@)
|
||||||
|
$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
|
||||||
|
@$(NM) -CSn $@ > $(notdir $*.lst)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h: %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
%rename link old_link
|
%rename link old_link
|
||||||
|
|
||||||
*link:
|
*link:
|
||||||
%(old_link) -T %:getenv(TOPDIR /program_ovl.ld) -T %:getenv(TOPDIR /program.ld) --gc-sections --nmagic
|
%(old_link) -T %:getenv(ATMOSPHERE_TOPDIR /program_ovl.ld) -T %:getenv(ATMOSPHERE_TOPDIR /program.ld) --gc-sections --nmagic
|
||||||
@@ -118,7 +118,7 @@ namespace ams::fs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual Result SetSize(s64 size) override {
|
virtual Result SetSize(s64 size) override {
|
||||||
return fs::ResultUnsupportedOperationInSubStorageA();
|
return fs::ResultUnsupportedSetSizeForNotResizableSubStorage();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,20 +27,36 @@ namespace ams::nxboot {
|
|||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
NORETURN void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) {
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line) {
|
||||||
AMS_UNUSED(file, line, func, expr, format);
|
AMS_UNUSED(expr, func, line, file);
|
||||||
|
|
||||||
u32 lr;
|
u32 lr;
|
||||||
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
||||||
nxboot::ShowFatalError("Abort called, lr=%p, value=%" PRIx64 "\n", reinterpret_cast<void *>(lr), value);
|
nxboot::ShowFatalError("Abort called, lr=%p\n", reinterpret_cast<void *>(lr));
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value) {
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||||
AMS_UNUSED(file, line, func, expr);
|
AMS_UNUSED(expr, func, line, file, format);
|
||||||
|
|
||||||
u32 lr;
|
u32 lr;
|
||||||
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
||||||
nxboot::ShowFatalError("Abort called, lr=%p, value=%" PRIx64 "\n", reinterpret_cast<void *>(lr), value);
|
nxboot::ShowFatalError("Abort called, lr=%p\n", reinterpret_cast<void *>(lr));
|
||||||
|
}
|
||||||
|
|
||||||
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line, const ::ams::Result *result, const char *format, ...) {
|
||||||
|
AMS_UNUSED(expr, func, line, file, result, format);
|
||||||
|
|
||||||
|
u32 lr;
|
||||||
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
||||||
|
nxboot::ShowFatalError("Abort called, lr=%p, result=0x%08" PRIX32 "\n", reinterpret_cast<void *>(lr), result != nullptr ? result->GetValue() : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
NORETURN void AbortImpl(const char *expr, const char *func, const char *file, int line, const ::ams::Result *result, const ::ams::os::UserExceptionInfo *exception_info, const char *format, ...) {
|
||||||
|
AMS_UNUSED(expr, func, line, file, result, exception_info, format);
|
||||||
|
|
||||||
|
u32 lr;
|
||||||
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
||||||
|
nxboot::ShowFatalError("Abort called, lr=%p, result=0x%08" PRIX32 "\n", reinterpret_cast<void *>(lr), result != nullptr ? result->GetValue() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NORETURN void AbortImpl() {
|
NORETURN void AbortImpl() {
|
||||||
@@ -49,18 +65,20 @@ namespace ams::diag {
|
|||||||
nxboot::ShowFatalError("Abort called, lr=%p\n", reinterpret_cast<void *>(lr));
|
nxboot::ShowFatalError("Abort called, lr=%p\n", reinterpret_cast<void *>(lr));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
NORETURN void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line) {
|
||||||
|
AMS_UNUSED(type, expr, func, file, line);
|
||||||
|
|
||||||
namespace ams::result::impl {
|
u32 lr;
|
||||||
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
||||||
|
nxboot::ShowFatalError("Assert called, lr=%p\n", reinterpret_cast<void *>(lr));
|
||||||
|
}
|
||||||
|
|
||||||
NORETURN void OnResultAbort(const char *file, int line, const char *func, const char *expr, Result result) {
|
NORETURN void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||||
::ams::diag::AbortImpl(file, line, func, expr, result.GetValue(), "Result Abort: 2%03" PRId32 "-%04" PRId32 "", result.GetModule(), result.GetDescription());
|
AMS_UNUSED(type, expr, func, file, line, format);
|
||||||
AMS_INFINITE_LOOP();
|
|
||||||
__builtin_unreachable();
|
|
||||||
}
|
|
||||||
|
|
||||||
NORETURN void OnResultAbort(Result result) {
|
u32 lr;
|
||||||
OnResultAbort("", 0, "", "", result);
|
__asm__ __volatile__("mov %0, lr" : "=r"(lr) :: "memory");
|
||||||
}
|
nxboot::ShowFatalError("Assert called, lr=%p\n", reinterpret_cast<void *>(lr));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
ATMOSPHERE_LIBRARIES := libmesosphere libstratosphere libexosphere
|
|
||||||
|
|
||||||
TOPTARGETS := all clean
|
|
||||||
|
|
||||||
$(TOPTARGETS): $(ATMOSPHERE_LIBRARIES)
|
|
||||||
|
|
||||||
$(ATMOSPHERE_LIBRARIES):
|
|
||||||
$(MAKE) -C $@ $(MAKECMDGOALS)
|
|
||||||
|
|
||||||
.PHONY: $(TOPTARGETS) $(ATMOSPHERE_LIBRARIES)
|
|
||||||
@@ -1,11 +1,23 @@
|
|||||||
|
ifeq ($(strip $(ATMOSPHERE_OS_NAME)),horizon)
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITPRO)),)
|
ifeq ($(strip $(DEVKITPRO)),)
|
||||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
|
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(DEVKITPRO)/devkitA64/base_rules
|
include $(DEVKITPRO)/devkitA64/base_rules
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
include $(ATMOSPHERE_ARCH_MAKE_DIR)/base_rules
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
export ATMOSPHERE_DEFINES += -DATMOSPHERE_ARCH_ARM64
|
export ATMOSPHERE_DEFINES += -DATMOSPHERE_ARCH_ARM64
|
||||||
export ATMOSPHERE_SETTINGS += -mtp=soft
|
export ATMOSPHERE_SETTINGS +=
|
||||||
export ATMOSPHERE_CFLAGS +=
|
export ATMOSPHERE_CFLAGS +=
|
||||||
export ATMOSPHERE_CXXFLAGS +=
|
export ATMOSPHERE_CXXFLAGS +=
|
||||||
export ATMOSPHERE_ASFLAGS +=
|
export ATMOSPHERE_ASFLAGS +=
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_OS_NAME)),horizon)
|
||||||
|
export ATMOSPHERE_SETTINGS += -mtp=soft
|
||||||
|
endif
|
||||||
28
libraries/config/arch/arm64/base_rules
Normal file
28
libraries/config/arch/arm64/base_rules
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
include $(ATMOSPHERE_ARCH_MAKE_DIR)/base_tools
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.a:
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(SILENTMSG) $(notdir $@)
|
||||||
|
@rm -f $@
|
||||||
|
$(SILENTCMD)$(AR) -rc $@ $^
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.o: %.cpp
|
||||||
|
$(SILENTMSG) $(notdir $<)
|
||||||
|
$(SILENTCMD)$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.o: %.c
|
||||||
|
$(SILENTMSG) $(notdir $<)
|
||||||
|
$(SILENTCMD)$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.o: %.s
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENTCMD)$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.o: %.S
|
||||||
|
$(SILENTMSG) $(notdir $<)
|
||||||
|
$(SILENTCMD)$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
||||||
52
libraries/config/arch/arm64/base_tools
Normal file
52
libraries/config/arch/arm64/base_tools
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# the prefix on the compiler executables
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
PREFIX :=
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_COMPILER_NAME)),gcc)
|
||||||
|
|
||||||
|
export CC := gcc
|
||||||
|
export CXX := g++
|
||||||
|
export AS := as
|
||||||
|
export AR := gcc-ar
|
||||||
|
export OBJCOPY := objcopy
|
||||||
|
export STRIP := strip
|
||||||
|
export NM := gcc-nm
|
||||||
|
export RANLIB := gcc-ranlib
|
||||||
|
|
||||||
|
else ifeq ($(strip $(ATMOSPHERE_COMPILER_NAME)),clang)
|
||||||
|
|
||||||
|
export CC := clang
|
||||||
|
export CXX := clang++
|
||||||
|
export AS := llvm-as
|
||||||
|
export AR := llvm-ar
|
||||||
|
export OBJCOPY := llvm-objcopy
|
||||||
|
export STRIP := llvm-strip
|
||||||
|
export NM := llvm-nm
|
||||||
|
export RANLIB := llvm-ranlib
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSIONSPATH))
|
||||||
|
|
||||||
|
ifneq (,$(ISVC))
|
||||||
|
ERROR_FILTER := 2>&1 | sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):/\1(\2):/g'
|
||||||
|
endif
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# allow seeing compiler command lines with make V=1 (similar to autotools' silent)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(V),1)
|
||||||
|
SILENTMSG := @true
|
||||||
|
SILENTCMD :=
|
||||||
|
else
|
||||||
|
SILENTMSG := @echo
|
||||||
|
SILENTCMD := @
|
||||||
|
endif
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# canned command sequence for binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
define bin2o
|
||||||
|
bin2s -a 8 -H `(echo $(<F) | tr . _)`.h $< | $(AS) -o $(<F).o
|
||||||
|
endef
|
||||||
5
libraries/config/arch/arm64/cpu/generic_arm64/cpu.mk
Normal file
5
libraries/config/arch/arm64/cpu/generic_arm64/cpu.mk
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export ATMOSPHERE_DEFINES += -DATMOSPHERE_CPU_GENERIC_ARM64
|
||||||
|
export ATMOSPHERE_SETTINGS += -march=armv8-a+crc+crypto -mno-outline-atomics
|
||||||
|
export ATMOSPHERE_CFLAGS +=
|
||||||
|
export ATMOSPHERE_CXXFLAGS +=
|
||||||
|
export ATMOSPHERE_ASFLAGS +=
|
||||||
7
libraries/config/arch/x64/arch.mk
Normal file
7
libraries/config/arch/x64/arch.mk
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
include $(ATMOSPHERE_ARCH_MAKE_DIR)/base_rules
|
||||||
|
|
||||||
|
export ATMOSPHERE_DEFINES += -DATMOSPHERE_ARCH_X64
|
||||||
|
export ATMOSPHERE_SETTINGS +=
|
||||||
|
export ATMOSPHERE_CFLAGS +=
|
||||||
|
export ATMOSPHERE_CXXFLAGS +=
|
||||||
|
export ATMOSPHERE_ASFLAGS +=
|
||||||
28
libraries/config/arch/x64/base_rules
Normal file
28
libraries/config/arch/x64/base_rules
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
include $(ATMOSPHERE_ARCH_MAKE_DIR)/base_tools
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.a:
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(SILENTMSG) $(notdir $@)
|
||||||
|
@rm -f $@
|
||||||
|
$(SILENTCMD)$(AR) -rc $@ $^
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.o: %.cpp
|
||||||
|
$(SILENTMSG) $(notdir $<)
|
||||||
|
$(SILENTCMD)$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.o: %.c
|
||||||
|
$(SILENTMSG) $(notdir $<)
|
||||||
|
$(SILENTCMD)$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.o: %.s
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENTCMD)$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.o: %.S
|
||||||
|
$(SILENTMSG) $(notdir $<)
|
||||||
|
$(SILENTCMD)$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
||||||
52
libraries/config/arch/x64/base_tools
Normal file
52
libraries/config/arch/x64/base_tools
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# the prefix on the compiler executables
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
PREFIX :=
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_COMPILER_NAME)),gcc)
|
||||||
|
|
||||||
|
export CC := gcc
|
||||||
|
export CXX := g++
|
||||||
|
export AS := as
|
||||||
|
export AR := gcc-ar
|
||||||
|
export OBJCOPY := objcopy
|
||||||
|
export STRIP := strip
|
||||||
|
export NM := gcc-nm
|
||||||
|
export RANLIB := gcc-ranlib
|
||||||
|
|
||||||
|
else ifeq ($(strip $(ATMOSPHERE_COMPILER_NAME)),clang)
|
||||||
|
|
||||||
|
export CC := clang
|
||||||
|
export CXX := clang++
|
||||||
|
export AS := llvm-as
|
||||||
|
export AR := llvm-ar
|
||||||
|
export OBJCOPY := llvm-objcopy
|
||||||
|
export STRIP := llvm-strip
|
||||||
|
export NM := llvm-nm
|
||||||
|
export RANLIB := llvm-ranlib
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSIONSPATH))
|
||||||
|
|
||||||
|
ifneq (,$(ISVC))
|
||||||
|
ERROR_FILTER := 2>&1 | sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):/\1(\2):/g'
|
||||||
|
endif
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# allow seeing compiler command lines with make V=1 (similar to autotools' silent)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(V),1)
|
||||||
|
SILENTMSG := @true
|
||||||
|
SILENTCMD :=
|
||||||
|
else
|
||||||
|
SILENTMSG := @echo
|
||||||
|
SILENTCMD := @
|
||||||
|
endif
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# canned command sequence for binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
define bin2o
|
||||||
|
bin2s -a 8 -H `(echo $(<F) | tr . _)`.h $< | $(AS) -o $(<F).o
|
||||||
|
endef
|
||||||
5
libraries/config/arch/x64/cpu/generic_x64/cpu.mk
Normal file
5
libraries/config/arch/x64/cpu/generic_x64/cpu.mk
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export ATMOSPHERE_DEFINES += -DATMOSPHERE_CPU_GENERIC_X64
|
||||||
|
export ATMOSPHERE_SETTINGS += -march=native -mtune=generic
|
||||||
|
export ATMOSPHERE_CFLAGS +=
|
||||||
|
export ATMOSPHERE_CXXFLAGS +=
|
||||||
|
export ATMOSPHERE_ASFLAGS +=
|
||||||
19
libraries/config/board/generic/linux/board.mk
Normal file
19
libraries/config/board/generic/linux/board.mk
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
export ATMOSPHERE_DEFINES += -DATMOSPHERE_BOARD_GENERIC_LINUX
|
||||||
|
export ATMOSPHERE_SETTINGS +=
|
||||||
|
export ATMOSPHERE_CFLAGS +=
|
||||||
|
export ATMOSPHERE_CXXFLAGS +=
|
||||||
|
export ATMOSPHERE_ASFLAGS +=
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_COMPILER_NAME)),clang)
|
||||||
|
export ATMOSPHERE_CXXFLAGS += -stdlib=libc++
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),x64)
|
||||||
|
export ATMOSPHERE_SETTINGS += -target x86_64-pc-linux-gnu
|
||||||
|
else ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),arm64)
|
||||||
|
export ATMOSPHERE_SETTINGS += -target aarch64-linux-gnu
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
# TODO: Better way of doing this?
|
||||||
|
export ATMOSPHERE_CXXFLAGS += -I/opt/libjpeg-turbo/include
|
||||||
23
libraries/config/board/generic/macos/board.mk
Normal file
23
libraries/config/board/generic/macos/board.mk
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
export ATMOSPHERE_DEFINES += -DATMOSPHERE_BOARD_GENERIC_MACOS
|
||||||
|
export ATMOSPHERE_SETTINGS +=
|
||||||
|
export ATMOSPHERE_CFLAGS +=
|
||||||
|
export ATMOSPHERE_CXXFLAGS +=
|
||||||
|
export ATMOSPHERE_ASFLAGS +=
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_COMPILER_NAME)),clang)
|
||||||
|
export ATMOSPHERE_CXXFLAGS += -stdlib=libc++
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),x64)
|
||||||
|
export ATMOSPHERE_SETTINGS += -target x86_64-apple-darwin
|
||||||
|
else ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),arm64)
|
||||||
|
export ATMOSPHERE_SETTINGS += -target aarch64-apple-darwin
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(SDKROOT)),)
|
||||||
|
export SDKROOT := $(shell xcrun --sdk macosx --show-sdk-path)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# TODO: Better way of doing this?
|
||||||
|
export ATMOSPHERE_CXXFLAGS += -I/opt/libjpeg-turbo/include
|
||||||
5
libraries/config/board/generic/windows/board.mk
Normal file
5
libraries/config/board/generic/windows/board.mk
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export ATMOSPHERE_DEFINES += -DATMOSPHERE_BOARD_GENERIC_WINDOWS
|
||||||
|
export ATMOSPHERE_SETTINGS +=
|
||||||
|
export ATMOSPHERE_CFLAGS +=
|
||||||
|
export ATMOSPHERE_CXXFLAGS +=
|
||||||
|
export ATMOSPHERE_ASFLAGS +=
|
||||||
@@ -15,14 +15,34 @@ endif
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_BUILD_NAME),)
|
||||||
|
export ATMOSPHERE_BUILD_NAME := release
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_COMPILER_NAME)),)
|
||||||
|
|
||||||
|
ifneq ($(strip $(ATMOSPHERE_BOARD)),generic_macos)
|
||||||
|
export ATMOSPHERE_COMPILER_NAME := gcc
|
||||||
|
else
|
||||||
|
export ATMOSPHERE_COMPILER_NAME := clang
|
||||||
|
endif
|
||||||
|
|
||||||
|
export ATMOSPHERE_BUILD_NAME := release
|
||||||
|
endif
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_SETTINGS ?=
|
ATMOSPHERE_BUILD_SETTINGS ?=
|
||||||
|
|
||||||
export ATMOSPHERE_DEFINES := -DATMOSPHERE
|
export ATMOSPHERE_DEFINES := -DATMOSPHERE
|
||||||
export ATMOSPHERE_SETTINGS := -fPIE -g $(ATMOSPHERE_BUILD_SETTINGS)
|
export ATMOSPHERE_SETTINGS := -fPIE -g $(ATMOSPHERE_BUILD_SETTINGS)
|
||||||
export ATMOSPHERE_CFLAGS := -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -fwrapv \
|
export ATMOSPHERE_CFLAGS := -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -fwrapv \
|
||||||
-fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector \
|
-fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector \
|
||||||
-Wno-format-truncation -Wno-format-zero-length -Wno-stringop-truncation
|
-Wno-format-zero-length
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_COMPILER_NAME)),gcc)
|
||||||
|
export ATMOSPHERE_CFLAGS += -Wno-stringop-truncation -Wno-format-truncation
|
||||||
|
else ifeq ($(strip $(ATMOSPHERE_COMPILER_NAME)),clang)
|
||||||
|
export ATMOSPHERE_CFLAGS += -Wno-c99-designator -Wno-gnu-alignof-expression -Wno-unused-private-field
|
||||||
|
endif
|
||||||
|
|
||||||
export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++20 -Wno-invalid-offsetof
|
export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++20 -Wno-invalid-offsetof
|
||||||
export ATMOSPHERE_ASFLAGS :=
|
export ATMOSPHERE_ASFLAGS :=
|
||||||
@@ -39,10 +59,16 @@ export ATMOSPHERE_ARCH_NAME := arm64
|
|||||||
export ATMOSPHERE_BOARD_NAME := nintendo_nx
|
export ATMOSPHERE_BOARD_NAME := nintendo_nx
|
||||||
export ATMOSPHERE_OS_NAME := horizon
|
export ATMOSPHERE_OS_NAME := horizon
|
||||||
|
|
||||||
export ATMOSPHERE_SUB_ARCH_DIR = armv8a
|
export ATMOSPHERE_SUB_ARCH_DIR := armv8a
|
||||||
export ATMOSPHERE_SUB_ARCH_NAME = armv8a
|
export ATMOSPHERE_SUB_ARCH_NAME := armv8a
|
||||||
|
|
||||||
export ATMOSPHERE_CPU_EXTENSIONS := arm_crypto_extension aarch64_crypto_extension
|
export ATMOSPHERE_CPU_EXTENSIONS := arm_crypto_extension aarch64_crypto_extension
|
||||||
|
|
||||||
|
export ATMOSPHERE_BOOT_CPU := arm7tdmi
|
||||||
|
export ATMOSPHERE_BOOT_ARCH_NAME := arm
|
||||||
|
export ATMOSPHERE_BOOT_BOARD_NAME := nintendo_nx
|
||||||
|
export ATMOSPHERE_BOOT_OS_NAME := horizon
|
||||||
|
export ATMOSPHERE_BOOT_SUB_ARCH_NAME := armv4t
|
||||||
else ifeq ($(ATMOSPHERE_CPU),arm7tdmi)
|
else ifeq ($(ATMOSPHERE_CPU),arm7tdmi)
|
||||||
export ATMOSPHERE_ARCH_DIR := arm
|
export ATMOSPHERE_ARCH_DIR := arm
|
||||||
export ATMOSPHERE_BOARD_DIR := nintendo/nx_bpmp
|
export ATMOSPHERE_BOARD_DIR := nintendo/nx_bpmp
|
||||||
@@ -52,12 +78,14 @@ export ATMOSPHERE_ARCH_NAME := arm
|
|||||||
export ATMOSPHERE_BOARD_NAME := nintendo_nx
|
export ATMOSPHERE_BOARD_NAME := nintendo_nx
|
||||||
export ATMOSPHERE_OS_NAME := horizon
|
export ATMOSPHERE_OS_NAME := horizon
|
||||||
|
|
||||||
export ATMOSPHERE_SUB_ARCH_DIR = armv4t
|
export ATMOSPHERE_SUB_ARCH_DIR := armv4t
|
||||||
export ATMOSPHERE_SUB_ARCH_NAME = armv4t
|
export ATMOSPHERE_SUB_ARCH_NAME := armv4t
|
||||||
|
|
||||||
export ATMOSPHERE_CPU_EXTENSIONS :=
|
export ATMOSPHERE_CPU_EXTENSIONS :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
export ATMOSPHERE_LIBDIRS :=
|
||||||
|
|
||||||
else ifeq ($(ATMOSPHERE_BOARD),qemu-virt)
|
else ifeq ($(ATMOSPHERE_BOARD),qemu-virt)
|
||||||
|
|
||||||
|
|
||||||
@@ -76,6 +104,53 @@ export ATMOSPHERE_SUB_ARCH_NAME = armv8a
|
|||||||
export ATMOSPHERE_CPU_EXTENSIONS := arm_crypto_extension aarch64_crypto_extension
|
export ATMOSPHERE_CPU_EXTENSIONS := arm_crypto_extension aarch64_crypto_extension
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
export ATMOSPHERE_LIBDIRS :=
|
||||||
|
|
||||||
|
else ifeq ($(ATMOSPHERE_BOARD),generic_windows)
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CPU),generic_x64)
|
||||||
|
export ATMOSPHERE_ARCH_DIR := x64
|
||||||
|
export ATMOSPHERE_BOARD_DIR := generic/windows
|
||||||
|
export ATMOSPHERE_OS_DIR := windows
|
||||||
|
|
||||||
|
export ATMOSPHERE_ARCH_NAME := x64
|
||||||
|
export ATMOSPHERE_BOARD_NAME := generic_windows
|
||||||
|
export ATMOSPHERE_OS_NAME := windows
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
else ifeq ($(ATMOSPHERE_BOARD),generic_linux)
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CPU),generic_x64)
|
||||||
|
export ATMOSPHERE_ARCH_DIR := x64
|
||||||
|
export ATMOSPHERE_ARCH_NAME := x64
|
||||||
|
else ifeq ($(ATMOSPHERE_CPU),generic_arm64)
|
||||||
|
export ATMOSPHERE_ARCH_DIR := arm64
|
||||||
|
export ATMOSPHERE_ARCH_NAME := arm64
|
||||||
|
endif
|
||||||
|
|
||||||
|
export ATMOSPHERE_BOARD_DIR := generic/linux
|
||||||
|
export ATMOSPHERE_OS_DIR := linux
|
||||||
|
|
||||||
|
export ATMOSPHERE_BOARD_NAME := generic_linux
|
||||||
|
export ATMOSPHERE_OS_NAME := linux
|
||||||
|
|
||||||
|
else ifeq ($(ATMOSPHERE_BOARD),generic_macos)
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CPU),generic_x64)
|
||||||
|
export ATMOSPHERE_ARCH_DIR := x64
|
||||||
|
export ATMOSPHERE_ARCH_NAME := x64
|
||||||
|
else ifeq ($(ATMOSPHERE_CPU),generic_arm64)
|
||||||
|
export ATMOSPHERE_ARCH_DIR := arm64
|
||||||
|
export ATMOSPHERE_ARCH_NAME := arm64
|
||||||
|
endif
|
||||||
|
|
||||||
|
export ATMOSPHERE_BOARD_DIR := generic/macos
|
||||||
|
export ATMOSPHERE_OS_DIR := macos
|
||||||
|
|
||||||
|
export ATMOSPHERE_BOARD_NAME := generic_macos
|
||||||
|
export ATMOSPHERE_OS_NAME := macos
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ATMOSPHERE_CPU),arm-cortex-a57)
|
ifeq ($(ATMOSPHERE_CPU),arm-cortex-a57)
|
||||||
@@ -88,6 +163,15 @@ export ATMOSPHERE_CPU_DIR := arm7tdmi
|
|||||||
export ATMOSPHERE_CPU_NAME := arm7tdmi
|
export ATMOSPHERE_CPU_NAME := arm7tdmi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CPU),generic_x64)
|
||||||
|
export ATMOSPHERE_CPU_DIR := generic_x64
|
||||||
|
export ATMOSPHERE_CPU_NAME := generic_x64
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_CPU),generic_arm64)
|
||||||
|
export ATMOSPHERE_CPU_DIR := generic_arm64
|
||||||
|
export ATMOSPHERE_CPU_NAME := generic_arm64
|
||||||
|
endif
|
||||||
|
|
||||||
export ATMOSPHERE_ARCH_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/arch/$(ATMOSPHERE_ARCH_DIR)
|
export ATMOSPHERE_ARCH_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/arch/$(ATMOSPHERE_ARCH_DIR)
|
||||||
export ATMOSPHERE_BOARD_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/board/$(ATMOSPHERE_BOARD_DIR)
|
export ATMOSPHERE_BOARD_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/board/$(ATMOSPHERE_BOARD_DIR)
|
||||||
@@ -95,11 +179,40 @@ export ATMOSPHERE_OS_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/os/$(ATMOSPHER
|
|||||||
export ATMOSPHERE_CPU_MAKE_DIR := $(ATMOSPHERE_ARCH_MAKE_DIR)/cpu/$(ATMOSPHERE_CPU_DIR)
|
export ATMOSPHERE_CPU_MAKE_DIR := $(ATMOSPHERE_ARCH_MAKE_DIR)/cpu/$(ATMOSPHERE_CPU_DIR)
|
||||||
|
|
||||||
ifneq ($(strip $(ATMOSPHERE_SUB_ARCH_NAME)),)
|
ifneq ($(strip $(ATMOSPHERE_SUB_ARCH_NAME)),)
|
||||||
export ATMOSPHERE_LIBRARY_DIR := lib_$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)_$(ATMOSPHERE_SUB_ARCH_NAME)
|
export ATMOSPHERE_FULL_NAME := $(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)_$(ATMOSPHERE_SUB_ARCH_NAME)_$(ATMOSPHERE_BUILD_NAME)
|
||||||
export ATMOSPHERE_BUILD_DIR := build_$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)_$(ATMOSPHERE_SUB_ARCH_NAME)
|
export ATMOSPHERE_LIBRARY_DIR := lib/$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)_$(ATMOSPHERE_SUB_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
export ATMOSPHERE_BUILD_DIR := build/$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)_$(ATMOSPHERE_SUB_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
export ATMOSPHERE_OUT_DIR := out/$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)_$(ATMOSPHERE_SUB_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
else
|
else
|
||||||
export ATMOSPHERE_LIBRARY_DIR := lib_$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)
|
export ATMOSPHERE_FULL_NAME := $(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)_$(ATMOSPHERE_BUILD_NAME)
|
||||||
export ATMOSPHERE_BUILD_DIR := build_$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)
|
export ATMOSPHERE_LIBRARY_DIR := lib/$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
export ATMOSPHERE_BUILD_DIR := build/$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
export ATMOSPHERE_OUT_DIR := out/$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(strip $(ATMOSPHERE_BOOT_ARCH_NAME)),)
|
||||||
|
|
||||||
|
ifneq ($(strip $(ATMOSPHERE_SUB_ARCH_NAME)),)
|
||||||
|
export ATMOSPHERE_BOOT_FULL_NAME := $(ATMOSPHERE_BOOT_BOARD_NAME)_$(ATMOSPHERE_BOOT_ARCH_NAME)_$(ATMOSPHERE_BOOT_SUB_ARCH_NAME)_$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
export ATMOSPHERE_BOOT_LIBRARY_DIR := lib/$(ATMOSPHERE_BOOT_BOARD_NAME)_$(ATMOSPHERE_BOOT_ARCH_NAME)_$(ATMOSPHERE_BOOT_SUB_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
export ATMOSPHERE_BOOT_BUILD_DIR := build/$(ATMOSPHERE_BOOT_BOARD_NAME)_$(ATMOSPHERE_BOOT_ARCH_NAME)_$(ATMOSPHERE_BOOT_SUB_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
export ATMOSPHERE_BOOT_OUT_DIR := out/$(ATMOSPHERE_BOOT_BOARD_NAME)_$(ATMOSPHERE_BOOT_ARCH_NAME)_$(ATMOSPHERE_BOOT_SUB_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
else
|
||||||
|
export ATMOSPHERE_BOOT_FULL_NAME := $(ATMOSPHERE_BOOT_BOARD_NAME)_$(ATMOSPHERE_BOOT_ARCH_NAME)_$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
export ATMOSPHERE_BOOT_LIBRARY_DIR := lib/$(ATMOSPHERE_BOOT_BOARD_NAME)_$(ATMOSPHERE_BOOT_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
export ATMOSPHERE_BOOT_BUILD_DIR := build/$(ATMOSPHERE_BOOT_BOARD_NAME)_$(ATMOSPHERE_BOOT_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
export ATMOSPHERE_BOOT_OUT_DIR := out/$(ATMOSPHERE_BOOT_BOARD_NAME)_$(ATMOSPHERE_BOOT_ARCH_NAME)/$(ATMOSPHERE_BUILD_NAME)
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
export ATMOSPHERE_BOOT_FULL_NAME := $(ATMOSPHERE_FULL_NAME)
|
||||||
|
export ATMOSPHERE_BOOT_LIBRARY_DIR := $(ATMOSPHERE_LIBRARY_DIR)
|
||||||
|
export ATMOSPHERE_BOOT_BUILD_DIR := $(ATMOSPHERE_BUILD_DIR)
|
||||||
|
export ATMOSPHERE_BOOT_OUT_DIR := $(ATMOSPHERE_OUT_DIR)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_BOOT_CPU)),)
|
||||||
|
export ATMOSPHERE_BOOT_CPU := $(ATMOSPHERE_CPU)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(ATMOSPHERE_ARCH_MAKE_DIR)/arch.mk
|
include $(ATMOSPHERE_ARCH_MAKE_DIR)/arch.mk
|
||||||
@@ -182,15 +295,14 @@ FIND_SOURCE_FILES=$(foreach dir,$1,$(filter-out $(notdir $(wildcard $(dir)/*.arc
|
|||||||
$(foreach dir,$1,$(call FIND_SPECIFIC_SOURCE_FILES,$(dir),os,$(ATMOSPHERE_OS_NAME),$2)) \
|
$(foreach dir,$1,$(call FIND_SPECIFIC_SOURCE_FILES,$(dir),os,$(ATMOSPHERE_OS_NAME),$2)) \
|
||||||
$(foreach dir,$1,$(call FIND_SPECIFIC_SOURCE_FILES_EX,$(dir),cpu,$(ATMOSPHERE_CPU_NAME) $(ATMOSPHERE_CPU_EXTENSIONS),$2))
|
$(foreach dir,$1,$(call FIND_SPECIFIC_SOURCE_FILES_EX,$(dir),cpu,$(ATMOSPHERE_CPU_NAME) $(ATMOSPHERE_CPU_EXTENSIONS),$2))
|
||||||
|
|
||||||
ATMOSPHERE_GCH_IDENTIFIER ?= ams_placeholder_gch_identifier
|
ATMOSPHERE_GCH_IDENTIFIER := $(ATMOSPHERE_FULL_NAME)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# Rules for compiling pre-compiled headers
|
# Rules for compiling pre-compiled headers
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.hpp.gch/$(ATMOSPHERE_GCH_IDENTIFIER): %.hpp | %.hpp.gch
|
%.hpp.gch/$(ATMOSPHERE_GCH_IDENTIFIER): %.hpp %.hpp.gch
|
||||||
@echo Precompiling $(notdir $<) for $(ATMOSPHERE_GCH_IDENTIFIER)
|
@echo Precompiling $(notdir $<) for $(ATMOSPHERE_GCH_IDENTIFIER)
|
||||||
$(SILENTCMD)$(CXX) -w -x c++-header -MMD -MP -MQ$@ -MF $(DEPSDIR)/$(notdir $*).d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
$(SILENTCMD)$(CXX) -w -x c++-header -MMD -MP -MQ$@ -MF $(DEPSDIR)/$(notdir $*).d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
||||||
|
|
||||||
%.hpp.gch: %.hpp
|
%.hpp.gch: %.hpp
|
||||||
@echo Precompiling $(notdir $<)
|
@[ -d $@ ] || mkdir -p $@
|
||||||
$(SILENTCMD)$(CXX) -w -x c++-header -MMD -MP -MQ$@ -MF $(DEPSDIR)/$(notdir $*).d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
|
||||||
|
|||||||
5
libraries/config/os/linux/os.mk
Normal file
5
libraries/config/os/linux/os.mk
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export ATMOSPHERE_DEFINES += -DATMOSPHERE_OS_LINUX
|
||||||
|
export ATMOSPHERE_SETTINGS += -fno-omit-frame-pointer
|
||||||
|
export ATMOSPHERE_CFLAGS +=
|
||||||
|
export ATMOSPHERE_CXXFLAGS +=
|
||||||
|
export ATMOSPHERE_ASFLAGS +=
|
||||||
5
libraries/config/os/macos/os.mk
Normal file
5
libraries/config/os/macos/os.mk
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export ATMOSPHERE_DEFINES += -DATMOSPHERE_OS_MACOS
|
||||||
|
export ATMOSPHERE_SETTINGS += -fno-omit-frame-pointer
|
||||||
|
export ATMOSPHERE_CFLAGS +=
|
||||||
|
export ATMOSPHERE_CXXFLAGS +=
|
||||||
|
export ATMOSPHERE_ASFLAGS +=
|
||||||
5
libraries/config/os/windows/os.mk
Normal file
5
libraries/config/os/windows/os.mk
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export ATMOSPHERE_DEFINES += -DATMOSPHERE_OS_WINDOWS
|
||||||
|
export ATMOSPHERE_SETTINGS += -fno-omit-frame-pointer
|
||||||
|
export ATMOSPHERE_CFLAGS +=
|
||||||
|
export ATMOSPHERE_CXXFLAGS +=
|
||||||
|
export ATMOSPHERE_ASFLAGS +=
|
||||||
@@ -7,8 +7,14 @@ include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../common.mk
|
|||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),arm64)
|
ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),arm64)
|
||||||
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_EXOSPHERE
|
ifeq ($(ATMOSPHERE_BUILD_FOR_DEBUGGING),1)
|
||||||
SETTINGS := $(ATMOSPHERE_SETTINGS) -mgeneral-regs-only -ffixed-x18 -Os -Wextra -Werror -fno-non-call-exceptions \
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
else
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
endif
|
||||||
|
|
||||||
|
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_EXOSPHERE -DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS
|
||||||
|
SETTINGS := $(ATMOSPHERE_SETTINGS) -mgeneral-regs-only -ffixed-x18 $(ATMOSPHERE_OPTIMIZATION_FLAG) -Wextra -Werror -fno-non-call-exceptions \
|
||||||
-Wno-array-bounds \
|
-Wno-array-bounds \
|
||||||
-Wno-stringop-overflow \
|
-Wno-stringop-overflow \
|
||||||
-Wno-stringop-overread
|
-Wno-stringop-overread
|
||||||
@@ -16,8 +22,14 @@ CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
|||||||
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit
|
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit
|
||||||
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS)
|
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS)
|
||||||
else ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),arm)
|
else ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),arm)
|
||||||
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_EXOSPHERE
|
ifeq ($(ATMOSPHERE_BUILD_FOR_DEBUGGING),1)
|
||||||
SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -Werror -fno-non-call-exceptions \
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
else
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -O2
|
||||||
|
endif
|
||||||
|
|
||||||
|
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_EXOSPHERE -DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS
|
||||||
|
SETTINGS := $(ATMOSPHERE_SETTINGS) $(ATMOSPHERE_OPTIMIZATION_FLAG) -Werror -fno-non-call-exceptions \
|
||||||
-Wno-array-bounds \
|
-Wno-array-bounds \
|
||||||
-Wno-stringop-overflow \
|
-Wno-stringop-overflow \
|
||||||
-Wno-stringop-overread
|
-Wno-stringop-overread
|
||||||
@@ -26,7 +38,7 @@ CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit
|
|||||||
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS)
|
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export LDFLAGS = -specs=$(TOPDIR)/$(notdir $(TOPDIR)).specs -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-exceptions -fno-rtti -fno-use-cxa-atexit -nostdlib -nostartfiles -g $(CXXFLAGS) -Wl,-Map,$(notdir $*.map) -Wl,-z,relro,-z,now
|
export LDFLAGS = -specs=$(ATMOSPHERE_TOPDIR)/$(notdir $(ATMOSPHERE_TOPDIR)).specs -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-exceptions -fno-rtti -fno-use-cxa-atexit -nostdlib -nostartfiles -g $(CXXFLAGS) -Wl,-Map,$(notdir $*.map) -Wl,-z,relro,-z,now
|
||||||
|
|
||||||
export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
|
export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
|
||||||
-Wl,--wrap,__cxa_throw \
|
-Wl,--wrap,__cxa_throw \
|
||||||
@@ -43,7 +55,7 @@ export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
|
|||||||
-Wl,--wrap,_ZSt20__throw_length_errorPKc \
|
-Wl,--wrap,_ZSt20__throw_length_errorPKc \
|
||||||
-Wl,--wrap,_ZNSt11logic_errorC2EPKc
|
-Wl,--wrap,_ZNSt11logic_errorC2EPKc
|
||||||
|
|
||||||
export LIBS := -l$(LIBEXOSPHERE_NAME) -lgcc
|
export LIBS := -lexosphere -lgcc
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
|
|||||||
@@ -6,13 +6,19 @@ include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../common.mk
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(ATMOSPHERE_BUILD_FOR_DEBUGGING),1)
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
else
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
endif
|
||||||
|
|
||||||
export DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE
|
export DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE
|
||||||
export SETTINGS := $(ATMOSPHERE_SETTINGS) -Os -mgeneral-regs-only -ffixed-x18 -Wextra -Werror -fno-non-call-exceptions
|
export SETTINGS := $(ATMOSPHERE_SETTINGS) $(ATMOSPHERE_OPTIMIZATION_FLAG) -mgeneral-regs-only -ffixed-x18 -Wextra -Werror -fno-non-call-exceptions
|
||||||
export CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
export CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
||||||
export CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit
|
export CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit
|
||||||
export ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
export ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
||||||
|
|
||||||
export LDFLAGS = -specs=$(TOPDIR)/$(notdir $(TOPDIR)).specs -fno-asynchronous-unwind-tables -fno-unwind-tables -nostdlib -nostartfiles -g $(CXXFLAGS) -Wl,-Map,$(notdir $*.map) -Wl,-z,relro,-z,now
|
export LDFLAGS = -specs=$(ATMOSPHERE_TOPDIR)/$(notdir $(ATMOSPHERE_TOPDIR)).specs -fno-asynchronous-unwind-tables -fno-unwind-tables -nostdlib -nostartfiles -g $(CXXFLAGS) -Wl,-Map,$(notdir $*.map) -Wl,-z,relro,-z,now
|
||||||
|
|
||||||
export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
|
export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
|
||||||
-Wl,--wrap,__cxa_throw \
|
-Wl,--wrap,__cxa_throw \
|
||||||
@@ -29,7 +35,7 @@ export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
|
|||||||
-Wl,--wrap,_ZSt20__throw_length_errorPKc \
|
-Wl,--wrap,_ZSt20__throw_length_errorPKc \
|
||||||
-Wl,--wrap,_ZNSt11logic_errorC2EPKc
|
-Wl,--wrap,_ZNSt11logic_errorC2EPKc
|
||||||
|
|
||||||
export LIBS := -l$(LIBMESOSPHERE_NAME)
|
export LIBS := -lmesosphere
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../common.mk
|
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../common.mk
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# pull in switch rules
|
# pull in switch rules
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@@ -12,15 +14,24 @@ endif
|
|||||||
|
|
||||||
include $(DEVKITPRO)/libnx/switch_rules
|
include $(DEVKITPRO)/libnx/switch_rules
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(ATMOSPHERE_BUILD_FOR_DEBUGGING),1)
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
else
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -O2
|
||||||
|
endif
|
||||||
|
|
||||||
export DEFINES = $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_STRATOSPHERE -D_GNU_SOURCE
|
export DEFINES = $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_STRATOSPHERE -D_GNU_SOURCE
|
||||||
export SETTINGS = $(ATMOSPHERE_SETTINGS) -O2 -Wextra -Werror -Wno-missing-field-initializers
|
export SETTINGS = $(ATMOSPHERE_SETTINGS) $(ATMOSPHERE_OPTIMIZATION_FLAG) -Wextra -Werror -Wno-missing-field-initializers
|
||||||
export CFLAGS = $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
export CFLAGS = $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
||||||
export CXXFLAGS = $(CFLAGS) $(ATMOSPHERE_CXXFLAGS)
|
export CXXFLAGS = $(CFLAGS) $(ATMOSPHERE_CXXFLAGS)
|
||||||
export ASFLAGS = $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES)
|
export ASFLAGS = $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES)
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
||||||
export CXXREQUIRED := -Wl,--require-defined,__libnx_initheap \
|
export CXXREQUIRED := -Wl,--require-defined,__libnx_initheap \
|
||||||
-Wl,--require-defined,__libnx_exception_handler \
|
-Wl,--require-defined,__libnx_exception_handler \
|
||||||
-Wl,--require-defined,__libnx_alloc \
|
-Wl,--require-defined,__libnx_alloc \
|
||||||
@@ -45,16 +56,48 @@ export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
|
|||||||
-Wl,--wrap,_ZSt20__throw_length_errorPKc \
|
-Wl,--wrap,_ZSt20__throw_length_errorPKc \
|
||||||
-Wl,--wrap,_ZNSt11logic_errorC2EPKc \
|
-Wl,--wrap,_ZNSt11logic_errorC2EPKc \
|
||||||
-Wl,--wrap,exit
|
-Wl,--wrap,exit
|
||||||
|
else ifeq ($(ATMOSPHERE_BOARD),generic_windows)
|
||||||
|
export CXXREQUIRED :=
|
||||||
|
export CXXWRAPS := -Wl,--wrap,__p__acmdln
|
||||||
|
else
|
||||||
|
export CXXREQUIRED :=
|
||||||
|
export CXXWRAPS :=
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
||||||
export LDFLAGS = -specs=$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/stratosphere.specs -specs=$(DEVKITPRO)/libnx/switch.specs $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $*.map)
|
export LDFLAGS = -specs=$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/stratosphere.specs -specs=$(DEVKITPRO)/libnx/switch.specs $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $*.map)
|
||||||
|
else
|
||||||
|
export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $@.map)
|
||||||
|
endif
|
||||||
|
|
||||||
export LIBS = -lstratosphere -lnx
|
ifeq ($(ATMOSPHERE_COMPILER_NAME),clang)
|
||||||
|
export LDFLAGS += -fuse-ld=lld
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
||||||
|
export LIBS := -lstratosphere -lnx
|
||||||
|
else ifeq ($(ATMOSPHERE_BOARD),generic_windows)
|
||||||
|
export LIBS := -lstratosphere -lwinmm -lws2_32 -lbcrypt -static -static-libgcc -static-libstdc++
|
||||||
|
else ifeq ($(ATMOSPHERE_BOARD),generic_linux)
|
||||||
|
export LIBS := -lstratosphere -pthread -lbfd
|
||||||
|
else ifeq ($(ATMOSPHERE_BOARD),generic_macos)
|
||||||
|
export LIBS := -lstratosphere -pthread
|
||||||
|
else
|
||||||
|
export LIBS := -lstratosphere
|
||||||
|
endif
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
# include and lib
|
# include and lib
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
export LIBDIRS = $(PORTLIBS) $(LIBNX) $(ATMOSPHERE_LIBRARIES_DIR)/libvapours $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
||||||
|
export LIBDIRS = $(PORTLIBS) $(LIBNX)
|
||||||
|
else
|
||||||
|
export LIBDIRS =
|
||||||
|
endif
|
||||||
|
|
||||||
|
export AMS_LIBDIRS = $(ATMOSPHERE_LIBRARIES_DIR)/libvapours $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# stratosphere sysmodules may (but usually do not) have an exefs source dir
|
# stratosphere sysmodules may (but usually do not) have an exefs source dir
|
||||||
|
|||||||
@@ -1,34 +1,42 @@
|
|||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
all: arm64-release arm-release
|
all: nx_release
|
||||||
|
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
arm64-$(strip $1):
|
$(strip $1):
|
||||||
@$$(MAKE) -f arm64.mk $(strip $1)
|
@echo "Building $(strip $1)"
|
||||||
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/libexosphere.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
|
|
||||||
arm-$(strip $1):
|
clean-$(strip $1):
|
||||||
@$$(MAKE) -f arm.mk $(strip $1)
|
@echo "Cleaning $(strip $1)"
|
||||||
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/libexosphere.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
clean-arm64-$(strip $1):
|
|
||||||
@$$(MAKE) -f arm64.mk clean-$(strip $1)
|
|
||||||
|
|
||||||
clean-arm-$(strip $1):
|
|
||||||
@$$(MAKE) -f arm.mk clean-$(strip $1)
|
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release))
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug))
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit))
|
|
||||||
|
|
||||||
clean-arm64:
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
@$(MAKE) -f arm64.mk clean
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
|
))
|
||||||
|
|
||||||
clean-arm:
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
@$(MAKE) -f arm.mk clean
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
clean: clean-arm64 clean-arm
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
|
))
|
||||||
|
|
||||||
.PHONY: all clean clean-arm64 clean-arm $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),arm64-$(config) arm-$(config) clean-arm64-$(config) clean-arm-$(config))
|
endef
|
||||||
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx_bpmp, nx-hac-001, arm7tdmi,))
|
||||||
|
|
||||||
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|||||||
@@ -14,23 +14,22 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value) {
|
void AbortImpl(const char *expr, const char *func, const char *file, int line) {
|
||||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||||
{
|
{
|
||||||
AMS_LOG("Abort Called\n");
|
AMS_LOG("Abort Called\n");
|
||||||
AMS_LOG(" Location: %s:%d\n", file, line);
|
AMS_LOG(" Location: %s:%d\n", file, line);
|
||||||
AMS_LOG(" Function: %s\n", func);
|
AMS_LOG(" Function: %s\n", func);
|
||||||
AMS_LOG(" Expression: %s\n", expr);
|
AMS_LOG(" Expression: %s\n", expr);
|
||||||
AMS_LOG(" Value: %016" PRIx64 "\n", value);
|
|
||||||
AMS_LOG("\n");
|
AMS_LOG("\n");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
AMS_UNUSED(file, line, func, expr, value);
|
AMS_UNUSED(file, line, func, expr);
|
||||||
#endif
|
#endif
|
||||||
AbortImpl();
|
AbortImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbortImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) {
|
void AbortImpl(const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||||
{
|
{
|
||||||
AMS_LOG("Abort Called\n");
|
AMS_LOG("Abort Called\n");
|
||||||
@@ -48,12 +47,35 @@ void AbortImpl(const char *file, int line, const char *func, const char *expr, u
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
AMS_UNUSED(file, line, func, expr, value, format);
|
AMS_UNUSED(file, line, func, expr, format);
|
||||||
#endif
|
#endif
|
||||||
AbortImpl();
|
AbortImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssertionFailureImpl(const char *file, int line, const char *func, const char *expr, u64 value) {
|
void AbortImpl(const char *expr, const char *func, const char *file, int line, const ::ams::Result *result, const char *format, ...) {
|
||||||
|
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||||
|
{
|
||||||
|
AMS_LOG("Abort Called\n");
|
||||||
|
AMS_LOG(" Location: %s:%d\n", file, line);
|
||||||
|
AMS_LOG(" Function: %s\n", func);
|
||||||
|
AMS_LOG(" Expression: %s\n", expr);
|
||||||
|
AMS_LOG(" Result: 0x%08" PRIx32 "\n", result->GetValue());
|
||||||
|
AMS_LOG("\n");
|
||||||
|
{
|
||||||
|
::std::va_list vl;
|
||||||
|
va_start(vl, format);
|
||||||
|
AMS_VLOG(format, vl);
|
||||||
|
va_end(vl);
|
||||||
|
AMS_LOG("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
AMS_UNUSED(file, line, func, expr, result, format);
|
||||||
|
#endif
|
||||||
|
AbortImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line) {
|
||||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||||
{
|
{
|
||||||
AMS_LOG("Assertion Failure\n");
|
AMS_LOG("Assertion Failure\n");
|
||||||
@@ -62,14 +84,16 @@ void AssertionFailureImpl(const char *file, int line, const char *func, const ch
|
|||||||
AMS_LOG(" Expression: %s\n", expr);
|
AMS_LOG(" Expression: %s\n", expr);
|
||||||
AMS_LOG(" Value: %016" PRIx64 "\n", value);
|
AMS_LOG(" Value: %016" PRIx64 "\n", value);
|
||||||
AMS_LOG("\n");
|
AMS_LOG("\n");
|
||||||
|
|
||||||
|
AMS_UNUSED(type);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
AMS_UNUSED(file, line, func, expr, value);
|
AMS_UNUSED(type, expr, func, file, line);
|
||||||
#endif
|
#endif
|
||||||
AbortImpl();
|
AbortImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssertionFailureImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) {
|
void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||||
{
|
{
|
||||||
AMS_LOG("Assertion Failure\n");
|
AMS_LOG("Assertion Failure\n");
|
||||||
@@ -85,9 +109,11 @@ void AssertionFailureImpl(const char *file, int line, const char *func, const ch
|
|||||||
va_end(vl);
|
va_end(vl);
|
||||||
AMS_LOG("\n");
|
AMS_LOG("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AMS_UNUSED(type);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
AMS_UNUSED(file, line, func, expr, value, format);
|
AMS_UNUSED(type, expr, func, file, line, format);
|
||||||
#endif
|
#endif
|
||||||
AbortImpl();
|
AbortImpl();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,42 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Define the atmosphere board and cpu
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export ATMOSPHERE_BOARD := nx-hac-001
|
|
||||||
export ATMOSPHERE_CPU := arm7tdmi
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# pull in common atmosphere configuration
|
# pull in common atmosphere configuration
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../config/common.mk
|
include $(CURRENT_DIRECTORY)/../config/common.mk
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
PRECOMPILED_HEADERS :=
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),arm64)
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_BUILD_FOR_DEBUGGING),1)
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
else
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_BUILD_FOR_DEBUGGING),1)
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
else
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -O2
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_EXOSPHERE -DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS
|
||||||
|
SETTINGS := $(ATMOSPHERE_SETTINGS) $(ATMOSPHERE_OPTIMIZATION_FLAG) -Wextra -Werror -fno-non-call-exceptions -Wno-array-bounds -Wno-stringop-overflow -Wno-stringop-overread
|
||||||
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),arm64)
|
||||||
|
SETTINGS += -mgeneral-regs-only -ffixed-x18
|
||||||
|
else ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),arm)
|
||||||
|
SETTINGS += -flto
|
||||||
|
endif
|
||||||
|
|
||||||
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_EXOSPHERE
|
|
||||||
SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -Wextra -Werror -flto -fno-non-call-exceptions \
|
|
||||||
-Wno-array-bounds \
|
|
||||||
-Wno-stringop-overflow \
|
|
||||||
-Wno-stringop-overread
|
|
||||||
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
||||||
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit
|
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit
|
||||||
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
||||||
@@ -74,69 +91,28 @@ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
|
||||||
|
|
||||||
$(strip $1): $$(ATMOSPHERE_LIBRARY_DIR)/$(strip $2)
|
|
||||||
|
|
||||||
$$(ATMOSPHERE_LIBRARY_DIR)/$(strip $2) : $$(ATMOSPHERE_LIBRARY_DIR) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(SOURCES) $$(INCLUDES) $$(GCH_DIRS)
|
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(CURDIR)/$$@ $(3) \
|
|
||||||
ATMOSPHERE_GCH_IDENTIFIER="$$(ATMOSPHERE_BOARD_NAME)_$$(ATMOSPHERE_ARCH_NAME)_$(strip $1)" \
|
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
|
||||||
@echo clean $(strip $1) ...
|
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(ATMOSPHERE_LIBRARY_DIR)/$(strip $2)
|
|
||||||
@rm -fr $$(foreach hdr,$$(GCH_DIRS),$$(hdr)/$$(ATMOSPHERE_BOARD_NAME)_$$(ATMOSPHERE_ARCH_NAME)_$(strip $1))
|
|
||||||
@for i in $$(GCH_DIRS) $$(ATMOSPHERE_BUILD_DIR) $$(ATMOSPHERE_LIBRARY_DIR); do [ -d $$$$i ] && rmdir --ignore-fail-on-non-empty $$$$i || true; done
|
|
||||||
|
|
||||||
.PHONY: $(strip $1) clean-$(strip $1) $$(ATMOSPHERE_LIBRARY_DIR)/$(strip $2)
|
|
||||||
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, $(TARGET).a, \
|
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS " \
|
|
||||||
))
|
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, $(TARGET)_debug.a, \
|
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_DEBUGGING" \
|
|
||||||
))
|
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, $(TARGET)_audit.a, \
|
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DAMS_FORCE_DISABLE_DETAILED_ASSERTIONS -DAMS_BUILD_FOR_AUDITING" \
|
|
||||||
))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-include $(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME).mk
|
|
||||||
|
|
||||||
ALL_GCH_IDENTIFIERS := $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)_$(config))
|
|
||||||
ALL_GCH_FILES := $(foreach hdr,$(PRECOMPILED_HEADERS:.hpp=.hpp.gch),$(foreach id,$(ALL_GCH_IDENTIFIERS),$(hdr)/$(id)))
|
|
||||||
|
|
||||||
.PHONY: clean all
|
.PHONY: clean all
|
||||||
|
|
||||||
$(ATMOSPHERE_LIBRARY_DIR) $(GCH_DIRS):
|
all: $(ATMOSPHERE_LIBRARY_DIR) $(ATMOSPHERE_BUILD_DIR) $(SOURCES) $(INCLUDES) $(GCH_DIRS) $(CPPFILES) $(CFILES) $(SFILES)
|
||||||
@[ -d $@ ] || mkdir -p $@
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURDIR)/$(ATMOSPHERE_LIBRARY_DIR)/$(TARGET).a \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
@[ -d $@ ] || mkdir -p $@
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
clean:
|
clean:
|
||||||
@echo clean ...
|
@echo clean $(ATMOSPHERE_BUILD_NAME) ...
|
||||||
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARY_DIR) *.bz2 $(ALL_GCH_FILES)
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
@rm -fr $(foreach hdr,$(GCH_DIRS),$(hdr)/$(ATMOSPHERE_GCH_IDENTIFIER))
|
||||||
@for i in $(GCH_DIRS); do [ -d $$i ] && rmdir --ignore-fail-on-non-empty $$i || true; done
|
@for i in $(GCH_DIRS); do [ -d $$i ] && rmdir --ignore-fail-on-non-empty $$i || true; done
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARY_DIR) $(ATMOSPHERE_BUILD_DIR) $(GCH_DIRS):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
else
|
else
|
||||||
|
|
||||||
GCH_FILES := $(foreach hdr,$(PRECOMPILED_HEADERS:.hpp=.hpp.gch),$(CURRENT_DIRECTORY)/$(hdr)/$(ATMOSPHERE_GCH_IDENTIFIER))
|
GCH_FILES := $(foreach hdr,$(PRECOMPILED_HEADERS:.hpp=.hpp.gch),$(CURRENT_DIRECTORY)/$(hdr)/$(ATMOSPHERE_GCH_IDENTIFIER))
|
||||||
DEPENDS := $(OFILES:.o=.d) $(foreach hdr,$(GCH_FILES),$(notdir $(patsubst %.hpp.gch/,%.d,$(dir $(hdr)))))
|
DEPENDS := $(OFILES:.o=.d) $(foreach hdr,$(GCH_FILES),$(notdir $(patsubst %.hpp.gch/,%.d,$(dir $(hdr)))))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@@ -148,8 +124,12 @@ $(OFILES) : $(GCH_FILES)
|
|||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
libc.o: CFLAGS += -fno-builtin -fno-lto
|
libc.o: CFLAGS += -fno-builtin
|
||||||
util_api.o: CXXFLAGS += -fno-lto
|
|
||||||
|
ifeq ($(strip $(ATMOSPHERE_ARCH_NAME)),arm)
|
||||||
|
libc.o: CFLAGS += -fno-lto
|
||||||
|
util_api.o: CFLAGS += -fno-lto
|
||||||
|
endif
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%_bin.h %.bin.o : %.bin
|
%_bin.h %.bin.o : %.bin
|
||||||
@@ -163,3 +143,4 @@ util_api.o: CXXFLAGS += -fno-lto
|
|||||||
#---------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------
|
||||||
endif
|
endif
|
||||||
#---------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include <exosphere.hpp>
|
||||||
|
|
||||||
|
namespace ams::impl {
|
||||||
|
|
||||||
|
NORETURN void UnexpectedDefaultImpl(const char *func, const char *file, int line) {
|
||||||
|
::ams::diag::AbortImpl("", func, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,169 +1,42 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# pull in common atmosphere configuration
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(CURRENT_DIRECTORY)/../config/common.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
PRECOMPILED_HEADERS := include/mesosphere.hpp
|
|
||||||
|
|
||||||
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE
|
|
||||||
SETTINGS := $(ATMOSPHERE_SETTINGS) -Os -mgeneral-regs-only -ffixed-x18 -Wextra -Werror -fno-non-call-exceptions
|
|
||||||
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
|
||||||
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit -flto
|
|
||||||
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
|
||||||
|
|
||||||
SOURCES += $(foreach v,$(call ALL_SOURCE_DIRS,../libvapours/source),$(if $(findstring ../libvapours/source/sdmmc,$v),,$v))
|
|
||||||
|
|
||||||
LIBS :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(ATMOSPHERE_LIBRARIES_DIR)/libvapours
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
export GCH_DIRS := $(PRECOMPILED_HEADERS:.hpp=.hpp.gch)
|
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I.
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS :=
|
|
||||||
all: release
|
|
||||||
|
|
||||||
define ATMOSPHERE_ADD_TARGET
|
define ATMOSPHERE_ADD_TARGET
|
||||||
|
|
||||||
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
$(strip $1): $$(ATMOSPHERE_LIBRARY_DIR)/$(strip $2)
|
$(strip $1):
|
||||||
|
@echo "Building $(strip $1)"
|
||||||
$$(ATMOSPHERE_LIBRARY_DIR)/$(strip $2) : $$(ATMOSPHERE_LIBRARY_DIR) $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(SOURCES) $$(INCLUDES) $$(GCH_DIRS)
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/libmesosphere.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
@$$(MAKE) __RECURSIVE__=1 OUTPUT=$$(CURDIR)/$$@ $(3) \
|
|
||||||
ATMOSPHERE_GCH_IDENTIFIER="$$(ATMOSPHERE_BOARD_NAME)_$$(ATMOSPHERE_ARCH_NAME)_$(strip $1)" \
|
|
||||||
DEPSDIR=$$(CURDIR)/$$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
--no-print-directory -C $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) \
|
|
||||||
-f $$(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
clean-$(strip $1):
|
clean-$(strip $1):
|
||||||
@echo clean $(strip $1) ...
|
@echo "Cleaning $(strip $1)"
|
||||||
@rm -fr $$(ATMOSPHERE_BUILD_DIR)/$(strip $1) $$(ATMOSPHERE_LIBRARY_DIR)/$(strip $2)
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/libmesosphere.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
@rm -fr $$(foreach hdr,$$(GCH_DIRS),$$(hdr)/$$(ATMOSPHERE_BOARD_NAME)_$$(ATMOSPHERE_ARCH_NAME)_$(strip $1))
|
|
||||||
@for i in $$(GCH_DIRS) $$(ATMOSPHERE_BUILD_DIR) $$(ATMOSPHERE_LIBRARY_DIR); do [ -d $$$$i ] && rmdir --ignore-fail-on-non-empty $$$$i || true; done
|
|
||||||
|
|
||||||
.PHONY: $(strip $1) clean-$(strip $1) $$(ATMOSPHERE_LIBRARY_DIR)/$(strip $2)
|
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, release, $(TARGET).a, \
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
ATMOSPHERE_BUILD_SETTINGS="" \
|
|
||||||
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, release, $(strip $2), $(strip $3), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4)" \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, debug, $(TARGET)_debug.a, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, debug, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DMESOSPHERE_BUILD_FOR_DEBUGGING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, audit, $(TARGET)_audit.a, \
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, audit, $(strip $2), $(strip $3), \
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DMESOSPHERE_BUILD_FOR_AUDITING" \
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $4) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 \
|
||||||
))
|
))
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, qemu_virt_release, $(TARGET)_qemu_virt.a, \
|
endef
|
||||||
ATMOSPHERE_BUILD_SETTINGS="" \
|
|
||||||
))
|
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, qemu_virt_debug, $(TARGET)_qemu_virt_debug.a, \
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, nx-hac-001, arm-cortex-a57,))
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DMESOSPHERE_BUILD_FOR_DEBUGGING" \
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, qemu_virt_a57, qemu-virt, arm-cortex-a57,))
|
||||||
))
|
|
||||||
|
|
||||||
$(eval $(call ATMOSPHERE_ADD_TARGET, qemu_virt_audit, $(TARGET)_qemu_virt_audit.a, \
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
ATMOSPHERE_BUILD_SETTINGS="-DMESOSPHERE_BUILD_FOR_AUDITING" \
|
|
||||||
))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-include $(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME).mk
|
|
||||||
|
|
||||||
ALL_GCH_IDENTIFIERS := $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)_$(config))
|
|
||||||
ALL_GCH_FILES := $(foreach hdr,$(PRECOMPILED_HEADERS:.hpp=.hpp.gch),$(foreach id,$(ALL_GCH_IDENTIFIERS),$(hdr)/$(id)))
|
|
||||||
|
|
||||||
.PHONY: clean all
|
|
||||||
|
|
||||||
$(ATMOSPHERE_LIBRARY_DIR) $(GCH_DIRS):
|
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
|
||||||
$(ATMOSPHERE_BUILD_DIR)/%:
|
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARY_DIR) *.bz2 $(ALL_GCH_FILES)
|
|
||||||
@for i in $(GCH_DIRS); do [ -d $$i ] && rmdir --ignore-fail-on-non-empty $$i || true; done
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
GCH_FILES := $(foreach hdr,$(PRECOMPILED_HEADERS:.hpp=.hpp.gch),$(CURRENT_DIRECTORY)/$(hdr)/$(ATMOSPHERE_GCH_IDENTIFIER))
|
|
||||||
DEPENDS := $(OFILES:.o=.d) $(foreach hdr,$(GCH_FILES),$(notdir $(patsubst %.hpp.gch/,%.d,$(dir $(hdr)))))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT) : $(OFILES)
|
|
||||||
|
|
||||||
$(filter-out kern_svc_tables.o, $(OFILES)) : $(GCH_FILES)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
kern_libc_generic.o: CFLAGS += -fno-builtin
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%_bin.h %.bin.o : %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|||||||
@@ -24,6 +24,19 @@ namespace ams::kern {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace ams::diag {
|
||||||
|
|
||||||
|
NORETURN ALWAYS_INLINE void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line) {
|
||||||
|
#if defined(MESOSPHERE_ENABLE_DEBUG_PRINT)
|
||||||
|
::ams::kern::Panic(file, line, "ams::diag::OnAssertionFailure: %d %s:%s", (type == AssertionType_Audit), func, expr);
|
||||||
|
#else
|
||||||
|
::ams::kern::Panic();
|
||||||
|
AMS_UNUSED(type, expr, func, file, line);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#define MESOSPHERE_UNUSED(...) AMS_UNUSED(__VA_ARGS__)
|
#define MESOSPHERE_UNUSED(...) AMS_UNUSED(__VA_ARGS__)
|
||||||
|
|
||||||
#ifdef MESOSPHERE_ENABLE_DEBUG_PRINT
|
#ifdef MESOSPHERE_ENABLE_DEBUG_PRINT
|
||||||
|
|||||||
123
libraries/libmesosphere/libmesosphere.mk
Normal file
123
libraries/libmesosphere/libmesosphere.mk
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# pull in common atmosphere configuration
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
|
include $(CURRENT_DIRECTORY)/../config/common.mk
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# options for code generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
PRECOMPILED_HEADERS := include/mesosphere.hpp
|
||||||
|
#PRECOMPILED_HEADERS :=
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_BUILD_FOR_DEBUGGING),1)
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
else
|
||||||
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
||||||
|
endif
|
||||||
|
|
||||||
|
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE
|
||||||
|
SETTINGS := $(ATMOSPHERE_SETTINGS) $(ATMOSPHERE_OPTIMIZATION_FLAG) -mgeneral-regs-only -ffixed-x18 -Wextra -Werror -fno-non-call-exceptions
|
||||||
|
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
||||||
|
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit -flto
|
||||||
|
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
||||||
|
|
||||||
|
SOURCES += $(foreach v,$(call ALL_SOURCE_DIRS,../libvapours/source),$(if $(findstring ../libvapours/source/sdmmc,$v),,$v))
|
||||||
|
|
||||||
|
LIBS :=
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# list of directories containing libraries, this must be the top level containing
|
||||||
|
# include and lib
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
LIBDIRS := $(ATMOSPHERE_LIBRARIES_DIR)/libvapours
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(__RECURSIVE__),1)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
||||||
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
||||||
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export GCH_DIRS := $(PRECOMPILED_HEADERS:.hpp=.hpp.gch)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I.
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.PHONY: clean all
|
||||||
|
|
||||||
|
all: $(ATMOSPHERE_LIBRARY_DIR) $(ATMOSPHERE_BUILD_DIR) $(SOURCES) $(INCLUDES) $(GCH_DIRS) $(CPPFILES) $(CFILES) $(SFILES)
|
||||||
|
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURDIR)/$(ATMOSPHERE_LIBRARY_DIR)/$(TARGET).a \
|
||||||
|
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
||||||
|
-f $(THIS_MAKEFILE)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo clean $(ATMOSPHERE_BUILD_NAME) ...
|
||||||
|
@rm -fr $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_OUT_DIR)
|
||||||
|
@rm -fr $(foreach hdr,$(GCH_DIRS),$(hdr)/$(ATMOSPHERE_GCH_IDENTIFIER))
|
||||||
|
@for i in $(GCH_DIRS); do [ -d $$i ] && rmdir --ignore-fail-on-non-empty $$i || true; done
|
||||||
|
|
||||||
|
$(ATMOSPHERE_LIBRARY_DIR) $(ATMOSPHERE_BUILD_DIR) $(GCH_DIRS):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
|
||||||
|
GCH_FILES := $(foreach hdr,$(PRECOMPILED_HEADERS:.hpp=.hpp.gch),$(CURRENT_DIRECTORY)/$(hdr)/$(ATMOSPHERE_GCH_IDENTIFIER))
|
||||||
|
DEPENDS := $(OFILES:.o=.d) $(foreach hdr,$(GCH_FILES),$(notdir $(patsubst %.hpp.gch/,%.d,$(dir $(hdr)))))
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(OUTPUT) : $(OFILES)
|
||||||
|
|
||||||
|
$(filter-out kern_svc_tables.o, $(OFILES)) : $(GCH_FILES)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
kern_libc_generic.o: CFLAGS += -fno-builtin
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%_bin.h %.bin.o : %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -1,145 +1,50 @@
|
|||||||
#---------------------------------------------------------------------------------
|
ATMOSPHERE_BUILD_CONFIGS :=
|
||||||
# pull in common atmosphere configuration
|
all: nx_release
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
||||||
include $(CURRENT_DIRECTORY)/../config/common.mk
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
define ATMOSPHERE_ADD_TARGET
|
||||||
# pull in switch rules
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(DEVKITPRO)),)
|
|
||||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
|
|
||||||
endif
|
|
||||||
|
|
||||||
include $(DEVKITPRO)/libnx/switch_rules
|
ATMOSPHERE_BUILD_CONFIGS += $(strip $1)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
$(strip $1):
|
||||||
# options for code generation
|
@echo "Building $(strip $1)"
|
||||||
#---------------------------------------------------------------------------------
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/libstratosphere.mk ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
PRECOMPILED_HEADERS := $(CURRENT_DIRECTORY)/include/stratosphere.hpp
|
|
||||||
#PRECOMPILED_HEADERS :=
|
|
||||||
|
|
||||||
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_STRATOSPHERE -D_GNU_SOURCE
|
clean-$(strip $1):
|
||||||
SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -Wextra -Werror -Wno-missing-field-initializers -flto
|
@echo "Cleaning $(strip $1)"
|
||||||
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
@$$(MAKE) -f $(CURRENT_DIRECTORY)/libstratosphere.mk clean ATMOSPHERE_MAKEFILE_TARGET="$(strip $1)" ATMOSPHERE_BUILD_NAME="$(strip $2)" ATMOSPHERE_BOARD="$(strip $3)" ATMOSPHERE_CPU="$(strip $4)" $(strip $5)
|
||||||
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS)
|
|
||||||
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS)
|
|
||||||
|
|
||||||
LDFLAGS := -specs=$(DEVKITPRO)/libnx/switch.specs $(SETTINGS) -Wl,-Map,$(notdir $*.map)
|
endef
|
||||||
|
|
||||||
SOURCES += $(call ALL_SOURCE_DIRS,../libvapours/source)
|
define ATMOSPHERE_ADD_TARGETS
|
||||||
SOURCES += $(call UNFILTERED_SOURCE_DIRS,source/os)
|
|
||||||
|
|
||||||
LIBS := -lnx
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_release, $(strip $2)release, $(strip $3), $(strip $4), \
|
||||||
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $5)" $(strip $6) \
|
||||||
|
))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_debug, $(strip $2)debug, $(strip $3), $(strip $4), \
|
||||||
# list of directories containing libraries, this must be the top level containing
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $5) -DAMS_BUILD_FOR_DEBUGGING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 $(strip $6) \
|
||||||
# include and lib
|
))
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(PORTLIBS) $(LIBNX) $(ATMOSPHERE_LIBRARIES_DIR)/libvapours
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
$(eval $(call ATMOSPHERE_ADD_TARGET, $(strip $1)_audit, $(strip $2)audit, $(strip $3), $(strip $4), \
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
ATMOSPHERE_BUILD_SETTINGS="$(strip $5) -DAMS_BUILD_FOR_AUDITING" ATMOSPHERE_BUILD_FOR_DEBUGGING=1 ATMOSPHERE_BUILD_FOR_AUDITING=1 $(strip $6) \
|
||||||
# rules for different file extensions
|
))
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
endef
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, nx, , nx-hac-001, arm-cortex-a57,,))
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, win_x64, , generic_windows, generic_x64,,))
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, linux_x64, , generic_linux, generic_x64,,))
|
||||||
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, linux_x64_clang, clang_, generic_linux, generic_x64,, ATMOSPHERE_COMPILER_NAME="clang"))
|
||||||
export GCH_FILES := $(PRECOMPILED_HEADERS:.hpp=.hpp.gch)
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, linux_arm64_clang, clang_, generic_linux, generic_arm64,, ATMOSPHERE_COMPILER_NAME="clang"))
|
||||||
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
|
||||||
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, macos_x64, , generic_macos, generic_x64,,))
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
$(eval $(call ATMOSPHERE_ADD_TARGETS, macos_arm64, , generic_macos, generic_arm64,,))
|
||||||
-I.
|
|
||||||
|
|
||||||
.PHONY: clean all lib/$(TARGET).a
|
clean: $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS),clean-$(config))
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
all: lib/$(TARGET).a
|
|
||||||
|
|
||||||
lib:
|
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
|
||||||
release:
|
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
|
||||||
lib/$(TARGET).a : lib release $(SOURCES) $(INCLUDES)
|
|
||||||
@$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \
|
|
||||||
BUILD_CFLAGS="-DNDEBUG=1 -O2" \
|
|
||||||
DEPSDIR=$(CURDIR)/release \
|
|
||||||
--no-print-directory -C release \
|
|
||||||
-f $(CURDIR)/Makefile
|
|
||||||
|
|
||||||
dist-bin: all
|
|
||||||
@tar --exclude=*~ -cjf $(TARGET).tar.bz2 include lib
|
|
||||||
|
|
||||||
dist-src:
|
|
||||||
@tar --exclude=*~ -cjf $(TARGET)-src.tar.bz2 include source Makefile
|
|
||||||
|
|
||||||
dist: dist-src dist-bin
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr release lib *.bz2 $(GCH_FILES)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d) $(foreach hdr,$(GCH_FILES:.hpp.gch=.d),$(notdir $(hdr)))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT) : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(GCH_FILES)
|
|
||||||
|
|
||||||
$(OFILES_SRC) : $(HFILES_BIN)
|
|
||||||
|
|
||||||
ams_environment_weak.o: CXXFLAGS += -fno-lto
|
|
||||||
hos_version_api_weak_for_unit_test.o: CXXFLAGS += -fno-lto
|
|
||||||
pm_info_api_weak.o: CXXFLAGS += -fno-lto
|
|
||||||
hos_stratosphere_api.o: CXXFLAGS += -fno-lto
|
|
||||||
|
|
||||||
init_operator_new.o: CXXFLAGS += -fno-lto
|
|
||||||
init_libnx_shim.os.horizon.o: CXXFLAGS += -fno-lto
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%_bin.h %.bin.o : %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
.PHONY: all clean $(foreach config,$(ATMOSPHERE_BUILD_CONFIGS), $(config) clean-$(config))
|
||||||
|
|||||||
@@ -16,6 +16,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/* Ensure that on windows we use lean-windows headers. */
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
|
||||||
/* libvapours (pulls in util, svc, results). */
|
/* libvapours (pulls in util, svc, results). */
|
||||||
#include <vapours.hpp>
|
#include <vapours.hpp>
|
||||||
|
|
||||||
@@ -54,6 +59,7 @@
|
|||||||
#include <stratosphere/erpt.hpp>
|
#include <stratosphere/erpt.hpp>
|
||||||
#include <stratosphere/err.hpp>
|
#include <stratosphere/err.hpp>
|
||||||
#include <stratosphere/fatal.hpp>
|
#include <stratosphere/fatal.hpp>
|
||||||
|
#include <stratosphere/gc.hpp>
|
||||||
#include <stratosphere/gpio.hpp>
|
#include <stratosphere/gpio.hpp>
|
||||||
#include <stratosphere/hid.hpp>
|
#include <stratosphere/hid.hpp>
|
||||||
#include <stratosphere/hos.hpp>
|
#include <stratosphere/hos.hpp>
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
namespace ams {
|
namespace ams {
|
||||||
|
|
||||||
/* Will be called by libstratosphere on crash. */
|
/* Will be called by libstratosphere on crash. */
|
||||||
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||||
void CrashHandler(ThreadExceptionDump *ctx);
|
void CrashHandler(ThreadExceptionDump *ctx);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* API for boot sysmodule. */
|
/* API for boot sysmodule. */
|
||||||
void InitializeForBoot();
|
void InitializeForBoot();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace ams::exosphere {
|
|||||||
|
|
||||||
ApiInfo GetApiInfo();
|
ApiInfo GetApiInfo();
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
|
||||||
void ForceRebootToRcm();
|
void ForceRebootToRcm();
|
||||||
void ForceRebootToIramPayload();
|
void ForceRebootToIramPayload();
|
||||||
void ForceRebootToFatalError();
|
void ForceRebootToFatalError();
|
||||||
@@ -35,6 +36,7 @@ namespace ams::exosphere {
|
|||||||
|
|
||||||
void CopyToIram(uintptr_t iram_dst, const void *dram_src, size_t size);
|
void CopyToIram(uintptr_t iram_dst, const void *dram_src, size_t size);
|
||||||
void CopyFromIram(void *dram_dst, uintptr_t iram_src, size_t size);
|
void CopyFromIram(void *dram_dst, uintptr_t iram_src, size_t size);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,10 @@ namespace ams::capsrv {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
static_assert(sizeof(ScreenShotDecodeOption) == 0x20);
|
static_assert(sizeof(ScreenShotDecodeOption) == 0x20);
|
||||||
static_assert(sizeof(ScreenShotDecodeOption) == sizeof(::CapsScreenShotDecodeOption));
|
|
||||||
static_assert(util::is_pod<ScreenShotDecodeOption>::value);
|
static_assert(util::is_pod<ScreenShotDecodeOption>::value);
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||||
|
static_assert(sizeof(ScreenShotDecodeOption) == sizeof(::CapsScreenShotDecodeOption));
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,10 +30,12 @@ namespace ams::cfg {
|
|||||||
OverrideStatusFlag_AddressSpaceShift = 3,
|
OverrideStatusFlag_AddressSpaceShift = 3,
|
||||||
OverrideStatusFlag_AddressSpaceMask = ((1u << 2) - 1) << OverrideStatusFlag_AddressSpaceShift,
|
OverrideStatusFlag_AddressSpaceMask = ((1u << 2) - 1) << OverrideStatusFlag_AddressSpaceShift,
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||||
OverrideStatusFlag_AddressSpace32Bit = (svc::CreateProcessFlag_AddressSpace32Bit >> svc::CreateProcessFlag_AddressSpaceShift) << OverrideStatusFlag_AddressSpaceShift,
|
OverrideStatusFlag_AddressSpace32Bit = (svc::CreateProcessFlag_AddressSpace32Bit >> svc::CreateProcessFlag_AddressSpaceShift) << OverrideStatusFlag_AddressSpaceShift,
|
||||||
OverrideStatusFlag_AddressSpace64BitDeprecated = (svc::CreateProcessFlag_AddressSpace64BitDeprecated >> svc::CreateProcessFlag_AddressSpaceShift) << OverrideStatusFlag_AddressSpaceShift,
|
OverrideStatusFlag_AddressSpace64BitDeprecated = (svc::CreateProcessFlag_AddressSpace64BitDeprecated >> svc::CreateProcessFlag_AddressSpaceShift) << OverrideStatusFlag_AddressSpaceShift,
|
||||||
OverrideStatusFlag_AddressSpace32BitWithoutAlias = (svc::CreateProcessFlag_AddressSpace32BitWithoutAlias >> svc::CreateProcessFlag_AddressSpaceShift) << OverrideStatusFlag_AddressSpaceShift,
|
OverrideStatusFlag_AddressSpace32BitWithoutAlias = (svc::CreateProcessFlag_AddressSpace32BitWithoutAlias >> svc::CreateProcessFlag_AddressSpaceShift) << OverrideStatusFlag_AddressSpaceShift,
|
||||||
OverrideStatusFlag_AddressSpace64Bit = (svc::CreateProcessFlag_AddressSpace64Bit >> svc::CreateProcessFlag_AddressSpaceShift) << OverrideStatusFlag_AddressSpaceShift,
|
OverrideStatusFlag_AddressSpace64Bit = (svc::CreateProcessFlag_AddressSpace64Bit >> svc::CreateProcessFlag_AddressSpaceShift) << OverrideStatusFlag_AddressSpaceShift,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -63,7 +65,11 @@ namespace ams::cfg {
|
|||||||
static_assert(util::is_pod<OverrideStatus>::value, "util::is_pod<OverrideStatus>::value");
|
static_assert(util::is_pod<OverrideStatus>::value, "util::is_pod<OverrideStatus>::value");
|
||||||
|
|
||||||
constexpr inline bool operator==(const OverrideStatus &lhs, const OverrideStatus &rhs) {
|
constexpr inline bool operator==(const OverrideStatus &lhs, const OverrideStatus &rhs) {
|
||||||
return std::memcmp(std::addressof(lhs), std::addressof(rhs), sizeof(lhs)) == 0;
|
if (std::is_constant_evaluated()) {
|
||||||
|
return lhs.keys_held == rhs.keys_held && lhs.flags == rhs.flags;
|
||||||
|
} else {
|
||||||
|
return std::memcmp(std::addressof(lhs), std::addressof(rhs), sizeof(lhs)) == 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr inline bool operator!=(const OverrideStatus &lhs, const OverrideStatus &rhs) {
|
constexpr inline bool operator!=(const OverrideStatus &lhs, const OverrideStatus &rhs) {
|
||||||
|
|||||||
@@ -19,8 +19,12 @@
|
|||||||
|
|
||||||
namespace ams::dd {
|
namespace ams::dd {
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||||
using DeviceName = ::ams::svc::DeviceName;
|
using DeviceName = ::ams::svc::DeviceName;
|
||||||
using enum ::ams::svc::DeviceName;
|
using enum ::ams::svc::DeviceName;
|
||||||
|
#else
|
||||||
|
enum DeviceName { };
|
||||||
|
#endif
|
||||||
|
|
||||||
constexpr inline u64 DeviceAddressSpaceMemoryRegionAlignment = 4_KB;
|
constexpr inline u64 DeviceAddressSpaceMemoryRegionAlignment = 4_KB;
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ namespace ams::ddsf {
|
|||||||
m_session_list.clear();
|
m_session_list.clear();
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
~IDevice() {
|
virtual ~IDevice() {
|
||||||
m_session_list.clear();
|
m_session_list.clear();
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace ams::ddsf {
|
|||||||
m_device_list.clear();
|
m_device_list.clear();
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
~IDriver() {
|
virtual ~IDriver() {
|
||||||
m_device_list.clear();
|
m_device_list.clear();
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace ams::ddsf {
|
|||||||
public:
|
public:
|
||||||
IEventHandler() : m_holder(), m_user_data(0), m_is_initialized(false), m_is_registered(false) { /* ... */ }
|
IEventHandler() : m_holder(), m_user_data(0), m_is_initialized(false), m_is_registered(false) { /* ... */ }
|
||||||
|
|
||||||
~IEventHandler() {
|
virtual ~IEventHandler() {
|
||||||
if (this->IsRegistered()) {
|
if (this->IsRegistered()) {
|
||||||
this->Unlink();
|
this->Unlink();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace ams::ddsf {
|
|||||||
public:
|
public:
|
||||||
ISession() : m_list_node(), m_device(nullptr), m_access_mode() { /* ... */ }
|
ISession() : m_list_node(), m_device(nullptr), m_access_mode() { /* ... */ }
|
||||||
protected:
|
protected:
|
||||||
~ISession() { this->DetachDevice(); AMS_ASSERT(!this->IsOpen()); }
|
virtual ~ISession() { this->DetachDevice(); AMS_ASSERT(!this->IsOpen()); }
|
||||||
public:
|
public:
|
||||||
void AddTo(List &list) {
|
void AddTo(List &list) {
|
||||||
list.push_back(*this);
|
list.push_back(*this);
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ namespace ams::ddsf::impl {
|
|||||||
public:
|
public:
|
||||||
#if !(defined(AMS_BUILD_FOR_DEBUGGING) || defined(AMS_BUILD_FOR_AUDITING))
|
#if !(defined(AMS_BUILD_FOR_DEBUGGING) || defined(AMS_BUILD_FOR_AUDITING))
|
||||||
constexpr TypeTag() : m_class_name(nullptr), m_base(nullptr) { /* ... */}
|
constexpr TypeTag() : m_class_name(nullptr), m_base(nullptr) { /* ... */}
|
||||||
constexpr TypeTag(const TypeTag &b) : m_class_name(nullptr), m_base(std::addressof(b)) { AMS_ASSERT(this != m_base); }
|
constexpr TypeTag(const TypeTag &b) : m_class_name(nullptr), m_base(std::addressof(b)) { if (!std::is_constant_evaluated()) { AMS_ASSERT(this != m_base); } }
|
||||||
|
|
||||||
constexpr TypeTag(const char *c) : m_class_name(nullptr), m_base(nullptr) { AMS_UNUSED(c); }
|
constexpr TypeTag(const char *c) : m_class_name(nullptr), m_base(nullptr) { AMS_UNUSED(c); }
|
||||||
constexpr TypeTag(const char *c, const TypeTag &b) : m_class_name(nullptr), m_base(std::addressof(b)) { AMS_UNUSED(c); AMS_ASSERT(this != m_base); }
|
constexpr TypeTag(const char *c, const TypeTag &b) : m_class_name(nullptr), m_base(std::addressof(b)) { if (!std::is_constant_evaluated()) { AMS_UNUSED(c); AMS_ASSERT(this != m_base); } }
|
||||||
#else
|
#else
|
||||||
constexpr TypeTag(const char *c) : m_class_name(c), m_base(nullptr) { /* ... */ }
|
constexpr TypeTag(const char *c) : m_class_name(c), m_base(nullptr) { /* ... */ }
|
||||||
constexpr TypeTag(const char *c, const TypeTag &b) : m_class_name(c), m_base(std::addressof(b)) { AMS_ASSERT(this != m_base); }
|
constexpr TypeTag(const char *c, const TypeTag &b) : m_class_name(c), m_base(std::addressof(b)) { if (!std::is_constant_evaluated()) { AMS_ASSERT(this != m_base); } }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr const char * GetClassName() const { return m_class_name; }
|
constexpr const char * GetClassName() const { return m_class_name; }
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
#include <stratosphere/diag/impl/diag_impl_log.hpp>
|
#include <stratosphere/diag/impl/diag_impl_log.hpp>
|
||||||
#include <stratosphere/diag/diag_log.hpp>
|
#include <stratosphere/diag/diag_log.hpp>
|
||||||
#include <stratosphere/diag/diag_sdk_log.hpp>
|
#include <stratosphere/diag/diag_sdk_log.hpp>
|
||||||
|
#include <stratosphere/diag/diag_abort_observer.hpp>
|
||||||
|
#include <stratosphere/diag/diag_assertion_failure_handler.hpp>
|
||||||
|
|
||||||
#include <stratosphere/diag/impl/diag_utf8_util.hpp>
|
#include <stratosphere/diag/impl/diag_utf8_util.hpp>
|
||||||
|
|
||||||
|
#include <stratosphere/diag/diag_backtrace.hpp>
|
||||||
|
#include <stratosphere/diag/diag_symbol.hpp>
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/diag/diag_log_types.hpp>
|
||||||
|
|
||||||
|
namespace ams::diag {
|
||||||
|
|
||||||
|
using AbortObserver = void (*)(const AbortInfo &);
|
||||||
|
|
||||||
|
struct AbortObserverHolder {
|
||||||
|
AbortObserver observer;
|
||||||
|
AbortObserverHolder *next;
|
||||||
|
bool is_registered;
|
||||||
|
};
|
||||||
|
|
||||||
|
void InitializeAbortObserverHolder(AbortObserverHolder *holder, AbortObserver observer);
|
||||||
|
|
||||||
|
void RegisterAbortObserver(AbortObserverHolder *holder);
|
||||||
|
void UnregisterAbortObserver(AbortObserverHolder *holder);
|
||||||
|
void EnableDefaultAbortObserver(bool en);
|
||||||
|
|
||||||
|
struct SdkAbortInfo {
|
||||||
|
AbortInfo abort_info;
|
||||||
|
Result result;
|
||||||
|
const ::ams::os::UserExceptionInfo *exc_info;
|
||||||
|
};
|
||||||
|
|
||||||
|
using SdkAbortObserver = void (*)(const SdkAbortInfo &);
|
||||||
|
|
||||||
|
struct SdkAbortObserverHolder {
|
||||||
|
SdkAbortObserver observer;
|
||||||
|
SdkAbortObserverHolder *next;
|
||||||
|
bool is_registered;
|
||||||
|
};
|
||||||
|
|
||||||
|
void InitializeSdkAbortObserverHolder(SdkAbortObserverHolder *holder, SdkAbortObserver observer);
|
||||||
|
|
||||||
|
void RegisterSdkAbortObserver(SdkAbortObserverHolder *holder);
|
||||||
|
void UnregisterSdkAbortObserver(SdkAbortObserverHolder *holder);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
#include <stratosphere/diag/diag_log_types.hpp>
|
||||||
|
|
||||||
|
namespace ams::diag {
|
||||||
|
|
||||||
|
enum AssertionFailureOperation {
|
||||||
|
AssertionFailureOperation_Abort,
|
||||||
|
AssertionFailureOperation_Continue,
|
||||||
|
};
|
||||||
|
|
||||||
|
using AssertionFailureHandler = AssertionFailureOperation (*)(const AssertionInfo &info);
|
||||||
|
|
||||||
|
void SetAssertionFailureHandler(AssertionFailureHandler handler);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||||
|
#include <stratosphere/diag/impl/diag_backtrace_impl.os.horizon.hpp>
|
||||||
|
#elif defined(ATMOSPHERE_OS_WINDOWS)
|
||||||
|
#include <stratosphere/diag/impl/diag_backtrace_impl.os.windows.hpp>
|
||||||
|
#elif defined(ATMOSPHERE_OS_LINUX)
|
||||||
|
#include <stratosphere/diag/impl/diag_backtrace_impl.os.linux.hpp>
|
||||||
|
#elif defined(ATMOSPHERE_OS_MACOS)
|
||||||
|
#include <stratosphere/diag/impl/diag_backtrace_impl.os.macos.hpp>
|
||||||
|
#else
|
||||||
|
#error "Unknown OS for diag::Backtrace"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace ams::diag {
|
||||||
|
|
||||||
|
size_t GetBacktrace(uintptr_t *out, size_t out_size);
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||||
|
size_t GetBacktace(uintptr_t *out, size_t out_size, uintptr_t fp, uintptr_t sp, uintptr_t pc);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class Backtrace {
|
||||||
|
private:
|
||||||
|
impl::Backtrace m_impl;
|
||||||
|
public:
|
||||||
|
NOINLINE Backtrace() {
|
||||||
|
m_impl.Initialize();
|
||||||
|
m_impl.Step();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||||
|
Backtrace(uintptr_t fp, uintptr_t sp, uintptr_t pc) {
|
||||||
|
m_impl.Initialize(fp, sp, pc);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool Step() { return m_impl.Step(); }
|
||||||
|
|
||||||
|
uintptr_t GetStackPointer() const { return m_impl.GetStackPointer(); }
|
||||||
|
uintptr_t GetReturnAddress() const { return m_impl.GetReturnAddress(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
namespace ams::diag {
|
||||||
|
|
||||||
|
uintptr_t GetSymbolName(char *dst, size_t dst_size, uintptr_t address);
|
||||||
|
size_t GetSymbolSize(uintptr_t address);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
|
||||||
|
namespace ams::diag::impl {
|
||||||
|
|
||||||
|
class Backtrace {
|
||||||
|
private:
|
||||||
|
static constexpr size_t MemoryInfoBufferSize = 5;
|
||||||
|
public:
|
||||||
|
struct StackInfo {
|
||||||
|
uintptr_t stack_top;
|
||||||
|
uintptr_t stack_bottom;
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
s64 m_memory_info_buffer[MemoryInfoBufferSize]{};
|
||||||
|
StackInfo *m_current_stack_info = nullptr;
|
||||||
|
StackInfo m_exception_stack_info{};
|
||||||
|
StackInfo m_normal_stack_info{};
|
||||||
|
uintptr_t m_fp = 0;
|
||||||
|
uintptr_t m_prev_fp = 0;
|
||||||
|
uintptr_t m_lr = 0;
|
||||||
|
public:
|
||||||
|
Backtrace() = default;
|
||||||
|
|
||||||
|
void Initialize();
|
||||||
|
void Initialize(uintptr_t fp, uintptr_t sp, uintptr_t pc);
|
||||||
|
|
||||||
|
bool Step();
|
||||||
|
uintptr_t GetStackPointer() const;
|
||||||
|
uintptr_t GetReturnAddress() const;
|
||||||
|
private:
|
||||||
|
void SetStackInfo(uintptr_t fp, uintptr_t sp);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
|
||||||
|
namespace ams::diag::impl {
|
||||||
|
|
||||||
|
class Backtrace {
|
||||||
|
private:
|
||||||
|
static constexpr size_t BacktraceEntryCountMax = 0x80;
|
||||||
|
private:
|
||||||
|
void *m_backtrace_addresses[BacktraceEntryCountMax];
|
||||||
|
size_t m_index = 0;
|
||||||
|
size_t m_size = 0;
|
||||||
|
public:
|
||||||
|
Backtrace() = default;
|
||||||
|
|
||||||
|
void Initialize();
|
||||||
|
|
||||||
|
bool Step();
|
||||||
|
uintptr_t GetStackPointer() const;
|
||||||
|
uintptr_t GetReturnAddress() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
|
||||||
|
namespace ams::diag::impl {
|
||||||
|
|
||||||
|
class Backtrace {
|
||||||
|
private:
|
||||||
|
static constexpr size_t BacktraceEntryCountMax = 0x80;
|
||||||
|
private:
|
||||||
|
void *m_backtrace_addresses[BacktraceEntryCountMax];
|
||||||
|
size_t m_index = 0;
|
||||||
|
size_t m_size = 0;
|
||||||
|
public:
|
||||||
|
Backtrace() = default;
|
||||||
|
|
||||||
|
void Initialize();
|
||||||
|
|
||||||
|
bool Step();
|
||||||
|
uintptr_t GetStackPointer() const;
|
||||||
|
uintptr_t GetReturnAddress() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <vapours.hpp>
|
||||||
|
|
||||||
|
namespace ams::diag::impl {
|
||||||
|
|
||||||
|
class Backtrace {
|
||||||
|
private:
|
||||||
|
static constexpr size_t BacktraceEntryCountMax = 0x80;
|
||||||
|
private:
|
||||||
|
void *m_backtrace_addresses[BacktraceEntryCountMax];
|
||||||
|
size_t m_index = 0;
|
||||||
|
size_t m_size = 0;
|
||||||
|
public:
|
||||||
|
Backtrace() = default;
|
||||||
|
|
||||||
|
void Initialize();
|
||||||
|
|
||||||
|
bool Step();
|
||||||
|
uintptr_t GetStackPointer() const;
|
||||||
|
uintptr_t GetReturnAddress() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,6 +21,13 @@
|
|||||||
|
|
||||||
namespace ams::fatal {
|
namespace ams::fatal {
|
||||||
|
|
||||||
|
enum FatalPolicy {
|
||||||
|
FatalPolicy_ErrorReportAndErrorScreen = 0,
|
||||||
|
FatalPolicy_ErrorReport = 1,
|
||||||
|
FatalPolicy_ErrorScreen = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_ARCH_ARM64)
|
||||||
namespace aarch64 {
|
namespace aarch64 {
|
||||||
|
|
||||||
enum RegisterName {
|
enum RegisterName {
|
||||||
@@ -150,7 +157,7 @@ namespace ams::fatal {
|
|||||||
void SetProgramIdForAtmosphere(ncm::ProgramId program_id) {
|
void SetProgramIdForAtmosphere(ncm::ProgramId program_id) {
|
||||||
/* Right now, we mux program ID in through afsr when creport. */
|
/* Right now, we mux program ID in through afsr when creport. */
|
||||||
/* TODO: Better way to do this? */
|
/* TODO: Better way to do this? */
|
||||||
this->afsr0 = static_cast<RegisterType>(program_id);
|
this->afsr0 = static_cast<RegisterType>(program_id.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
ncm::ProgramId GetProgramIdForAtmosphere() const {
|
ncm::ProgramId GetProgramIdForAtmosphere() const {
|
||||||
@@ -172,7 +179,9 @@ namespace ams::fatal {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_ARCH_ARM64) || defined(ATMOSPHERE_ARCH_ARM)
|
||||||
namespace aarch32 {
|
namespace aarch32 {
|
||||||
|
|
||||||
enum RegisterName {
|
enum RegisterName {
|
||||||
@@ -268,8 +277,8 @@ namespace ams::fatal {
|
|||||||
void SetProgramIdForAtmosphere(ncm::ProgramId program_id) {
|
void SetProgramIdForAtmosphere(ncm::ProgramId program_id) {
|
||||||
/* Right now, we mux program ID in through afsr when creport. */
|
/* Right now, we mux program ID in through afsr when creport. */
|
||||||
/* TODO: Better way to do this? */
|
/* TODO: Better way to do this? */
|
||||||
this->afsr0 = static_cast<RegisterType>(static_cast<u64>(program_id) >> 0);
|
this->afsr0 = static_cast<RegisterType>(static_cast<u64>(program_id.value) >> 0);
|
||||||
this->afsr1 = static_cast<RegisterType>(static_cast<u64>(program_id) >> 32);
|
this->afsr1 = static_cast<RegisterType>(static_cast<u64>(program_id.value) >> 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
ncm::ProgramId GetProgramIdForAtmosphere() const {
|
ncm::ProgramId GetProgramIdForAtmosphere() const {
|
||||||
@@ -291,16 +300,158 @@ namespace ams::fatal {
|
|||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_ARCH_X64)
|
||||||
|
namespace x64 {
|
||||||
|
|
||||||
|
enum RegisterName {
|
||||||
|
/* TODO */
|
||||||
|
RegisterName_Count,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CpuContext {
|
||||||
|
using RegisterType = u64;
|
||||||
|
static constexpr size_t MaxStackTraceDepth = 0x20;
|
||||||
|
|
||||||
|
static constexpr const char *RegisterNameStrings[RegisterName_Count] = {
|
||||||
|
/* TODO */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Registers, exception context. N left names for these fields in fatal .rodata. */
|
||||||
|
union {
|
||||||
|
// struct {
|
||||||
|
// /* TODO */
|
||||||
|
// };
|
||||||
|
RegisterType registers[RegisterName_Count];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Misc. */
|
||||||
|
RegisterType stack_trace[MaxStackTraceDepth];
|
||||||
|
RegisterType base_address;
|
||||||
|
RegisterType register_set_flags;
|
||||||
|
u32 stack_trace_size;
|
||||||
|
|
||||||
|
void ClearState() {
|
||||||
|
std::memset(this, 0, sizeof(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetProgramIdForAtmosphere(ncm::ProgramId program_id) {
|
||||||
|
AMS_UNUSED(program_id);
|
||||||
|
AMS_ABORT("TODO");
|
||||||
|
}
|
||||||
|
|
||||||
|
ncm::ProgramId GetProgramIdForAtmosphere() const {
|
||||||
|
AMS_ABORT("TODO");
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetRegisterValue(RegisterName name, RegisterType value) {
|
||||||
|
this->registers[name] = value;
|
||||||
|
this->register_set_flags |= (RegisterType(1) << name);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HasRegisterValue(RegisterName name) const {
|
||||||
|
return this->register_set_flags & (RegisterType(1) << name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetBaseAddress(RegisterType base_addr) {
|
||||||
|
this->base_address = base_addr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_ARCH_X64) || defined(ATMOSPHERE_ARCH_X86)
|
||||||
|
namespace x86 {
|
||||||
|
|
||||||
|
enum RegisterName {
|
||||||
|
/* TODO */
|
||||||
|
RegisterName_Count,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CpuContext {
|
||||||
|
using RegisterType = u32;
|
||||||
|
static constexpr size_t MaxStackTraceDepth = 0x20;
|
||||||
|
|
||||||
|
static constexpr const char *RegisterNameStrings[RegisterName_Count] = {
|
||||||
|
/* TODO */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Registers, exception context. N left names for these fields in fatal .rodata. */
|
||||||
|
union {
|
||||||
|
// struct {
|
||||||
|
// /* TODO */
|
||||||
|
// };
|
||||||
|
RegisterType registers[RegisterName_Count];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Misc. Yes, stack_trace_size is really laid out differently than aarch64... */
|
||||||
|
RegisterType stack_trace[MaxStackTraceDepth];
|
||||||
|
u32 stack_trace_size;
|
||||||
|
RegisterType base_address;
|
||||||
|
RegisterType register_set_flags;
|
||||||
|
|
||||||
|
void ClearState() {
|
||||||
|
std::memset(this, 0, sizeof(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetProgramIdForAtmosphere(ncm::ProgramId program_id) {
|
||||||
|
AMS_UNUSED(program_id);
|
||||||
|
AMS_ABORT("TODO");
|
||||||
|
}
|
||||||
|
|
||||||
|
ncm::ProgramId GetProgramIdForAtmosphere() const {
|
||||||
|
AMS_ABORT("TODO");
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetRegisterValue(RegisterName name, RegisterType value) {
|
||||||
|
this->registers[name] = value;
|
||||||
|
this->register_set_flags |= (RegisterType(1) << name);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HasRegisterValue(RegisterName name) const {
|
||||||
|
return this->register_set_flags & (RegisterType(1) << name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetBaseAddress(RegisterType base_addr) {
|
||||||
|
this->base_address = base_addr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct CpuContext : sf::LargeData, sf::PrefersMapAliasTransferMode {
|
struct CpuContext : sf::LargeData, sf::PrefersMapAliasTransferMode {
|
||||||
enum Architecture {
|
enum Architecture {
|
||||||
Architecture_Aarch64 = 0,
|
#if defined(ATMOSPHERE_ARCH_ARM64)
|
||||||
Architecture_Aarch32 = 1,
|
Architecture_Aarch64,
|
||||||
|
#endif
|
||||||
|
#if defined(ATMOSPHERE_ARCH_ARM64) || defined(ATMOSPHERE_ARCH_ARM)
|
||||||
|
Architecture_Aarch32,
|
||||||
|
#endif
|
||||||
|
#if defined(ATMOSPHERE_X64)
|
||||||
|
Architecture_X64,
|
||||||
|
#endif
|
||||||
|
#if defined(ATMOSPHERE_X64) || defined(ATMOSPHERE_ARCH_X86)
|
||||||
|
Architecture_X86,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
#if defined(ATMOSPHERE_ARCH_ARM64)
|
||||||
aarch64::CpuContext aarch64_ctx;
|
aarch64::CpuContext aarch64_ctx;
|
||||||
|
#endif
|
||||||
|
#if defined(ATMOSPHERE_ARCH_ARM64) || defined(ATMOSPHERE_ARCH_ARM)
|
||||||
aarch32::CpuContext aarch32_ctx;
|
aarch32::CpuContext aarch32_ctx;
|
||||||
|
#endif
|
||||||
|
#if defined(ATMOSPHERE_X64)
|
||||||
|
aarch64::CpuContext x64_ctx;
|
||||||
|
#endif
|
||||||
|
#if defined(ATMOSPHERE_X64) || defined(ATMOSPHERE_ARCH_X86)
|
||||||
|
aarch64::CpuContext x86_ctx;
|
||||||
|
#endif
|
||||||
|
u8 raw_storage[0x248];
|
||||||
};
|
};
|
||||||
|
|
||||||
Architecture architecture;
|
Architecture architecture;
|
||||||
@@ -311,8 +462,12 @@ namespace ams::fatal {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_ARCH_ARM64)
|
||||||
static_assert(util::is_pod<aarch64::CpuContext>::value && sizeof(aarch64::CpuContext) == 0x248, "aarch64::CpuContext definition!");
|
static_assert(util::is_pod<aarch64::CpuContext>::value && sizeof(aarch64::CpuContext) == 0x248, "aarch64::CpuContext definition!");
|
||||||
|
#endif
|
||||||
|
#if defined(ATMOSPHERE_ARCH_ARM64) || defined(ATMOSPHERE_ARCH_ARM)
|
||||||
static_assert(util::is_pod<aarch32::CpuContext>::value && sizeof(aarch32::CpuContext) == 0xE0, "aarch32::CpuContext definition!");
|
static_assert(util::is_pod<aarch32::CpuContext>::value && sizeof(aarch32::CpuContext) == 0xE0, "aarch32::CpuContext definition!");
|
||||||
|
#endif
|
||||||
static_assert(util::is_pod<CpuContext>::value && sizeof(CpuContext) == 0x250, "CpuContext definition!");
|
static_assert(util::is_pod<CpuContext>::value && sizeof(CpuContext) == 0x250, "CpuContext definition!");
|
||||||
|
|
||||||
namespace srv {
|
namespace srv {
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#include <stratosphere/sf.hpp>
|
#include <stratosphere/sf.hpp>
|
||||||
|
|
||||||
#define AMS_FATAL_I_SERVICE_INTERFACE_INFO(C, H) \
|
#define AMS_FATAL_I_SERVICE_INTERFACE_INFO(C, H) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 0, Result, ThrowFatal, (Result error, const sf::ClientProcessId &client_pid), (error, client_pid)) \
|
AMS_SF_METHOD_INFO(C, H, 0, Result, ThrowFatal, (Result error, const sf::ClientProcessId &client_pid), (error, client_pid)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 1, Result, ThrowFatalWithPolicy, (Result error, const sf::ClientProcessId &client_pid, FatalPolicy policy), (error, client_pid, policy)) \
|
AMS_SF_METHOD_INFO(C, H, 1, Result, ThrowFatalWithPolicy, (Result error, const sf::ClientProcessId &client_pid, fatal::FatalPolicy policy), (error, client_pid, policy)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 2, Result, ThrowFatalWithCpuContext, (Result error, const sf::ClientProcessId &client_pid, FatalPolicy policy, const fatal::CpuContext &cpu_ctx), (error, client_pid, policy, cpu_ctx))
|
AMS_SF_METHOD_INFO(C, H, 2, Result, ThrowFatalWithCpuContext, (Result error, const sf::ClientProcessId &client_pid, fatal::FatalPolicy policy, const fatal::CpuContext &cpu_ctx), (error, client_pid, policy, cpu_ctx))
|
||||||
|
|
||||||
AMS_SF_DEFINE_INTERFACE(ams::fatal::impl, IService, AMS_FATAL_I_SERVICE_INTERFACE_INFO)
|
AMS_SF_DEFINE_INTERFACE(ams::fatal::impl, IService, AMS_FATAL_I_SERVICE_INTERFACE_INFO)
|
||||||
|
|||||||
@@ -41,7 +41,9 @@
|
|||||||
#include <stratosphere/fs/fs_speed_emulation.hpp>
|
#include <stratosphere/fs/fs_speed_emulation.hpp>
|
||||||
#include <stratosphere/fs/impl/fs_common_mount_name.hpp>
|
#include <stratosphere/fs/impl/fs_common_mount_name.hpp>
|
||||||
#include <stratosphere/fs/fs_mount.hpp>
|
#include <stratosphere/fs/fs_mount.hpp>
|
||||||
#include <stratosphere/fs/fs_path_utils.hpp>
|
#include <stratosphere/fs/fs_path_utility.hpp>
|
||||||
|
#include <stratosphere/fs/fs_path.hpp>
|
||||||
|
#include <stratosphere/fs/common/fs_directory_path_parser.hpp>
|
||||||
#include <stratosphere/fs/fs_filesystem_utils.hpp>
|
#include <stratosphere/fs/fs_filesystem_utils.hpp>
|
||||||
#include <stratosphere/fs/fs_romfs_filesystem.hpp>
|
#include <stratosphere/fs/fs_romfs_filesystem.hpp>
|
||||||
#include <stratosphere/fs/impl/fs_data.hpp>
|
#include <stratosphere/fs/impl/fs_data.hpp>
|
||||||
@@ -50,8 +52,9 @@
|
|||||||
#include <stratosphere/fs/fs_code.hpp>
|
#include <stratosphere/fs/fs_code.hpp>
|
||||||
#include <stratosphere/fs/fs_content.hpp>
|
#include <stratosphere/fs/fs_content.hpp>
|
||||||
#include <stratosphere/fs/fs_content_storage.hpp>
|
#include <stratosphere/fs/fs_content_storage.hpp>
|
||||||
#include <stratosphere/fs/fs_image_directory.hpp>
|
|
||||||
#include <stratosphere/fs/fs_game_card.hpp>
|
#include <stratosphere/fs/fs_game_card.hpp>
|
||||||
|
#include <stratosphere/fs/fs_host.hpp>
|
||||||
|
#include <stratosphere/fs/fs_image_directory.hpp>
|
||||||
#include <stratosphere/fs/fs_save_data_types.hpp>
|
#include <stratosphere/fs/fs_save_data_types.hpp>
|
||||||
#include <stratosphere/fs/fs_save_data_management.hpp>
|
#include <stratosphere/fs/fs_save_data_management.hpp>
|
||||||
#include <stratosphere/fs/fs_save_data_transaction.hpp>
|
#include <stratosphere/fs/fs_save_data_transaction.hpp>
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ namespace ams::fs {
|
|||||||
R_UNLESS(cur != InvalidPosition, fs::ResultDbmKeyNotFound());
|
R_UNLESS(cur != InvalidPosition, fs::ResultDbmKeyNotFound());
|
||||||
|
|
||||||
u8 *buf = static_cast<u8 *>(::ams::fs::impl::Allocate(MaxAuxiliarySize));
|
u8 *buf = static_cast<u8 *>(::ams::fs::impl::Allocate(MaxAuxiliarySize));
|
||||||
R_UNLESS(buf != nullptr, fs::ResultAllocationFailureInDbmRomKeyValueStorage());
|
R_UNLESS(buf != nullptr, fs::ResultAllocationMemoryFailedInDbmRomKeyValueStorage());
|
||||||
ON_SCOPE_EXIT { ::ams::fs::impl::Deallocate(buf, MaxAuxiliarySize); };
|
ON_SCOPE_EXIT { ::ams::fs::impl::Deallocate(buf, MaxAuxiliarySize); };
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|||||||
@@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Atmosphère-NX
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
#include <stratosphere/fs/fs_common.hpp>
|
||||||
|
#include <stratosphere/fs/fs_path.hpp>
|
||||||
|
|
||||||
|
namespace ams::fs {
|
||||||
|
|
||||||
|
class DirectoryPathParser {
|
||||||
|
NON_COPYABLE(DirectoryPathParser);
|
||||||
|
NON_MOVEABLE(DirectoryPathParser);
|
||||||
|
private:
|
||||||
|
char *m_buffer;
|
||||||
|
char m_replaced_char;
|
||||||
|
s32 m_position;
|
||||||
|
fs::Path m_current_path;
|
||||||
|
public:
|
||||||
|
DirectoryPathParser() : m_buffer(nullptr), m_replaced_char(StringTraits::NullTerminator), m_position(0), m_current_path() { /* ... */ }
|
||||||
|
|
||||||
|
const fs::Path &GetCurrentPath() const {
|
||||||
|
return m_current_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Initialize(fs::Path *path) {
|
||||||
|
/* Declare a default buffer, in case the path has no write buffer. */
|
||||||
|
static constinit char EmptyBuffer[1] = "";
|
||||||
|
|
||||||
|
/* Get a usable buffer. */
|
||||||
|
char *buf = path->GetWriteBufferLength() > 0 ? path->GetWriteBuffer() : EmptyBuffer;
|
||||||
|
|
||||||
|
/* Get the windows skip length. */
|
||||||
|
const auto windows_skip_len = fs::GetWindowsSkipLength(buf);
|
||||||
|
|
||||||
|
/* Set our buffer. */
|
||||||
|
m_buffer = buf + windows_skip_len;
|
||||||
|
|
||||||
|
/* Set up our initial state. */
|
||||||
|
if (windows_skip_len) {
|
||||||
|
R_TRY(m_current_path.InitializeWithNormalization(buf, windows_skip_len + 1));
|
||||||
|
} else {
|
||||||
|
if (char * const first = this->ReadNextImpl(); first != nullptr) {
|
||||||
|
R_TRY(m_current_path.InitializeWithNormalization(first));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ReadNext(bool *out_finished) {
|
||||||
|
/* Default to not finished. */
|
||||||
|
*out_finished = false;
|
||||||
|
|
||||||
|
/* Get the next child component. */
|
||||||
|
if (auto * const child = this->ReadNextImpl(); child != nullptr) {
|
||||||
|
/* Append the child component to our current path. */
|
||||||
|
R_TRY(m_current_path.AppendChild(child));
|
||||||
|
} else {
|
||||||
|
/* We have no child component, so we're finished. */
|
||||||
|
*out_finished = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
char *ReadNextImpl() {
|
||||||
|
/* Check that we have characters to read. */
|
||||||
|
if (m_position < 0 || m_buffer[0] == StringTraits::NullTerminator) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we have a replaced character, restore it. */
|
||||||
|
if (m_replaced_char != StringTraits::NullTerminator) {
|
||||||
|
m_buffer[m_position] = m_replaced_char;
|
||||||
|
if (m_replaced_char == StringTraits::DirectorySeparator) {
|
||||||
|
++m_position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we're at the start of a root-relative path, begin by returning the root. */
|
||||||
|
if (m_position == 0 && m_buffer[0] == StringTraits::DirectorySeparator) {
|
||||||
|
m_replaced_char = m_buffer[1];
|
||||||
|
m_buffer[1] = StringTraits::NullTerminator;
|
||||||
|
m_position = 1;
|
||||||
|
return m_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise, find the end of the next path component. */
|
||||||
|
s32 i;
|
||||||
|
for (i = m_position; m_buffer[i] != StringTraits::DirectorySeparator; ++i) {
|
||||||
|
if (m_buffer[i] == StringTraits::NullTerminator) {
|
||||||
|
if (i == m_position) {
|
||||||
|
m_position = -1;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sanity check that we're not ending on a separator. */
|
||||||
|
AMS_ASSERT(m_buffer[i + 1] != StringTraits::NullTerminator);
|
||||||
|
|
||||||
|
char * const ret = m_buffer + m_position;
|
||||||
|
|
||||||
|
m_replaced_char = StringTraits::DirectorySeparator;
|
||||||
|
m_buffer[i] = 0;
|
||||||
|
m_position = i;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
@@ -82,7 +82,7 @@ namespace ams::fs {
|
|||||||
public:
|
public:
|
||||||
constexpr FileStorageBasedFileSystem() : FileStorage(), m_base_file_system(nullptr) { /* ... */ }
|
constexpr FileStorageBasedFileSystem() : FileStorage(), m_base_file_system(nullptr) { /* ... */ }
|
||||||
|
|
||||||
Result Initialize(std::shared_ptr<fs::fsa::IFileSystem> base_file_system, const char *path, fs::OpenMode mode);
|
Result Initialize(std::shared_ptr<fs::fsa::IFileSystem> base_file_system, const fs::Path &path, fs::OpenMode mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileHandleStorage : public IStorage, public impl::Newable {
|
class FileHandleStorage : public IStorage, public impl::Newable {
|
||||||
|
|||||||
@@ -20,7 +20,13 @@ namespace ams::fs {
|
|||||||
|
|
||||||
constexpr inline size_t EntryNameLengthMax = 0x300;
|
constexpr inline size_t EntryNameLengthMax = 0x300;
|
||||||
|
|
||||||
using DirectoryEntry = ::FsDirectoryEntry;
|
struct DirectoryEntry {
|
||||||
|
char name[EntryNameLengthMax + 1];
|
||||||
|
char pad[3];
|
||||||
|
s8 type;
|
||||||
|
u8 pad2[3];
|
||||||
|
s64 file_size;
|
||||||
|
};
|
||||||
|
|
||||||
struct DirectoryHandle {
|
struct DirectoryHandle {
|
||||||
void *handle;
|
void *handle;
|
||||||
|
|||||||
@@ -24,7 +24,11 @@ namespace ams::fs {
|
|||||||
static const ReadOption None;
|
static const ReadOption None;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr const ReadOption ReadOption::None = {FsReadOption_None};
|
enum ReadOptionFlag : u32 {
|
||||||
|
ReadOptionFlag_None = (0 << 0),
|
||||||
|
};
|
||||||
|
|
||||||
|
inline constexpr const ReadOption ReadOption::None = {ReadOptionFlag_None};
|
||||||
|
|
||||||
inline constexpr bool operator==(const ReadOption &lhs, const ReadOption &rhs) {
|
inline constexpr bool operator==(const ReadOption &lhs, const ReadOption &rhs) {
|
||||||
return lhs._value == rhs._value;
|
return lhs._value == rhs._value;
|
||||||
@@ -36,19 +40,24 @@ namespace ams::fs {
|
|||||||
|
|
||||||
static_assert(util::is_pod<ReadOption>::value && sizeof(ReadOption) == sizeof(u32));
|
static_assert(util::is_pod<ReadOption>::value && sizeof(ReadOption) == sizeof(u32));
|
||||||
|
|
||||||
|
enum WriteOptionFlag : u32 {
|
||||||
|
WriteOptionFlag_None = (0 << 0),
|
||||||
|
WriteOptionFlag_Flush = (1 << 0),
|
||||||
|
};
|
||||||
|
|
||||||
struct WriteOption {
|
struct WriteOption {
|
||||||
u32 _value;
|
u32 _value;
|
||||||
|
|
||||||
constexpr inline bool HasFlushFlag() const {
|
constexpr inline bool HasFlushFlag() const {
|
||||||
return _value & FsWriteOption_Flush;
|
return _value & WriteOptionFlag_Flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const WriteOption None;
|
static const WriteOption None;
|
||||||
static const WriteOption Flush;
|
static const WriteOption Flush;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr const WriteOption WriteOption::None = {FsWriteOption_None};
|
inline constexpr const WriteOption WriteOption::None = {WriteOptionFlag_None};
|
||||||
inline constexpr const WriteOption WriteOption::Flush = {FsWriteOption_Flush};
|
inline constexpr const WriteOption WriteOption::Flush = {WriteOptionFlag_Flush};
|
||||||
|
|
||||||
inline constexpr bool operator==(const WriteOption &lhs, const WriteOption &rhs) {
|
inline constexpr bool operator==(const WriteOption &lhs, const WriteOption &rhs) {
|
||||||
return lhs._value == rhs._value;
|
return lhs._value == rhs._value;
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ namespace ams::fs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum OpenMode {
|
enum OpenMode {
|
||||||
OpenMode_Read = (1 << 0),
|
OpenMode_Read = (1 << 0),
|
||||||
OpenMode_Write = (1 << 1),
|
OpenMode_Write = (1 << 1),
|
||||||
OpenMode_AllowAppend = (1 << 2),
|
OpenMode_AllowAppend = (1 << 2),
|
||||||
|
|
||||||
OpenMode_ReadWrite = (OpenMode_Read | OpenMode_Write),
|
OpenMode_ReadWrite = (OpenMode_Read | OpenMode_Write),
|
||||||
@@ -34,23 +34,23 @@ namespace ams::fs {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum OpenDirectoryMode {
|
enum OpenDirectoryMode {
|
||||||
OpenDirectoryMode_Directory = ::FsDirOpenMode_ReadDirs,
|
OpenDirectoryMode_Directory = (1 << 0),
|
||||||
OpenDirectoryMode_File = ::FsDirOpenMode_ReadFiles,
|
OpenDirectoryMode_File = (1 << 1),
|
||||||
|
|
||||||
OpenDirectoryMode_All = (OpenDirectoryMode_Directory | OpenDirectoryMode_File),
|
OpenDirectoryMode_All = (OpenDirectoryMode_Directory | OpenDirectoryMode_File),
|
||||||
|
|
||||||
/* TODO: Separate enum, like N? */
|
/* TODO: Separate enum, like N? */
|
||||||
OpenDirectoryMode_NotRequireFileSize = ::FsDirOpenMode_NoFileSize,
|
OpenDirectoryMode_NotRequireFileSize = (1 << 31),
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DirectoryEntryType {
|
enum DirectoryEntryType {
|
||||||
DirectoryEntryType_Directory = ::FsDirEntryType_Dir,
|
DirectoryEntryType_Directory = 0,
|
||||||
DirectoryEntryType_File = ::FsDirEntryType_File,
|
DirectoryEntryType_File = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CreateOption {
|
enum CreateOption {
|
||||||
CreateOption_None = 0,
|
CreateOption_None = (0 << 0),
|
||||||
CreateOption_BigFile = ::FsCreateOption_BigFile,
|
CreateOption_BigFile = (1 << 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FileHandle;
|
struct FileHandle;
|
||||||
|
|||||||
@@ -16,10 +16,37 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stratosphere/fs/fs_common.hpp>
|
#include <stratosphere/fs/fs_common.hpp>
|
||||||
#include <stratosphere/fs/fs_filesystem.hpp>
|
#include <stratosphere/fs/fs_filesystem.hpp>
|
||||||
|
#include <stratosphere/time/time_posix_time.hpp>
|
||||||
|
|
||||||
namespace ams::fs {
|
namespace ams::fs {
|
||||||
|
|
||||||
using FileTimeStampRaw = ::FsTimeStampRaw;
|
struct FileTimeStamp {
|
||||||
|
time::PosixTime create;
|
||||||
|
time::PosixTime modify;
|
||||||
|
time::PosixTime access;
|
||||||
|
bool is_local_time;
|
||||||
|
char pad[7];
|
||||||
|
};
|
||||||
|
static_assert(util::is_pod<FileTimeStamp>::value && sizeof(FileTimeStamp) == 0x20);
|
||||||
|
|
||||||
|
struct FileTimeStampRaw {
|
||||||
|
s64 create;
|
||||||
|
s64 modify;
|
||||||
|
s64 access;
|
||||||
|
bool is_local_time;
|
||||||
|
char pad[7];
|
||||||
|
};
|
||||||
|
static_assert(util::is_pod<FileTimeStampRaw>::value && sizeof(FileTimeStampRaw) == 0x20);
|
||||||
|
|
||||||
|
static_assert(__builtin_offsetof(FileTimeStampRaw, create) == __builtin_offsetof(FileTimeStampRaw, create));
|
||||||
|
static_assert(__builtin_offsetof(FileTimeStampRaw, modify) == __builtin_offsetof(FileTimeStampRaw, modify));
|
||||||
|
static_assert(__builtin_offsetof(FileTimeStampRaw, access) == __builtin_offsetof(FileTimeStampRaw, access));
|
||||||
|
static_assert(__builtin_offsetof(FileTimeStampRaw, is_local_time) == __builtin_offsetof(FileTimeStampRaw, is_local_time));
|
||||||
|
static_assert(__builtin_offsetof(FileTimeStampRaw, pad) == __builtin_offsetof(FileTimeStampRaw, pad));
|
||||||
|
|
||||||
|
#if defined(ATMOSPHERE_OS_HORIZON)
|
||||||
|
static_assert(sizeof(FileTimeStampRaw) == sizeof(::FsTimeStampRaw));
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace impl {
|
namespace impl {
|
||||||
|
|
||||||
@@ -27,6 +54,6 @@ namespace ams::fs {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GetFileTimeStampRawForDebug(FileTimeStampRaw *out, const char *path);
|
Result GetFileTimeStamp(FileTimeStamp *out, const char *path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user