Merge 'build-refactor' attempt #1; get upstream changes

This commit is contained in:
Ash Logan 2019-04-23 18:37:05 +10:00
commit 28ffb89c02
67 changed files with 1037 additions and 488 deletions

4
.gitignore vendored
View File

@ -1,9 +1,13 @@
build/
release/
debug/
lib/
*.a
*.o
*.d
*.elf
*.rpx
*.bz2
docs/html/
.vs/
CMakeSettings.json

0
.gitmodules vendored
View File

View File

@ -5,15 +5,13 @@ matrix:
- os: linux
dist: xenial
sudo: required
env: DEPLOY_FILE=wut.7z
env: DEPLOY_FILE=wut-*.tar.bz2
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:cginternals/backports-ppa'
packages:
- p7zip-full
cache:
directories:
@ -34,26 +32,19 @@ install:
script:
- cd "$TRAVIS_BUILD_DIR"
# Build wut
- mkdir build && cd build
- cmake -DCMAKE_INSTALL_PREFIX=wut_install ../
- make -j4 install
- export WUT_ROOT=$PWD/wut_install
- cd ../
- make -j4
- sudo make install
# Build tests
- cd tests
- mkdir build && cd build
- cmake ../
- make -j4 VERBOSE=TRUE
- cd ../../
- echo Tests disabled for now
# - cd tests
# - mkdir build && cd build
# - cmake ../
# - make -j4 VERBOSE=TRUE
# - cd ../../
# Build samples
- cd samples
- mkdir build && cd build
- cmake -DCMAKE_INSTALL_PREFIX=$WUT_ROOT/samples ../
- make -j4 VERBOSE=TRUE install
- cd samples/make
- make -j4
- cd ../../
# Create deploy zips
- cd $WUT_ROOT
- 7z a $DEPLOY_FILE .
deploy:
provider: releases

15
CHANGELOG.md Normal file
View File

@ -0,0 +1,15 @@
#### wut 1.0.0-beta9
###### Breaking changes
- coreinit's `exit` is no longer defined in `<coreinit/exit.h>`. Please use `<stdlib.h>` instead, which pulls in newlib's exit.
- RPL import sections (`.fimport_coreinit` etc.) are now garbage-collected when using wut-tools 1.1.0 or above (required). Code relying on weak links to Cafe functions may exhibit different behaviour.
###### Deprecations
- `WUT_ROOT` should no longer be defined in the user's environment, and will be set to `$DEVKITPRO/wut` internally. CMake lists and makefiles that use `$WUT_ROOT/share` to find `wut.mk` or `wut.toolchain.cmake` should be changed to `$DEVKITPRO/wut/share`.
###### Other changes
- Builds refactored: wut now uses Makefiles to build itself, as well as providing a devkitPro-style `wut_rules` file - see the `samples/make` folder. The cmake samples are now in `samples/cmake`.
- A new linking feature, `__rplwrap`, was added to help deal with conflicts between newlib's and Cafe's functions. Because of this, wut 1.0.0-beta9 requires wut-tools 1.1.0 or newer.
- Using rplwrap, newlib's `exit` is now correctly chained with coreinit's - calls like `atexit` should work; whether calling `exit` or just returning from `main`. Applications using coreinit's `_Exit` are encouraged to migrate to a normal `exit` call.
#### wut 1.0.0-beta8

View File

@ -1,42 +0,0 @@
cmake_minimum_required(VERSION 3.2)
set(WUT_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(ENV{WUT_ROOT} "${WUT_ROOT}")
set(CMAKE_TOOLCHAIN_FILE "${WUT_ROOT}/share/wut.toolchain.cmake")
project(wut)
option(WUT_BUILD_DOCS "Build documentation" OFF)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "/opt/devkitpro/wut" CACHE PATH "default install path" FORCE )
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin")
if(WUT_BUILD_DOCS)
add_subdirectory(docs)
endif()
find_program(WUT_RPLIMPORTGEN NAMES rplimportgen PATHS "${DEVKITPRO}/tools/bin")
if(NOT WUT_RPLIMPORTGEN)
message(FATAL_ERROR "Could not find rplimportgen.")
endif()
add_subdirectory(cafe)
add_subdirectory(libraries)
install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
FILES_MATCHING PATTERN "*.h*")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/share/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/share")

164
Makefile Normal file
View File

@ -0,0 +1,164 @@
TOPDIR ?= $(CURDIR)
include $(TOPDIR)/share/wut_rules
export WUT_MAJOR := 1
export WUT_MINOR := 0
export WUT_PATCH := 0
VERSION := $(WUT_MAJOR).$(WUT_MINOR).$(WUT_PATCH)
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
TARGET := wut
#BUILD := build
SOURCES := cafe \
libraries/wutcrt \
libraries/wutnewlib \
libraries/wutstdc++ \
libraries/wutmalloc \
libraries/wutdevoptab \
libraries/libwhb/src \
libraries/libgfd/src \
libraries/nn_swkbd
DATA := data
INCLUDES := include \
libraries/libwhb/include \
libraries/libgfd/include \
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS := -g -Wall -Werror -save-temps \
-ffunction-sections -fdata-sections \
$(MACHDEP) \
$(BUILD_CFLAGS)
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
CXXFLAGS := $(CFLAGS) -std=gnu++17
ASFLAGS := -g $(MACHDEP)
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS :=
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
DEFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.def)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# 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 := $(DEFFILES:.def=.o) $(SFILES:.s=.o) $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I.
.PHONY: all dist-bin dist-src dist install clean
#---------------------------------------------------------------------------------
all: lib/libwut.a lib/libwutd.a
dist-bin: all
@tar --exclude=*~ -cjf wut-$(VERSION).tar.bz2 include lib share -C libraries/libwhb include -C ../libgfd include
dist-src:
@tar --exclude=*~ -cjf wut-src-$(VERSION).tar.bz2 cafe include libraries share Makefile
dist: dist-src dist-bin
install: dist-bin
mkdir -p $(DESTDIR)$(DEVKITPRO)/wut
bzip2 -cd wut-$(VERSION).tar.bz2 | tar -xf - -C $(DESTDIR)$(DEVKITPRO)/wut
lib:
@[ -d $@ ] || mkdir -p $@
release:
@[ -d $@ ] || mkdir -p $@
debug:
@[ -d $@ ] || mkdir -p $@
lib/libwut.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
lib/libwutd.a : lib debug $(SOURCES) $(INCLUDES)
@$(MAKE) BUILD=debug OUTPUT=$(CURDIR)/$@ \
BUILD_CFLAGS="-DDEBUG=1 -Og" \
DEPSDIR=$(CURDIR)/debug \
--no-print-directory -C debug \
-f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -rf release debug lib
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT) : $(OFILES)
$(OFILES_SRC) : $(HFILES)
#---------------------------------------------------------------------------------
%_bin.h %.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

