[loader] Added minimal loader project

Added an empty project for the loader. This just logs a short string over udp.
This commit is contained in:
Maschell
2018-02-03 17:03:03 +01:00
parent 64d8f87a39
commit d6ee498a16
14 changed files with 1087 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#ifndef COMMON_H
#define COMMON_H
#ifdef __cplusplus
extern "C" {
#endif
#include <dynamic_libs/os_defs.h>
#define CAFE_OS_SD_PATH "/vol/external01"
#define GAME_MOD_FOLDER "/sdcafiine"
#define SD_PATH "sd:"
#define USB_PATH "usb:"
#define DEFAULT_NAME_PACKAGE "DEFAULT"
#define NAME_PREFIX_SD "sd: "
#define NAME_PREFIX_USB "usb:"
#define ELF_DATA_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x00))
#define ELF_DATA_SIZE (*(volatile unsigned int*)(MEM_BASE + 0x1300 + 0x04))
#define MAIN_ENTRY_ADDR (*(volatile unsigned int*)(MEM_BASE + 0x1400 + 0x00))
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
#define EXIT_HBL_EXIT 0xFFFFFFFE
#define EXIT_RELAUNCH_ON_LOAD 0xFFFFFFFD
#ifdef __cplusplus
}
#endif
#endif /* COMMON_H */

View File

@@ -0,0 +1,2 @@
#include "retain_vars.h"

View File

@@ -0,0 +1,5 @@
#ifndef RETAINS_VARS_H_
#define RETAINS_VARS_H_
#endif // RETAINS_VARS_H_

10
loader/src/entry.c Normal file
View File

@@ -0,0 +1,10 @@
#include <string.h>
#include "main.h"
int __entry_menu(int argc, char **argv)
{
//! *******************************************************************
//! * Jump to our application *
//! *******************************************************************
return Menu_Main();
}

40
loader/src/link.ld Normal file
View File

@@ -0,0 +1,40 @@
OUTPUT(wiiupluginloader.elf);
/* Tell linker where our application entry is so the garbage collect can work correct */
ENTRY(__entry_menu);
SECTIONS {
. = 0x00802000;
.text : {
*(.kernel_code*);
*(.text*);
/* Tell linker to not garbage collect this section as it is not referenced anywhere */
KEEP(*(.kernel_code*));
}
.rodata : {
*(.rodata*);
}
.data : {
*(.data*);
__sdata_start = .;
*(.sdata*);
__sdata_end = .;
__sdata2_start = .;
*(.sdata2*);
__sdata2_end = .;
}
.bss : {
__bss_start = .;
*(.bss*);
*(.sbss*);
*(COMMON);
__bss_end = .;
}
__CODE_END = .;
/DISCARD/ : {
*(*);
}
}

29
loader/src/main.cpp Normal file
View File

@@ -0,0 +1,29 @@
#include <string>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <malloc.h>
#include <dynamic_libs/os_functions.h>
#include <dynamic_libs/socket_functions.h>
#include <utils/logger.h>
#include <system/exception_handler.h>
#include "main.h"
/* Entry point */
extern "C" int Menu_Main(void){
InitOSFunctionPointers();
InitSocketFunctionPointers(); //For logging
log_init();
setup_os_exceptions();
DEBUG_FUNCTION_LINE("Application started.\n");
return EXIT_SUCCESS;
}

19
loader/src/main.h Normal file
View File

@@ -0,0 +1,19 @@
#ifndef _MAIN_H_
#define _MAIN_H_
#include <dynamic_libs/os_functions.h>
#include <dynamic_libs/os_types.h>
/* Main */
#ifdef __cplusplus
extern "C" {
#endif
//! C wrapper for our C++ functions
int Menu_Main(void);
#ifdef __cplusplus
}
#endif
#endif

1
loader/src/version.h Normal file
View File

@@ -0,0 +1 @@
#define APP_VERSION "pre-alpha"