Skip to content

Commit

Permalink
fixup line endings
Browse files Browse the repository at this point in the history
(yikes!)
  • Loading branch information
aspargas2 committed Mar 21, 2023
1 parent a6ffd08 commit 88d0c4b
Show file tree
Hide file tree
Showing 29 changed files with 1,089 additions and 1,089 deletions.
128 changes: 64 additions & 64 deletions arm11/link.ld
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
}
58 changes: 29 additions & 29 deletions arm11/source/arm/exception.c
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);
}
8 changes: 4 additions & 4 deletions arm11/source/arm/exception.h
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);
64 changes: 32 additions & 32 deletions arm11/source/pxi/log.c
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();
}

14 changes: 7 additions & 7 deletions arm11/source/pxi/log.h
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);
22 changes: 11 additions & 11 deletions arm11/source/pxi/timer.c
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();
}
8 changes: 4 additions & 4 deletions arm11/source/pxi/timer.h
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();
56 changes: 28 additions & 28 deletions arm11/source/ui/debug.c
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);
}
Loading

0 comments on commit 88d0c4b

Please sign in to comment.