mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-12-23 12:20:00 +00:00
A dummy example to show how to make binary smaller
This commit is contained in:
@@ -56,6 +56,7 @@ SAMPLES = \
|
|||||||
kernel/regenum \
|
kernel/regenum \
|
||||||
kernel/systimer \
|
kernel/systimer \
|
||||||
kernel/sysevent \
|
kernel/sysevent \
|
||||||
|
libcglue/light_elf \
|
||||||
mp3 \
|
mp3 \
|
||||||
ms/callback \
|
ms/callback \
|
||||||
nand/dumpipl \
|
nand/dumpipl \
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ SAMPLES = \
|
|||||||
kernel/regenum \
|
kernel/regenum \
|
||||||
kernel/systimer \
|
kernel/systimer \
|
||||||
kernel/sysevent \
|
kernel/sysevent \
|
||||||
|
libcglue/light_elf \
|
||||||
mp3 \
|
mp3 \
|
||||||
ms/callback \
|
ms/callback \
|
||||||
nand/dumpipl \
|
nand/dumpipl \
|
||||||
|
|||||||
16
src/samples/libcglue/light_elf/Makefile.sample
Normal file
16
src/samples/libcglue/light_elf/Makefile.sample
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
TARGET = light_size
|
||||||
|
OBJS = main.o
|
||||||
|
|
||||||
|
INCDIR =
|
||||||
|
CFLAGS = -Os -Wall -fdata-sections -ffunction-sections
|
||||||
|
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
|
||||||
|
ASFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
|
LIBDIR =
|
||||||
|
LDFLAGS = -s
|
||||||
|
|
||||||
|
EXTRA_TARGETS = EBOOT.PBP
|
||||||
|
PSP_EBOOT_TITLE = Light Hello World
|
||||||
|
|
||||||
|
PSPSDK=$(shell psp-config --pspsdk-path)
|
||||||
|
include $(PSPSDK)/lib/build.mak
|
||||||
44
src/samples/libcglue/light_elf/main.c
Normal file
44
src/samples/libcglue/light_elf/main.c
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* PSP Software Development Kit - https://github.com/pspdev
|
||||||
|
* -----------------------------------------------------------------------
|
||||||
|
* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Sample program to demonstrate a minimalistic Hello World program.
|
||||||
|
* The main scope here is to show how we can disable newlib features if we don't need them.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
// Specific psp headers
|
||||||
|
#include <pspkernel.h>
|
||||||
|
#include <pspdebug.h>
|
||||||
|
#include <pspdisplay.h>
|
||||||
|
#include <pspkernel.h>
|
||||||
|
#include <pspmoduleinfo.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
// We won't fully disable newlib as we are using printf
|
||||||
|
// However we can disable timezone, pthreads, pipe and socket support
|
||||||
|
PSP_DISABLE_NEWLIB_PIPE_SUPPORT()
|
||||||
|
PSP_DISABLE_NEWLIB_SOCKET_SUPPORT()
|
||||||
|
PSP_DISABLE_NEWLIB_TIMEZONE_SUPPORT()
|
||||||
|
PSP_DISABLE_NEWLIB_CWD_SUPPORT()
|
||||||
|
PSP_DISABLE_AUTOSTART_PTHREAD()
|
||||||
|
|
||||||
|
// configure PSP stuff
|
||||||
|
#define VERS 1
|
||||||
|
#define REVS 0
|
||||||
|
|
||||||
|
PSP_MODULE_INFO("Light Hello World", PSP_MODULE_USER, VERS, REVS);
|
||||||
|
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
while(1) {
|
||||||
|
printf("Hello World!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user