- compile with size optimizations, reduces inst cache pressure

- removed most of lodepng's optional features
- lodepng now uses the already existing CRC32 code instead of using its own copy
- fixed GIC interrupt priority
This commit is contained in:
Wolfvak 2019-05-02 20:35:53 -03:00 committed by d0k3
parent cadc7e6982
commit 2f64a8046a
9 changed files with 24 additions and 14 deletions

View File

@ -30,7 +30,7 @@ export INCLUDE := -I"$(shell pwd)/common"
export ASFLAGS := -g -x assembler-with-cpp $(INCLUDE)
export CFLAGS := -DDBUILTS="\"$(DBUILTS)\"" -DDBUILTL="\"$(DBUILTL)\"" -DVERSION="\"$(VERSION)\"" -DFLAVOR="\"$(FLAVOR)\"" \
-g -O2 -Wall -Wextra -Wpedantic -Wcast-align -Wformat=2 -Wno-main \
-g -Os -Wall -Wextra -Wpedantic -Wcast-align -Wformat=2 -Wno-main \
-fomit-frame-pointer -ffast-math -std=gnu11 -MMD -MP \
-Wno-unused-function -Wno-format-truncation $(INCLUDE) -ffunction-sections -fdata-sections
export LDFLAGS := -Tlink.ld -nostartfiles -Wl,--gc-sections,-z,max-page-size=512

View File

@ -151,12 +151,13 @@ void PXI_RX_Handler(u32 __attribute__((unused)) irqn)
void __attribute__((noreturn)) MainLoop(void)
{
// enable PXI RX interrupt
GIC_Enable(PXI_RX_INTERRUPT, BIT(0), GIC_HIGHEST_PRIO, PXI_RX_Handler);
GIC_Enable(PXI_RX_INTERRUPT, BIT(0), GIC_HIGHEST_PRIO + 2, PXI_RX_Handler);
// enable MCU interrupts
GIC_Enable(MCU_INTERRUPT, BIT(0), GIC_HIGHEST_PRIO + 1, MCU_HandleInterrupts);
GIC_Enable(VBLANK_INTERRUPT, BIT(0), GIC_HIGHEST_PRIO + 2, VBlank_Handler);
// set up VBlank interrupt to always have the highest priority
GIC_Enable(VBLANK_INTERRUPT, BIT(0), GIC_HIGHEST_PRIO, VBlank_Handler);
// ARM9 won't try anything funny until this point
PXI_Barrier(ARM11_READY_BARRIER);

View File

@ -2,8 +2,9 @@
// https://github.com/eai04191/beat/blob/master/nall/crc32.hpp
// Ported by Hyarion for use with VirtualFatFS
#include "crc32.h"
#include "common.h"
#include "crc32.h"
#include "vff.h"
u32 crc32_adjust(u32 crc32, u8 input) {
static const u32 crc32_table[256] = {

View File

@ -3,7 +3,8 @@
// Ported by Hyarion for use with VirtualFatFS
#pragma once
#include "vff.h"
#include "common.h"
u32 crc32_adjust(u32 crc32, u8 input);
u32 crc32_calculate(u32 crc32, const u8* data, u32 length);

View File

@ -215,7 +215,7 @@ void slideByte(sCompressInfo* a_pInfo, const u8* a_pSrc) {
}
}
inline void slide(sCompressInfo* a_pInfo, const u8* a_pSrc, int a_nSize) {
static inline void slide(sCompressInfo* a_pInfo, const u8* a_pSrc, int a_nSize) {
for (int i = 0; i < a_nSize; i++) {
slideByte(a_pInfo, a_pSrc--);
}

View File

@ -36,13 +36,6 @@ static u32 A0_Response = 0xFFFFFFFFu;
static u32 rand1 = 0;
static u32 rand2 = 0;
u32 BSWAP32(u32 val) {
return (((val >> 24) & 0xFF)) |
(((val >> 16) & 0xFF) << 8) |
(((val >> 8) & 0xFF) << 16) |
((val & 0xFF) << 24);
}
// updated function by profi200
static void ResetCardSlot(void)
{

View File

@ -12,8 +12,8 @@
#define LATENCY 0x822Cu
#define BSWAP32(n) __builtin_bswap32(n)
u32 BSWAP32(u32 val);
void Cart_Init(void);
int Cart_IsInserted(void);

View File

@ -39,6 +39,18 @@ compiler command to disable them without modifying this header, e.g.
In addition to those below, you can also define LODEPNG_NO_COMPILE_CRC to
allow implementing a custom lodepng_crc32.
*/
#define LODEPNG_NO_COMPILE_CRC
#define LODEPNG_NO_COMPILE_DISK
#define LODEPNG_NO_COMPILE_ANCILLARY_CHUNKS
#define LODEPNG_NO_COMPILE_ERROR_TEXT
#include "crc32.h"
static inline unsigned lodepng_crc32(const unsigned char *data, size_t length)
{
return crc32_calculate(0, data, length);
}
/*deflate & zlib. If disabled, you must specify alternative zlib functions in
the custom_zlib field of the compress and decompress settings*/
#ifndef LODEPNG_NO_COMPILE_ZLIB

View File

@ -18,6 +18,7 @@
#define SR_NOINT (SR_NOFIQ | SR_NOIRQ)
#ifdef ARM9
#define CPU_FREQ (134055928)
#define CR_MPU BIT(0)
#define CR_DCACHE BIT(2)
#define CR_ICACHE BIT(12)
@ -38,6 +39,7 @@
#define MAX_IRQ (32)
#define MAX_CPU (1)
#else // ARM11
#define CPU_FREQ (268111856)
#define CR_MMU BIT(0)
#define CR_ALIGN BIT(1)
#define CR_DCACHE BIT(2)