From f742371e9e06cef13d897be472808463646d3146 Mon Sep 17 00:00:00 2001 From: dhewg Date: Fri, 9 Jul 2010 01:27:09 +0200 Subject: [PATCH] move usbgecko defines to Makefile, fix warnings --- Makefile | 7 +++++++ boot2.c | 2 ++ exception.c | 2 ++ gecko.c | 11 +++++------ makebin.py | 4 ++-- nand.c | 2 ++ utils.c | 2 +- 7 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 63906bc..8027876 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,12 @@ include starlet.mk +# disables debug spew over usbgecko +#CFLAGS += -DNDEBUG +# enables LFCR linefeeds for usbgecko output, useful for some terminal apps +#CFLAGS += -DGECKO_LFCR +# uses the 'safe' version of the usbgecko receive and send functions +#CFLAGS += -DGECKO_SAFE + ASFLAGS += -D_LANGUAGE_ASSEMBLY CFLAGS += -DCAN_HAZ_IRQ -DCAN_HAZ_IPC LDSCRIPT = mini.ld diff --git a/boot2.c b/boot2.c index 892c1db..f711a29 100644 --- a/boot2.c +++ b/boot2.c @@ -217,8 +217,10 @@ int boot2_load(int copy) memset(boot2_iv, 0, 16); memcpy(boot2_iv, &tmd.contents.index, 2); //just zero anyway... +#ifndef NDEBUG u32 *kp = (u32*)boot2_key; gecko_printf("boot2 title key: %08x%08x%08x%08x\n", kp[0], kp[1], kp[2], kp[3]); +#endif boot2_content_size = (tmd.contents.size + 15) & ~15; gecko_printf("boot2 content size: 0x%x (padded: 0x%x)\n", diff --git a/exception.c b/exception.c index d99f757..c984bfa 100644 --- a/exception.c +++ b/exception.c @@ -55,6 +55,8 @@ void exception_initialize(void) void exc_handler(u32 type, u32 spsr, u32 *regs) { + (void) spsr; + if (type > 8) type = 8; gecko_printf("\nException %d (%s):\n", type, exceptions[type]); diff --git a/gecko.c b/gecko.c index ef6e685..aba08ae 100644 --- a/gecko.c +++ b/gecko.c @@ -23,9 +23,6 @@ Copyright (C) 2009 Andre Heider "dhewg" #include "powerpc_elf.h" #include "gecko.h" -//#define GECKO_LFCR -//#define GECKO_SAFE - static u8 gecko_console_enabled = 0; static u32 _gecko_command(u32 command) @@ -56,6 +53,7 @@ static u32 _gecko_getid(void) return i; } +#ifndef NDEBUG static u32 _gecko_sendbyte(u8 sendbyte) { u32 i = 0; @@ -64,6 +62,7 @@ static u32 _gecko_sendbyte(u8 sendbyte) return 1; // Return 1 if byte was sent return 0; } +#endif static u32 _gecko_recvbyte(u8 *recvbyte) { @@ -78,7 +77,7 @@ static u32 _gecko_recvbyte(u8 *recvbyte) return 0; } -#ifdef GECKO_SAFE +#if !defined(NDEBUG) && defined(GECKO_SAFE) static u32 _gecko_checksend(void) { u32 i = 0; @@ -135,7 +134,7 @@ static int gecko_recvbuffer(void *buffer, u32 size) } #endif -#ifndef GECKO_SAFE +#if !defined(NDEBUG) && !defined(GECKO_SAFE) static int gecko_sendbuffer(const void *buffer, u32 size) { u32 left = size; @@ -175,7 +174,7 @@ static int gecko_recvbuffer_safe(void *buffer, u32 size) } #endif -#ifdef GECKO_SAFE +#if !defined(NDEBUG) && defined(GECKO_SAFE) static int gecko_sendbuffer_safe(const void *buffer, u32 size) { u32 left = size; diff --git a/makebin.py b/makebin.py index ce048a4..d1ba4df 100644 --- a/makebin.py +++ b/makebin.py @@ -1,6 +1,6 @@ -#!/bin/env python +#!/usr/bin/env python -import sys, os, struct, sha +import sys, os, struct loaderfile = sys.argv[1] elffile = sys.argv[2] diff --git a/nand.c b/nand.c index 7e47321..067924d 100644 --- a/nand.c +++ b/nand.c @@ -249,6 +249,8 @@ void nand_initialize(void) int nand_correct(u32 pageno, void *data, void *ecc) { + (void) pageno; + u8 *dp = (u8*)data; u32 *ecc_read = (u32*)((u8*)ecc+0x30); u32 *ecc_calc = (u32*)((u8*)ecc+0x40); diff --git a/utils.c b/utils.c index 62590bf..2cd2181 100644 --- a/utils.c +++ b/utils.c @@ -18,7 +18,7 @@ Copyright (C) 2008, 2009 Hector Martin "marcan" #include -#ifndef LOADER +#if !defined(LOADER) && !defined(NDEBUG) static char ascii(char s) { if(s < 0x20) return '.'; if(s > 0x7E) return '.';