View File

@ -1,87 +0,0 @@
cmake_minimum_required(VERSION 3.2)
# Load up the in-tree toolchain
set(WUT_ROOT "{CMAKE_CURRENT_SOURCE_DIR}/.." CACHE STRING "")
set(WUT_RPLIMPORTGEN "" CACHE STRING "")
set(ENV{WUT_ROOT} ${WUT_ROOT})
set(CMAKE_TOOLCHAIN_FILE $ENV{WUT_ROOT}/share/wut.toolchain.cmake)
project(cafe C CXX)
enable_language(ASM)
macro(add_cafe_library target)
add_custom_command(
OUTPUT ${target}.s
COMMAND ${WUT_RPLIMPORTGEN} ${CMAKE_CURRENT_SOURCE_DIR}/${target}.def ${target}.s
DEPENDS ${target}.def)
add_library(${target} STATIC ${target}.s)
install(TARGETS ${target} ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
endmacro()
add_cafe_library(avm)
add_cafe_library(camera)
add_cafe_library(coreinit)
add_cafe_library(dc)
add_cafe_library(dmae)
add_cafe_library(drmapp)
add_cafe_library(erreula)
add_cafe_library(gx2)
add_cafe_library(h264)
add_cafe_library(lzma920)
add_cafe_library(mic)
add_cafe_library(nfc)
add_cafe_library(nio_prof)
add_cafe_library(nlibcurl)
add_cafe_library(nlibnss)
add_cafe_library(nlibnss2)
add_cafe_library(nn_ac)
add_cafe_library(nn_acp)
add_cafe_library(nn_act)
add_cafe_library(nn_aoc)
add_cafe_library(nn_boss)
add_cafe_library(nn_ccr)
add_cafe_library(nn_cmpt)
add_cafe_library(nn_dlp)
add_cafe_library(nn_ec)
add_cafe_library(nn_fp)
add_cafe_library(nn_hai)
add_cafe_library(nn_hpad)
add_cafe_library(nn_idbe)
add_cafe_library(nn_ndm)
add_cafe_library(nn_nets2)
add_cafe_library(nn_nfp)
add_cafe_library(nn_nim)
add_cafe_library(nn_olv)
add_cafe_library(nn_pdm)
add_cafe_library(nn_save)
add_cafe_library(nn_sl)
add_cafe_library(nn_spm)
add_cafe_library(nn_temp)
add_cafe_library(nn_uds)
add_cafe_library(nn_vctl)
add_cafe_library(nsysccr)
add_cafe_library(nsyshid)
add_cafe_library(nsyskbd)
add_cafe_library(nsysnet)
add_cafe_library(nsysuhs)
add_cafe_library(nsysuvd)
add_cafe_library(ntag)
add_cafe_library(padscore)
add_cafe_library(proc_ui)
add_cafe_library(snd_core)
add_cafe_library(snd_user)
add_cafe_library(sndcore2)
add_cafe_library(snduser2)
add_cafe_library(swkbd)
add_cafe_library(sysapp)
add_cafe_library(tcl)
add_cafe_library(tve)
add_cafe_library(uac)
add_cafe_library(uac_rpl)
add_cafe_library(usb_mic)
add_cafe_library(uvc)
add_cafe_library(uvd)
add_cafe_library(vpad)
add_cafe_library(vpadbase)
add_cafe_library(zlib125)

View File

@ -1210,7 +1210,6 @@ bspQuery
bspRead
bspShutdown
bspWrite
exit
//memclr
//memcpy
//memmove
@ -1229,6 +1228,9 @@ smdSimpleBufFree
smdSimpleBufGetStatistics
smdSimpleBufPoolCreate
:TEXT_WRAP
exit
:DATA
MEMAllocFromDefaultHeap
MEMAllocFromDefaultHeapEx

View File

@ -12,7 +12,7 @@ extern "C" {
#endif
void
exit(int code);
RPLWRAP(exit)(int code);
void
_Exit(int code);

View File

@ -8,3 +8,4 @@
#include "wut_structsize.h"
#include "wut_types.h"
#include "wut_rplwrap.h"

3
include/wut_rplwrap.h Normal file
View File

@ -0,0 +1,3 @@
#pragma once
#define RPLWRAP(func) __rplwrap_##func

View File

@ -1,18 +0,0 @@
cmake_minimum_required(VERSION 3.2)
# Load up the in-tree toolchain
set(WUT_ROOT "{CMAKE_CURRENT_SOURCE_DIR}/.." CACHE STRING "")
set(ENV{WUT_ROOT} ${WUT_ROOT})
set(CMAKE_TOOLCHAIN_FILE $ENV{WUT_ROOT}/share/wut.toolchain.cmake)
project(libraries C)
add_definitions(-Wall -Werror)
add_subdirectory(libgfd)
add_subdirectory(libwhb)
add_subdirectory(nn_swkbd)
add_subdirectory(wutcrt)
add_subdirectory(wutdevoptab)
add_subdirectory(wutmalloc)
add_subdirectory(wutnewlib)
add_subdirectory(wutstdc++)

View File

@ -1,15 +0,0 @@
cmake_minimum_required(VERSION 3.2)
project(libgfd)
add_library(gfd STATIC
src/gfd.c
include/gfd.h)
target_include_directories(gfd PRIVATE "../../include")
target_include_directories(gfd PUBLIC "include")
install(TARGETS gfd
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
FILES_MATCHING PATTERN "*.h*")

View File

@ -1,42 +0,0 @@
cmake_minimum_required(VERSION 3.2)
project(libwhb)
add_library(whb STATIC
src/commandserver.c
src/console.c
src/crash.c
src/file.c
src/gfx.c
src/gfx_heap.c
src/gfx_heap.h
src/gfx_shader.c
src/gfx_texture.c
src/libmanager.c
src/log.c
src/log_cafe.c
src/log_udp.c
src/proc.c
src/sdcard.c
include/whb/align.h
include/whb/commandserver.h
include/whb/crash.h
include/whb/file.h
include/whb/gfx.h
include/whb/libmanager.h
include/whb/log_cafe.h
include/whb/log_console.h
include/whb/log.h
include/whb/log_udp.h
include/whb/proc.h
include/whb/sdcard.h)
target_include_directories(whb PRIVATE "../../include")
target_include_directories(whb PRIVATE "../libgfd/include")
target_include_directories(whb PUBLIC "include")
install(TARGETS whb
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
FILES_MATCHING PATTERN "*.h*")

View File

@ -1,14 +0,0 @@
cmake_minimum_required(VERSION 3.2)
project(nn_swkbd CXX)
add_library(nn_swkbd
nn_swkbd.cpp)
target_include_directories(nn_swkbd
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${WUT_ROOT}/include")
install(TARGETS nn_swkbd
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
FILES_MATCHING PATTERN "*.h*")

View File

@ -1,16 +0,0 @@
cmake_minimum_required(VERSION 3.2)
project(wutcrt C ASM)
add_library(wutcrt
crt0_rpx.s
wut_crt.c)
add_library(wutcrtrpl
crt0_rpl.s
wut_crt.c)
target_include_directories(wutcrt PRIVATE "${WUT_ROOT}/include")
target_include_directories(wutcrtrpl PRIVATE "${WUT_ROOT}/include")
install(TARGETS wutcrt wutcrtrpl
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")

View File

@ -3,8 +3,8 @@
.extern __init_wut
.extern __fini_wut
.global _start
_start:
.global __rpl_start
__rpl_start:
stwu 1, -0x14(1)
mflr 0
stw 0, 0x18(1)

View File

@ -3,8 +3,8 @@
.extern __init_wut
.extern __fini_wut
.global _start
_start:
.global __rpx_start
__rpx_start:
stwu 1, -0x14(1)
mflr 0
stw 0, 0x18(1)

View File

@ -1,48 +1,31 @@
extern void __init_wut_newlib() __attribute__((weak));
extern void __init_wut_devoptab() __attribute__((weak));
void __init_wut_malloc();
void __init_wut_newlib();
extern void __init_wut_stdcpp() __attribute__((weak));
void __init_wut_devoptab();
extern void __fini_wut_devoptab() __attribute__((weak));
extern void __fini_wut_newlib() __attribute__((weak));
void __fini_wut_malloc();
void __fini_wut_newlib();
extern void __fini_wut_stdcpp() __attribute__((weak));
void __fini_wut_devoptab();
void
void __attribute__((weak))
__init_wut()
{
if (__init_wut_newlib) {
__init_wut_newlib();
}
if (__init_wut_devoptab) {
__init_wut_devoptab();
}
__init_wut_malloc();
__init_wut_newlib();
if (__init_wut_stdcpp) {
__init_wut_stdcpp();
}
__init_wut_devoptab();
}
void
void __attribute__((weak))
__fini_wut()
{
__fini_wut_devoptab();
if (__fini_wut_stdcpp) {
__fini_wut_stdcpp();
}
if (__fini_wut_devoptab) {
__fini_wut_devoptab();
}
if (__fini_wut_newlib) {
__fini_wut_newlib();
}
}
// Forward newlib _exit to the coreinit.rpl _Exit
extern void _Exit(int status);
void
_exit(int status)
{
_Exit(status);
__fini_wut_newlib();
__fini_wut_malloc();
}

View File

@ -1,34 +0,0 @@
cmake_minimum_required(VERSION 3.2)
project(wutdevoptab C)
add_library(wutdevoptab
devoptab_fs.c
devoptab_fs_chdir.c
devoptab_fs_chmod.c
devoptab_fs_close.c
devoptab_fs_dirclose.c
devoptab_fs_dirnext.c
devoptab_fs_diropen.c
devoptab_fs_dirreset.c
devoptab_fs_fchmod.c
devoptab_fs_fstat.c
devoptab_fs_fsync.c
devoptab_fs_getmtime.c
devoptab_fs_link.c
devoptab_fs_mkdir.c
devoptab_fs_open.c
devoptab_fs_read.c
devoptab_fs_rename.c
devoptab_fs_rmdir.c
devoptab_fs_seek.c
devoptab_fs_stat.c
devoptab_fs_statvfs.c
devoptab_fs_truncate.c
devoptab_fs_unlink.c
devoptab_fs_utils.c
devoptab_fs_write.c)
target_include_directories(wutdevoptab PRIVATE "${WUT_ROOT}/include")
install(TARGETS wutdevoptab
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")

View File

@ -6,7 +6,7 @@ __wut_fs_read(struct _reent *r,
char *ptr,
size_t len)
{
FSStatus status;
FSStatus status = 0;
FSCmdBlock cmd;
uint8_t *alignedReadBuffer;
uint32_t bytes, bytesRead;

View File

@ -6,7 +6,7 @@ __wut_fs_write(struct _reent *r,
const char *ptr,
size_t len)
{
FSStatus status;
FSStatus status = 0;
FSCmdBlock cmd;
uint8_t *alignedWriteBuffer;
uint32_t bytes, bytesWritten;

View File

@ -1,9 +0,0 @@
cmake_minimum_required(VERSION 3.2)
project(wutmalloc C)
add_library(wutmalloc
wut_malloc.c)
target_include_directories(wutmalloc PRIVATE "${WUT_ROOT}/include")
install(TARGETS wutmalloc
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")

View File

@ -3,41 +3,64 @@
#include <coreinit/memorymap.h>
#include <malloc.h>
#include <string.h>
#include <errno.h>
// Limit sbrk heap to 128kb
uint32_t __attribute__((weak)) __wut_heap_max_size = 128 * 1024;
uint32_t __wut_heap_max_size = 128 * 1024;
void
__init_wut_malloc(void)
{
}
void
__fini_wut_malloc(void)
{
}
void *
_malloc_r(struct _reent *r, size_t size)
{
return MEMAllocFromDefaultHeap(size);
void *ptr = MEMAllocFromDefaultHeap(size);
if (!ptr) {
r->_errno = ENOMEM;
}
return ptr;
}
void
_free_r(struct _reent *r, void *ptr)
{
MEMFreeToDefaultHeap(ptr);
if (ptr) {
MEMFreeToDefaultHeap(ptr);
}
}
void *
_realloc_r(struct _reent *r, void *ptr, size_t size)
{
void *new_ptr = _malloc_r(r, size);
if (!ptr || !new_ptr) {
void *new_ptr = MEMAllocFromDefaultHeap(size);
if (!new_ptr) {
r->_errno = ENOMEM;
return new_ptr;
}
memcpy(new_ptr, ptr, MEMGetSizeForMBlockExpHeap(ptr));
_free_r(r, ptr);
if (ptr) {
size_t old_size = MEMGetSizeForMBlockExpHeap(ptr);
memcpy(new_ptr, ptr, old_size <= size ? old_size : size);
MEMFreeToDefaultHeap(ptr);
}
return new_ptr;
}
void *
_calloc_r(struct _reent *r, size_t num, size_t size)
{
void *ptr = _malloc_r(r, num * size);
void *ptr = MEMAllocFromDefaultHeap(num * size);
if (ptr) {
memset(ptr, 0, num * size);
} else {
r->_errno = ENOMEM;
}
return ptr;
@ -75,13 +98,13 @@ _malloc_usable_size_r(struct _reent *r, void *ptr)
void *
_valloc_r(struct _reent *r, size_t size)
{
return _memalign_r(r, OS_PAGE_SIZE, size);
return MEMAllocFromDefaultHeapEx(size, OS_PAGE_SIZE);
}
void *
_pvalloc_r(struct _reent *r, size_t size)
{
return _memalign_r(r, OS_PAGE_SIZE, (size + (OS_PAGE_SIZE - 1)) & ~(OS_PAGE_SIZE - 1));
return MEMAllocFromDefaultHeapEx((size + (OS_PAGE_SIZE - 1)) & ~(OS_PAGE_SIZE - 1), OS_PAGE_SIZE);
}
int

View File

@ -1,15 +0,0 @@
cmake_minimum_required(VERSION 3.2)
project(wutnewlib C)
add_library(wutnewlib
wut_clock.c
wut_gettod_r.c
wut_lock.c
wut_malloc_lock.c
wut_nanosleep.c
wut_newlib.c
wut_sbrk.c)
target_include_directories(wutnewlib PRIVATE "${WUT_ROOT}/include")
install(TARGETS wutnewlib
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")

View File

@ -4,14 +4,15 @@
static void
__init_wut_syscall_array()
{
__syscalls.sbrk_r = __wut_sbrk_r;
//__syscalls.sbrk_r = __wut_sbrk_r;
__syscalls.lock_init = __wut_lock_init;
__syscalls.lock_close = __wut_lock_close;
__syscalls.lock_acquire = __wut_lock_acquire;
__syscalls.lock_release = __wut_lock_release;
__syscalls.malloc_lock = __wut_malloc_lock;
__syscalls.malloc_unlock = __wut_malloc_unlock;
__syscalls.exit = exit;
//__syscalls.malloc_lock = __wut_malloc_lock;
//__syscalls.malloc_unlock = __wut_malloc_unlock;
//use coreinit's exit function
__syscalls.exit = RPLWRAP(exit);
__syscalls.gettod_r = __wut_gettod_r;
__syscalls.clock_gettime = __wut_clock_gettime;
__syscalls.clock_settime = __wut_clock_settime;
@ -22,13 +23,13 @@ __init_wut_syscall_array()
void
__init_wut_newlib()
{
__init_wut_sbrk_heap();
__init_wut_malloc_lock();
//__init_wut_sbrk_heap();
//__init_wut_malloc_lock();
__init_wut_syscall_array();
}
void
__fini_wut_newlib()
{
__fini_wut_sbrk_heap();
//__fini_wut_sbrk_heap();
}

View File

@ -1,24 +0,0 @@
cmake_minimum_required(VERSION 3.2)
project(wutstdc++ CXX)
add_library(wutstdc++
wut_gthread.cc
wut_gthread_cond.cc
wut_gthread_keys.cc
wut_gthread_mutex.cc
wut_gthread_once.cc
wut_gthread_recursive_mutex.cc
wut_gthread_thread.cc
wut_stdcpp.cc)
target_compile_definitions(wutstdc++
PRIVATE _GLIBCXX_HAS_GTHREADS)
target_include_directories(wutstdc++
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include" "${WUT_ROOT}/include")
install(TARGETS wutstdc++
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
FILES_MATCHING PATTERN "*.h*")

View File

@ -1,12 +0,0 @@
#include "wut_gthread.h"
extern "C" void
__init_wut_stdcpp()
{
__init_wut_gthread();
}
extern "C" void
__fini_wut_stdcpp()
{
}

View File

@ -0,0 +1,23 @@
#include "wut_gthread.h"
__asm__ (
"\t.section\t.text.__wrap___gxx_personality_v0,\"ax\",@progbits\n"
"\t.align\t2\n"
"\t.globl\t__wrap___gxx_personality_v0\n"
"\t.type\t__wrap___gxx_personality_v0, @function\n"
"__wrap___gxx_personality_v0:\n"
"\t.cfi_startproc\n"
"\tb\t__real___gxx_personality_v0\n"
"\t.cfi_endproc"
);
extern "C" void
__init_wut_stdcpp()
{
__init_wut_gthread();
}
extern "C" void
__fini_wut_stdcpp()
{
}

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.2)
set(CMAKE_TOOLCHAIN_FILE $ENV{WUT_ROOT}/share/wut.toolchain.cmake)
set(CMAKE_TOOLCHAIN_FILE $ENV{DEVKITPRO}/wut/share/wut.toolchain.cmake)
project(samples)
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED)
add_subdirectory(curl)
add_subdirectory(custom_default_heap)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2)
project(curl C)
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED)
add_executable(curl
main.c)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2)
project(custom_default_heap C)
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED)
add_executable(custom_default_heap
main.c)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2)
project(gx2_triangle C)
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED)
add_executable(gx2_triangle
main.c)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2)
project(helloworld C)
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED)
add_executable(helloworld
main.c)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2)
project(helloworld_cpp CXX)
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED)
add_executable(helloworld_cpp
main.cpp)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2)
project(my_first_rpl C)
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED)
add_executable(my_first_rpl
my_first_rpl.c)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2)
project(swkbd CXX)
include("${WUT_ROOT}/share/wut.cmake" REQUIRED)
include("${DEVKITPRO}/wut/share/wut.cmake" REQUIRED)
add_executable(swkbd
main.cpp)

