-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(yikes!)
- Loading branch information
Showing
29 changed files
with
1,089 additions
and
1,089 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,64 @@ | ||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") | ||
OUTPUT_ARCH(arm) | ||
ENTRY(__boot) | ||
MEMORY | ||
{ | ||
/* Virtual address where bootrom will be mappped to avoid veneers */ | ||
BOOTROM (RX) : ORIGIN = 0x17000000, LENGTH = 32K | ||
VRAMLOAD (RWX) : ORIGIN = 0x18100000, LENGTH = 1M | ||
} | ||
SECTIONS | ||
{ | ||
.bootrom (NOLOAD) : ALIGN(4K) | ||
{ | ||
*(.bootrom*) | ||
. = ALIGN(4K); | ||
} >BOOTROM | ||
.text : ALIGN(4K) | ||
{ | ||
__text_pa = LOADADDR(.text); | ||
__text_va = ABSOLUTE(.); | ||
*(.text*) | ||
. = ALIGN(4K); | ||
__text_len = . - __text_va; | ||
} >VRAMLOAD | ||
.data : ALIGN(4K) | ||
{ | ||
__data_pa = LOADADDR(.data); | ||
__data_va = ABSOLUTE(.); | ||
*(.data*) | ||
. = ALIGN(4K); | ||
__data_len = . - __data_va; | ||
} >VRAMLOAD | ||
.rodata : ALIGN(4K) | ||
{ | ||
__rodata_pa = LOADADDR(.rodata); | ||
__rodata_va = ABSOLUTE(.); | ||
*(.rodata*) | ||
. = ALIGN(4K); | ||
__rodata_len = . - __rodata_va; | ||
} >VRAMLOAD | ||
.shared (NOLOAD) : ALIGN(4K) | ||
{ | ||
__shared_pa = LOADADDR(.shared); | ||
__shared_va = ABSOLUTE(.); | ||
*(.shared*) | ||
. = ALIGN(4K); | ||
__shared_len = . - __shared_va; | ||
} >VRAMLOAD | ||
.bss (NOLOAD) : ALIGN(4K) | ||
{ | ||
__bss_pa = LOADADDR(.bss); | ||
__bss_va = ABSOLUTE(.); | ||
*(.bss*) | ||
. = ALIGN(4K); | ||
__bss_len = . - __bss_va; | ||
} >VRAMLOAD | ||
} | ||
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") | ||
OUTPUT_ARCH(arm) | ||
ENTRY(__boot) | ||
|
||
MEMORY | ||
{ | ||
/* Virtual address where bootrom will be mappped to avoid veneers */ | ||
BOOTROM (RX) : ORIGIN = 0x17000000, LENGTH = 32K | ||
VRAMLOAD (RWX) : ORIGIN = 0x18100000, LENGTH = 1M | ||
} | ||
|
||
SECTIONS | ||
{ | ||
.bootrom (NOLOAD) : ALIGN(4K) | ||
{ | ||
*(.bootrom*) | ||
. = ALIGN(4K); | ||
} >BOOTROM | ||
|
||
.text : ALIGN(4K) | ||
{ | ||
__text_pa = LOADADDR(.text); | ||
__text_va = ABSOLUTE(.); | ||
*(.text*) | ||
. = ALIGN(4K); | ||
__text_len = . - __text_va; | ||
} >VRAMLOAD | ||
|
||
.data : ALIGN(4K) | ||
{ | ||
__data_pa = LOADADDR(.data); | ||
__data_va = ABSOLUTE(.); | ||
*(.data*) | ||
. = ALIGN(4K); | ||
__data_len = . - __data_va; | ||
} >VRAMLOAD | ||
|
||
.rodata : ALIGN(4K) | ||
{ | ||
__rodata_pa = LOADADDR(.rodata); | ||
__rodata_va = ABSOLUTE(.); | ||
*(.rodata*) | ||
. = ALIGN(4K); | ||
__rodata_len = . - __rodata_va; | ||
} >VRAMLOAD | ||
|
||
.shared (NOLOAD) : ALIGN(4K) | ||
{ | ||
__shared_pa = LOADADDR(.shared); | ||
__shared_va = ABSOLUTE(.); | ||
*(.shared*) | ||
. = ALIGN(4K); | ||
__shared_len = . - __shared_va; | ||
} >VRAMLOAD | ||
|
||
.bss (NOLOAD) : ALIGN(4K) | ||
{ | ||
__bss_pa = LOADADDR(.bss); | ||
__bss_va = ABSOLUTE(.); | ||
*(.bss*) | ||
. = ALIGN(4K); | ||
__bss_len = . - __bss_va; | ||
} >VRAMLOAD | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
#include "exception.h" | ||
#include "ui/debug.h" | ||
|
||
#include <pxi.h> | ||
#include <i2c.h> | ||
#include <console.h> | ||
|
||
#include <stdlib.h> | ||
|
||
void doException(u32 type, u32* regs) { | ||
I2C_writeReg(I2C_DEV_CTR_MCU, 0x29, 4); | ||
|
||
consoleClear(); | ||
debugPrintf("ARM11 ded %ld\n\n", type); | ||
|
||
for (int i = 0; i < 20; i += 2) { | ||
debugPrintf("%02d %08lX %02d %08lX\n", i, regs[i], i+1, regs[i+1]); | ||
} | ||
|
||
debugPrint("\nStack:\n"); | ||
u32* sp = (u32*) regs[13]; | ||
|
||
for (int i = 0; i < 32; i += 4) { | ||
debugPrintf("%08lX %08lX %08lX %08lX\n", sp[i], sp[i+1], sp[i+2], sp[i+3]); | ||
} | ||
|
||
PXI_Send(PXICMD_LEGACY_BOOT); | ||
|
||
while (1); | ||
#include "exception.h" | ||
#include "ui/debug.h" | ||
|
||
#include <pxi.h> | ||
#include <i2c.h> | ||
#include <console.h> | ||
|
||
#include <stdlib.h> | ||
|
||
void doException(u32 type, u32* regs) { | ||
I2C_writeReg(I2C_DEV_CTR_MCU, 0x29, 4); | ||
|
||
consoleClear(); | ||
debugPrintf("ARM11 ded %ld\n\n", type); | ||
|
||
for (int i = 0; i < 20; i += 2) { | ||
debugPrintf("%02d %08lX %02d %08lX\n", i, regs[i], i+1, regs[i+1]); | ||
} | ||
|
||
debugPrint("\nStack:\n"); | ||
u32* sp = (u32*) regs[13]; | ||
|
||
for (int i = 0; i < 32; i += 4) { | ||
debugPrintf("%08lX %08lX %08lX %08lX\n", sp[i], sp[i+1], sp[i+2], sp[i+3]); | ||
} | ||
|
||
PXI_Send(PXICMD_LEGACY_BOOT); | ||
|
||
while (1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
|
||
#include "common.h" | ||
|
||
#pragma once | ||
|
||
#include "common.h" | ||
|
||
void doException(u32 type, u32* regs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
#include "log.h" | ||
#include "common.h" | ||
|
||
#include <pxi.h> | ||
#include <console.h> | ||
|
||
static u8 __attribute__((section(".shared"))) sharedBuffer[MAX_LOG_LEN]; | ||
|
||
bool pxiLogWrite(const void* data, unsigned int btw) { | ||
btw = min(btw, MAX_LOG_LEN); | ||
memcpy(sharedBuffer, data, btw); | ||
|
||
PXI_Send((2 << 16) | PXICMD_LOG_DATA); | ||
PXI_Send((u32) sharedBuffer); | ||
PXI_Send(btw); | ||
|
||
//consolePrint("sent pxi log data\n"); | ||
|
||
return PXI_Recv(); | ||
} | ||
|
||
bool pxiLogWriteStr(const char* str) { | ||
strncpy((char*) sharedBuffer, str, MAX_LOG_LEN - 1); | ||
|
||
PXI_Send((1 << 16) | PXICMD_LOG_DATA); | ||
PXI_Send((u32) sharedBuffer); | ||
|
||
//consolePrint("sent pxi log str\n"); | ||
|
||
return PXI_Recv(); | ||
} | ||
#include "log.h" | ||
#include "common.h" | ||
|
||
#include <pxi.h> | ||
#include <console.h> | ||
|
||
static u8 __attribute__((section(".shared"))) sharedBuffer[MAX_LOG_LEN]; | ||
|
||
bool pxiLogWrite(const void* data, unsigned int btw) { | ||
btw = min(btw, MAX_LOG_LEN); | ||
memcpy(sharedBuffer, data, btw); | ||
|
||
PXI_Send((2 << 16) | PXICMD_LOG_DATA); | ||
PXI_Send((u32) sharedBuffer); | ||
PXI_Send(btw); | ||
|
||
//consolePrint("sent pxi log data\n"); | ||
|
||
return PXI_Recv(); | ||
} | ||
|
||
bool pxiLogWriteStr(const char* str) { | ||
strncpy((char*) sharedBuffer, str, MAX_LOG_LEN - 1); | ||
|
||
PXI_Send((1 << 16) | PXICMD_LOG_DATA); | ||
PXI_Send((u32) sharedBuffer); | ||
|
||
//consolePrint("sent pxi log str\n"); | ||
|
||
return PXI_Recv(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#pragma once | ||
|
||
#include "common.h" | ||
|
||
#define MAX_LOG_LEN 1024 | ||
|
||
bool pxiLogWrite(const void* data, unsigned int btw); | ||
#pragma once | ||
|
||
#include "common.h" | ||
|
||
#define MAX_LOG_LEN 1024 | ||
|
||
bool pxiLogWrite(const void* data, unsigned int btw); | ||
bool pxiLogWriteStr(const char* str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#include "log.h" | ||
#include "common.h" | ||
|
||
#include <pxi.h> | ||
#include <console.h> | ||
|
||
u64 pxiGetTimerTicks() { | ||
PXI_Send((0 << 16) | PXICMD_GET_TIMER_TICKS); | ||
|
||
return PXI_Recv64(); | ||
} | ||
#include "log.h" | ||
#include "common.h" | ||
|
||
#include <pxi.h> | ||
#include <console.h> | ||
|
||
u64 pxiGetTimerTicks() { | ||
PXI_Send((0 << 16) | PXICMD_GET_TIMER_TICKS); | ||
|
||
return PXI_Recv64(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#pragma once | ||
|
||
#include "common.h" | ||
|
||
#pragma once | ||
|
||
#include "common.h" | ||
|
||
u64 pxiGetTimerTicks(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
#include "debug.h" | ||
#include "pxi/log.h" | ||
|
||
#include <arm.h> | ||
#include <bfn.h> | ||
#include <console.h> | ||
|
||
#include <stdarg.h> | ||
|
||
#define PREFIX_LEN (sizeof(ARM11_DEBUG_PREFIX) - 1) | ||
|
||
static char strBuf[sizeof(ARM11_DEBUG_PREFIX) + DEBUG_MAX_LEN] = ARM11_DEBUG_PREFIX; | ||
|
||
void logDebugPrintf(bool logOnly, const char* format, ...) { | ||
va_list args; | ||
va_start(args, format); | ||
int n = bfnVsnprintf(strBuf + PREFIX_LEN, DEBUG_MAX_LEN, format, args); | ||
va_end(args); | ||
|
||
if (n == 0) | ||
return; | ||
|
||
if (!logOnly) { | ||
if ((u32) n != consoleNPrint(strBuf + PREFIX_LEN, n)) | ||
ARM_BKPT(); | ||
} | ||
|
||
pxiLogWrite(strBuf, PREFIX_LEN + n); | ||
#include "debug.h" | ||
#include "pxi/log.h" | ||
|
||
#include <arm.h> | ||
#include <bfn.h> | ||
#include <console.h> | ||
|
||
#include <stdarg.h> | ||
|
||
#define PREFIX_LEN (sizeof(ARM11_DEBUG_PREFIX) - 1) | ||
|
||
static char strBuf[sizeof(ARM11_DEBUG_PREFIX) + DEBUG_MAX_LEN] = ARM11_DEBUG_PREFIX; | ||
|
||
void logDebugPrintf(bool logOnly, const char* format, ...) { | ||
va_list args; | ||
va_start(args, format); | ||
int n = bfnVsnprintf(strBuf + PREFIX_LEN, DEBUG_MAX_LEN, format, args); | ||
va_end(args); | ||
|
||
if (n == 0) | ||
return; | ||
|
||
if (!logOnly) { | ||
if ((u32) n != consoleNPrint(strBuf + PREFIX_LEN, n)) | ||
ARM_BKPT(); | ||
} | ||
|
||
pxiLogWrite(strBuf, PREFIX_LEN + n); | ||
} |
Oops, something went wrong.