9
samples/make/Makefile Normal file
View File

@ -0,0 +1,9 @@
MAKEFILES := $(shell find . -mindepth 2 -name Makefile)
DATESTRING := $(shell date +%Y)$(shell date +%m)$(shell date +%d)
all:
@for i in $(MAKEFILES); do $(MAKE) -C `dirname $$i` || exit 1; done;
clean:
@for i in $(MAKEFILES); do $(MAKE) -C `dirname $$i` clean || exit 1; done;

View File

@ -0,0 +1,135 @@
#-------------------------------------------------------------------------------
.SUFFIXES:
#-------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/wut/share/wut_rules
#-------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#-------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
#-------------------------------------------------------------------------------
# options for code generation
#-------------------------------------------------------------------------------
CFLAGS := -g -Wall -O2 -ffunction-sections \
$(MACHDEP)
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
CXXFLAGS := $(CFLAGS)
ASFLAGS := -g $(ARCH)
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map)
LIBS := -lwut
#-------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level
# containing include and lib
#-------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(WUT_ROOT)
#-------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#-------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#-------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#-------------------------------------------------------------------------------
# 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 .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
.PHONY: $(BUILD) clean all
#-------------------------------------------------------------------------------
all: $(BUILD)
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#-------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).rpx $(TARGET).elf
#-------------------------------------------------------------------------------
else
.PHONY: all
DEPENDS := $(OFILES:.o=.d)
#-------------------------------------------------------------------------------
# main targets
#-------------------------------------------------------------------------------
all : $(OUTPUT).rpx
$(OUTPUT).rpx : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
$(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
#-------------------------------------------------------------------------------

View File

@ -0,0 +1,39 @@
#include <coreinit/thread.h>
#include <coreinit/time.h>
#include <whb/proc.h>
#include <whb/log.h>
#include <whb/log_console.h>
int
main(int argc, char **argv)
{
int last_tm_sec = -1;
OSCalendarTime tm;
WHBProcInit();
WHBLogConsoleInit();
WHBLogPrintf("Hello World!");
while(WHBProcIsRunning()) {
OSTicksToCalendarTime(OSGetTime(), &tm);
if (tm.tm_sec != last_tm_sec) {
WHBLogPrintf("%02d/%02d/%04d %02d:%02d:%02d I'm still here.",
tm.tm_mday, tm.tm_mon, tm.tm_year,
tm.tm_hour, tm.tm_min, tm.tm_sec);
last_tm_sec = tm.tm_sec;
}
WHBLogConsoleDraw();
OSSleepTicks(OSMillisecondsToTicks(100));
}
WHBLogPrintf("Exiting... good bye.");
WHBLogConsoleDraw();
OSSleepTicks(OSMillisecondsToTicks(1000));
WHBLogConsoleFree();
WHBProcShutdown();
return 0;
}

View File

@ -0,0 +1,135 @@
#-------------------------------------------------------------------------------
.SUFFIXES:
#-------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/wut/share/wut_rules
#-------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#-------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
#-------------------------------------------------------------------------------
# options for code generation
#-------------------------------------------------------------------------------
CFLAGS := -g -Wall -O2 -ffunction-sections \
$(MACHDEP)
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
CXXFLAGS := $(CFLAGS)
ASFLAGS := -g $(ARCH)
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map)
LIBS := -lwut
#-------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level
# containing include and lib
#-------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(WUT_ROOT)
#-------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#-------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#-------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#-------------------------------------------------------------------------------
# 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 .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
.PHONY: $(BUILD) clean all
#-------------------------------------------------------------------------------
all: $(BUILD)
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#-------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).rpx $(TARGET).elf
#-------------------------------------------------------------------------------
else
.PHONY: all
DEPENDS := $(OFILES:.o=.d)
#-------------------------------------------------------------------------------
# main targets
#-------------------------------------------------------------------------------
all : $(OUTPUT).rpx
$(OUTPUT).rpx : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
$(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
#-------------------------------------------------------------------------------

View File

@ -0,0 +1,70 @@
#include <coreinit/thread.h>
#include <coreinit/time.h>
#include <coreinit/systeminfo.h>
#include <nn/ac.h>
#include <whb/proc.h>
#include <whb/log.h>
#include <whb/log_console.h>
#include <thread>
int
hello_thread()
{
int last_tm_sec = -1;
uint32_t ip = 0;
WHBLogPrintf("Hello World from a std::thread!");
if (!nn::ac::GetAssignedAddress(&ip)) {
WHBLogPrintf("GetAssignedAddress failed!");
}
WHBLogPrintf("My IP is: %u.%u.%u.%u",
(ip >> 24) & 0xFF,
(ip >> 16) & 0xFF,
(ip >> 8) & 0xFF,
(ip >> 0) & 0xFF);
while(WHBProcIsRunning()) {
OSCalendarTime tm;
OSTicksToCalendarTime(OSGetTime(), &tm);
if (tm.tm_sec != last_tm_sec) {
WHBLogPrintf("%02d/%02d/%04d %02d:%02d:%02d I'm still here.",
tm.tm_mday, tm.tm_mon, tm.tm_year,
tm.tm_hour, tm.tm_min, tm.tm_sec);
last_tm_sec = tm.tm_sec;
}
WHBLogConsoleDraw();
OSSleepTicks(OSMillisecondsToTicks(100));
}
WHBLogPrintf("Exiting... good bye.");
WHBLogConsoleDraw();
OSSleepTicks(OSMillisecondsToTicks(1000));
return 0;
}
int
main(int argc, char **argv)
{
nn::ac::ConfigIdNum configId;
nn::ac::Initialize();
nn::ac::GetStartupId(&configId);
nn::ac::Connect(configId);
WHBProcInit();
WHBLogConsoleInit();
std::thread t(hello_thread);
t.join();
WHBLogConsoleFree();
WHBProcShutdown();
nn::ac::Finalize();
return 0;
}

2
share/rpl.specs Normal file
View File

@ -0,0 +1,2 @@
*wut_entry:
--entry=__rpl_start

2
share/rpx.specs Normal file
View File

@ -0,0 +1,2 @@
*wut_entry:
--entry=__rpx_start

View File

@ -143,83 +143,302 @@ SECTIONS
} > relmem
. = ORIGIN(loadmem);
.fexports ALIGN(32) : { *(.fexports) } > loadmem
.dexports ALIGN(32) : { *(.dexports) } > loadmem
.fexports ALIGN(32) : { KEEP( *(.fexports) ) } > loadmem
.dexports ALIGN(32) : { KEEP( *(.dexports) ) } > loadmem
.fimport_avm ALIGN(16) : { *(.fimport_avm) } > loadmem
.fimport_camera ALIGN(16) : { *(.fimport_camera) } > loadmem
.fimport_coreinit ALIGN(16) : { *(.fimport_coreinit) } > loadmem
.fimport_dc ALIGN(16) : { *(.fimport_dc) } > loadmem
.fimport_dmae ALIGN(16) : { *(.fimport_dmae) } > loadmem
.fimport_drmapp ALIGN(16) : { *(.fimport_drmapp) } > loadmem
.fimport_erreula ALIGN(16) : { *(.fimport_erreula) } > loadmem
.fimport_gx2 ALIGN(16) : { *(.fimport_gx2) } > loadmem
.fimport_h264 ALIGN(16) : { *(.fimport_h264) } > loadmem
.fimport_lzma920 ALIGN(16) : { *(.fimport_lzma920) } > loadmem
.fimport_mic ALIGN(16) : { *(.fimport_mic) } > loadmem
.fimport_nfc ALIGN(16) : { *(.fimport_nfc) } > loadmem
.fimport_nio_prof ALIGN(16) : { *(.fimport_nio_prof) } > loadmem
.fimport_nlibcurl ALIGN(16) : { *(.fimport_nlibcurl) } > loadmem
.fimport_nlibnss2 ALIGN(16) : { *(.fimport_nlibnss2) } > loadmem
.fimport_nlibnss ALIGN(16) : { *(.fimport_nlibnss) } > loadmem
.fimport_nn_ac ALIGN(16) : { *(.fimport_nn_ac) } > loadmem
.fimport_nn_acp ALIGN(16) : { *(.fimport_nn_acp) } > loadmem
.fimport_nn_act ALIGN(16) : { *(.fimport_nn_act) } > loadmem
.fimport_nn_aoc ALIGN(16) : { *(.fimport_nn_aoc) } > loadmem
.fimport_nn_boss ALIGN(16) : { *(.fimport_nn_boss) } > loadmem
.fimport_nn_ccr ALIGN(16) : { *(.fimport_nn_ccr) } > loadmem
.fimport_nn_cmpt ALIGN(16) : { *(.fimport_nn_cmpt) } > loadmem
.fimport_nn_dlp ALIGN(16) : { *(.fimport_nn_dlp) } > loadmem
.fimport_nn_ec ALIGN(16) : { *(.fimport_nn_ec) } > loadmem
.fimport_nn_fp ALIGN(16) : { *(.fimport_nn_fp) } > loadmem
.fimport_nn_hai ALIGN(16) : { *(.fimport_nn_hai) } > loadmem
.fimport_nn_hpad ALIGN(16) : { *(.fimport_nn_hpad) } > loadmem
.fimport_nn_idbe ALIGN(16) : { *(.fimport_nn_idbe) } > loadmem
.fimport_nn_ndm ALIGN(16) : { *(.fimport_nn_ndm) } > loadmem
.fimport_nn_nets2 ALIGN(16) : { *(.fimport_nn_nets2) } > loadmem
.fimport_nn_nfp ALIGN(16) : { *(.fimport_nn_nfp) } > loadmem
.fimport_nn_nim ALIGN(16) : { *(.fimport_nn_nim) } > loadmem
.fimport_nn_olv ALIGN(16) : { *(.fimport_nn_olv) } > loadmem
.fimport_nn_pdm ALIGN(16) : { *(.fimport_nn_pdm) } > loadmem
.fimport_nn_save ALIGN(16) : { *(.fimport_nn_save) } > loadmem
.fimport_nn_sl ALIGN(16) : { *(.fimport_nn_sl) } > loadmem
.fimport_nn_spm ALIGN(16) : { *(.fimport_nn_spm) } > loadmem
.fimport_nn_temp ALIGN(16) : { *(.fimport_nn_temp) } > loadmem
.fimport_nn_uds ALIGN(16) : { *(.fimport_nn_uds) } > loadmem
.fimport_nn_vctl ALIGN(16) : { *(.fimport_nn_vctl) } > loadmem
.fimport_nsysccr ALIGN(16) : { *(.fimport_nsysccr) } > loadmem
.fimport_nsyshid ALIGN(16) : { *(.fimport_nsyshid) } > loadmem
.fimport_nsyskbd ALIGN(16) : { *(.fimport_nsyskbd) } > loadmem
.fimport_nsysnet ALIGN(16) : { *(.fimport_nsysnet) } > loadmem
.fimport_nsysuhs ALIGN(16) : { *(.fimport_nsysuhs) } > loadmem
.fimport_nsysuvd ALIGN(16) : { *(.fimport_nsysuvd) } > loadmem
.fimport_ntag ALIGN(16) : { *(.fimport_ntag) } > loadmem
.fimport_padscore ALIGN(16) : { *(.fimport_padscore) } > loadmem
.fimport_proc_ui ALIGN(16) : { *(.fimport_proc_ui) } > loadmem
.fimport_sndcore2 ALIGN(16) : { *(.fimport_sndcore2) } > loadmem
.fimport_snd_core ALIGN(16) : { *(.fimport_snd_core) } > loadmem
.fimport_snduser2 ALIGN(16) : { *(.fimport_snduser2) } > loadmem
.fimport_snd_user ALIGN(16) : { *(.fimport_snd_user) } > loadmem
.fimport_swkbd ALIGN(16) : { *(.fimport_swkbd) } > loadmem
.fimport_sysapp ALIGN(16) : { *(.fimport_sysapp) } > loadmem
.fimport_tcl ALIGN(16) : { *(.fimport_tcl) } > loadmem
.fimport_tve ALIGN(16) : { *(.fimport_tve) } > loadmem
.fimport_uac ALIGN(16) : { *(.fimport_uac) } > loadmem
.fimport_uac_rpl ALIGN(16) : { *(.fimport_uac_rpl) } > loadmem
.fimport_usb_mic ALIGN(16) : { *(.fimport_usb_mic) } > loadmem
.fimport_uvc ALIGN(16) : { *(.fimport_uvc) } > loadmem
.fimport_uvd ALIGN(16) : { *(.fimport_uvd) } > loadmem
.fimport_vpadbase ALIGN(16) : { *(.fimport_vpadbase) } > loadmem
.fimport_vpad ALIGN(16) : { *(.fimport_vpad) } > loadmem
.fimport_zlib125 ALIGN(16) : { *(.fimport_zlib125) } > loadmem
.fimport_avm ALIGN(16) : {
KEEP ( *(.fimport_avm) )
*(.fimport_avm.*)
} > loadmem
.fimport_camera ALIGN(16) : {
KEEP ( *(.fimport_camera) )
*(.fimport_camera.*)
} > loadmem
.fimport_coreinit ALIGN(16) : {
KEEP ( *(.fimport_coreinit) )
*(.fimport_coreinit.*)
} > loadmem
.fimport_dc ALIGN(16) : {
KEEP ( *(.fimport_dc) )
*(.fimport_dc.*)
} > loadmem
.fimport_dmae ALIGN(16) : {
KEEP ( *(.fimport_dmae) )
*(.fimport_dmae.*)
} > loadmem
.fimport_drmapp ALIGN(16) : {
KEEP ( *(.fimport_drmapp) )
*(.fimport_drmapp.*)
} > loadmem
.fimport_erreula ALIGN(16) : {
KEEP ( *(.fimport_erreula) )
*(.fimport_erreula.*)
} > loadmem
.fimport_gx2 ALIGN(16) : {
KEEP ( *(.fimport_gx2) )
*(.fimport_gx2.*)
} > loadmem
.fimport_h264 ALIGN(16) : {
KEEP ( *(.fimport_h264) )
*(.fimport_h264.*)
} > loadmem
.fimport_lzma920 ALIGN(16) : {
KEEP ( *(.fimport_lzma920) )
*(.fimport_lzma920.*)
} > loadmem
.fimport_mic ALIGN(16) : {
KEEP ( *(.fimport_mic) )
*(.fimport_mic.*)
} > loadmem
.fimport_nfc ALIGN(16) : {
KEEP ( *(.fimport_nfc) )
*(.fimport_nfc.*)
} > loadmem
.fimport_nio_prof ALIGN(16) : {
KEEP ( *(.fimport_nio_prof) )
*(.fimport_nio_prof.*)
} > loadmem
.fimport_nlibcurl ALIGN(16) : {
KEEP ( *(.fimport_nlibcurl) )
*(.fimport_nlibcurl.*)
} > loadmem
.fimport_nlibnss2 ALIGN(16) : {
KEEP ( *(.fimport_nlibnss2) )
*(.fimport_nlibnss2.*)
} > loadmem
.fimport_nlibnss ALIGN(16) : {
KEEP ( *(.fimport_nlibnss) )
*(.fimport_nlibnss.*)
} > loadmem
.fimport_nn_ac ALIGN(16) : {
KEEP ( *(.fimport_nn_ac) )
*(.fimport_nn_ac.*)
} > loadmem
.fimport_nn_acp ALIGN(16) : {
KEEP ( *(.fimport_nn_acp) )
*(.fimport_nn_acp.*)
} > loadmem
.fimport_nn_act ALIGN(16) : {
KEEP ( *(.fimport_nn_act) )
*(.fimport_nn_act.*)
} > loadmem
.fimport_nn_aoc ALIGN(16) : {
KEEP ( *(.fimport_nn_aoc) )
*(.fimport_nn_aoc.*)
} > loadmem
.fimport_nn_boss ALIGN(16) : {
KEEP ( *(.fimport_nn_boss) )
*(.fimport_nn_boss.*)
} > loadmem
.fimport_nn_ccr ALIGN(16) : {
KEEP ( *(.fimport_nn_ccr) )
*(.fimport_nn_ccr.*)
} > loadmem
.fimport_nn_cmpt ALIGN(16) : {
KEEP ( *(.fimport_nn_cmpt) )
*(.fimport_nn_cmpt.*)
} > loadmem
.fimport_nn_dlp ALIGN(16) : {
KEEP ( *(.fimport_nn_dlp) )
*(.fimport_nn_dlp.*)
} > loadmem
.fimport_nn_ec ALIGN(16) : {
KEEP ( *(.fimport_nn_ec) )
*(.fimport_nn_ec.*)
} > loadmem
.fimport_nn_fp ALIGN(16) : {
KEEP ( *(.fimport_nn_fp) )
*(.fimport_nn_fp.*)
} > loadmem
.fimport_nn_hai ALIGN(16) : {
KEEP ( *(.fimport_nn_hai) )
*(.fimport_nn_hai.*)
} > loadmem
.fimport_nn_hpad ALIGN(16) : {
KEEP ( *(.fimport_nn_hpad) )
*(.fimport_nn_hpad.*)
} > loadmem
.fimport_nn_idbe ALIGN(16) : {
KEEP ( *(.fimport_nn_idbe) )
*(.fimport_nn_idbe.*)
} > loadmem
.fimport_nn_ndm ALIGN(16) : {
KEEP ( *(.fimport_nn_ndm) )
*(.fimport_nn_ndm.*)
} > loadmem
.fimport_nn_nets2 ALIGN(16) : {
KEEP ( *(.fimport_nn_nets2) )
*(.fimport_nn_nets2.*)
} > loadmem
.fimport_nn_nfp ALIGN(16) : {
KEEP ( *(.fimport_nn_nfp) )
*(.fimport_nn_nfp.*)
} > loadmem
.fimport_nn_nim ALIGN(16) : {
KEEP ( *(.fimport_nn_nim) )
*(.fimport_nn_nim.*)
} > loadmem
.fimport_nn_olv ALIGN(16) : {
KEEP ( *(.fimport_nn_olv) )
*(.fimport_nn_olv.*)
} > loadmem
.fimport_nn_pdm ALIGN(16) : {
KEEP ( *(.fimport_nn_pdm) )
*(.fimport_nn_pdm.*)
} > loadmem
.fimport_nn_save ALIGN(16) : {
KEEP ( *(.fimport_nn_save) )
*(.fimport_nn_save.*)
} > loadmem
.fimport_nn_sl ALIGN(16) : {
KEEP ( *(.fimport_nn_sl) )
*(.fimport_nn_sl.*)
} > loadmem
.fimport_nn_spm ALIGN(16) : {
KEEP ( *(.fimport_nn_spm) )
*(.fimport_nn_spm.*)
} > loadmem
.fimport_nn_temp ALIGN(16) : {
KEEP ( *(.fimport_nn_temp) )
*(.fimport_nn_temp.*)
} > loadmem
.fimport_nn_uds ALIGN(16) : {
KEEP ( *(.fimport_nn_uds) )
*(.fimport_nn_uds.*)
} > loadmem
.fimport_nn_vctl ALIGN(16) : {
KEEP ( *(.fimport_nn_vctl) )
*(.fimport_nn_vctl.*)
} > loadmem
.fimport_nsysccr ALIGN(16) : {
KEEP ( *(.fimport_nsysccr) )
*(.fimport_nsysccr.*)
} > loadmem
.fimport_nsyshid ALIGN(16) : {
KEEP ( *(.fimport_nsyshid) )
*(.fimport_nsyshid.*)
} > loadmem
.fimport_nsyskbd ALIGN(16) : {
KEEP ( *(.fimport_nsyskbd) )
*(.fimport_nsyskbd.*)
} > loadmem
.fimport_nsysnet ALIGN(16) : {
KEEP ( *(.fimport_nsysnet) )
*(.fimport_nsysnet.*)
} > loadmem
.fimport_nsysuhs ALIGN(16) : {
KEEP ( *(.fimport_nsysuhs) )
*(.fimport_nsysuhs.*)
} > loadmem
.fimport_nsysuvd ALIGN(16) : {
KEEP ( *(.fimport_nsysuvd) )
*(.fimport_nsysuvd.*)
} > loadmem
.fimport_ntag ALIGN(16) : {
KEEP ( *(.fimport_ntag) )
*(.fimport_ntag.*)
} > loadmem
.fimport_padscore ALIGN(16) : {
KEEP ( *(.fimport_padscore) )
*(.fimport_padscore.*)
} > loadmem
.fimport_proc_ui ALIGN(16) : {
KEEP ( *(.fimport_proc_ui) )
*(.fimport_proc_ui.*)
} > loadmem
.fimport_sndcore2 ALIGN(16) : {
KEEP ( *(.fimport_sndcore2) )
*(.fimport_sndcore2.*)
} > loadmem
.fimport_snd_core ALIGN(16) : {
KEEP ( *(.fimport_snd_core) )
*(.fimport_snd_core.*)
} > loadmem
.fimport_snduser2 ALIGN(16) : {
KEEP ( *(.fimport_snduser2) )
*(.fimport_snduser2.*)
} > loadmem
.fimport_snd_user ALIGN(16) : {
KEEP ( *(.fimport_snd_user) )
*(.fimport_snd_user.*)
} > loadmem
.fimport_swkbd ALIGN(16) : {
KEEP ( *(.fimport_swkbd) )
*(.fimport_swkbd.*)
} > loadmem
.fimport_sysapp ALIGN(16) : {
KEEP ( *(.fimport_sysapp) )
*(.fimport_sysapp.*)
} > loadmem
.fimport_tcl ALIGN(16) : {
KEEP ( *(.fimport_tcl) )
*(.fimport_tcl.*)
} > loadmem
.fimport_tve ALIGN(16) : {
KEEP ( *(.fimport_tve) )
*(.fimport_tve.*)
} > loadmem
.fimport_uac ALIGN(16) : {
KEEP ( *(.fimport_uac) )
*(.fimport_uac.*)
} > loadmem
.fimport_uac_rpl ALIGN(16) : {
KEEP ( *(.fimport_uac_rpl) )
*(.fimport_uac_rpl.*)
} > loadmem
.fimport_usb_mic ALIGN(16) : {
KEEP ( *(.fimport_usb_mic) )
*(.fimport_usb_mic.*)
} > loadmem
.fimport_uvc ALIGN(16) : {
KEEP ( *(.fimport_uvc) )
*(.fimport_uvc.*)
} > loadmem
.fimport_uvd ALIGN(16) : {
KEEP ( *(.fimport_uvd) )
*(.fimport_uvd.*)
} > loadmem
.fimport_vpadbase ALIGN(16) : {
KEEP ( *(.fimport_vpadbase) )
*(.fimport_vpadbase.*)
} > loadmem
.fimport_vpad ALIGN(16) : {
KEEP ( *(.fimport_vpad) )
*(.fimport_vpad.*)
} > loadmem
.fimport_zlib125 ALIGN(16) : {
KEEP ( *(.fimport_zlib125) )
*(.fimport_zlib125.*)
} > loadmem
.dimport_coreinit ALIGN(16) : { *(.dimport_coreinit) } > loadmem
.dimport_nn_act ALIGN(16) : { *(.dimport_nn_act) } > loadmem
.dimport_nn_boss ALIGN(16) : { *(.dimport_nn_boss) } > loadmem
.dimport_nn_ec ALIGN(16) : { *(.dimport_nn_ec) } > loadmem
.dimport_nn_nim ALIGN(16) : { *(.dimport_nn_nim) } > loadmem
.dimport_nn_sl ALIGN(16) : { *(.dimport_nn_sl) } > loadmem
.dimport_nn_uds ALIGN(16) : { *(.dimport_nn_uds) } > loadmem
.dimport_coreinit ALIGN(16) : {
KEEP ( *(.dimport_coreinit) )
*(.dimport_coreinit.*)
} > loadmem
.dimport_nn_act ALIGN(16) : {
KEEP ( *(.dimport_nn_act) )
*(.dimport_nn_act.*)
} > loadmem
.dimport_nn_boss ALIGN(16) : {
KEEP ( *(.dimport_nn_boss) )
*(.dimport_nn_boss.*)
} > loadmem
.dimport_nn_ec ALIGN(16) : {
KEEP ( *(.dimport_nn_ec) )
*(.dimport_nn_ec.*)
} > loadmem
.dimport_nn_nim ALIGN(16) : {
KEEP ( *(.dimport_nn_nim) )
*(.dimport_nn_nim.*)
} > loadmem
.dimport_nn_sl ALIGN(16) : {
KEEP ( *(.dimport_nn_sl) )
*(.dimport_nn_sl.*)
} > loadmem
.dimport_nn_uds ALIGN(16) : {
KEEP ( *(.dimport_nn_uds) )
*(.dimport_nn_uds.*)
} > loadmem
.symtab ALIGN(4) : { *(.symtab) } > loadmem
.strtab ALIGN(1) : { *(.strtab) } > loadmem

4
share/wut.specs Normal file
View File

@ -0,0 +1,4 @@
%rename link old_link
*link:
%(old_link) -T %:getenv(DEVKITPRO /wut/share/wut.ld) --gc-sections --emit-relocs -z nocopyreloc -wrap __gxx_personality_v0 %(wut_entry)

52
share/wut_rules Normal file
View File

@ -0,0 +1,52 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitPro")
endif
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>/devkitPro/devkitPPC")
endif
include $(DEVKITPPC)/base_rules
PORTLIBS := $(PORTLIBS_PATH)/wiiu $(PORTLIBS_PATH)/ppc
export PATH := $(PORTLIBS_PATH)/wiiu/bin:$(PORTLIBS_PATH)/ppc/bin:$(PATH)
WUT_ROOT ?= $(DEVKITPRO)/wut
RPXSPECS := -specs=$(WUT_ROOT)/share/wut.specs -specs=$(WUT_ROOT)/share/rpx.specs
RPLSPECS := -specs=$(WUT_ROOT)/share/wut.specs -specs=$(WUT_ROOT)/share/rpl.specs
MACHDEP = -DESPRESSO -mcpu=750 -meabi -mhard-float
#---------------------------------------------------------------------------------
%.rpx: %.elf
@cp $< $*.strip.elf
@$(STRIP) -g $*.strip.elf
@elf2rpl $*.strip.elf $@
@rm $*.strip.elf
@echo built ... $(notdir $@)
#---------------------------------------------------------------------------------
%.rpl: %.elf
@cp $< $*.strip.elf
@$(STRIP) -g $*.strip.elf
@elf2rpl --rpl $*.strip.elf $@
@rm $*.strip.elf
@echo built ... $(notdir $@)
#---------------------------------------------------------------------------------
%.elf:
@echo linking ... $(notdir $@)
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@
@$(NM) -CSn $@ > $(notdir $*.lst)
#---------------------------------------------------------------------------------
%.o: %.def
@echo $(notdir $<)
@rplimportgen $< $*.s
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $*.s -o $@ $(ERROR_FILTER)