summaryrefslogtreecommitdiffstats
path: root/flash/bootloader
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-10-12 22:10:22 +0000
committerJens Arnold <amiconn@rockbox.org>2008-10-12 22:10:22 +0000
commitca99f8efa49fbc053ea3a264c5cc23bda3b2a50c (patch)
treef0924d9866b1a6323ca58be4b5e67e42ea8c5753 /flash/bootloader
parent142ac2a35af99ddd80636b8973c5ee082550c215 (diff)
downloadrockbox-ca99f8efa49fbc053ea3a264c5cc23bda3b2a50c.tar.gz
rockbox-ca99f8efa49fbc053ea3a264c5cc23bda3b2a50c.tar.bz2
rockbox-ca99f8efa49fbc053ea3a264c5cc23bda3b2a50c.zip
Archos flash loader: compile with -Os and make all internal functions static to save space. main() and _main() must not be static or they wouldn't end up in IRAM for execution. * Also make some bootbox functions static, and drop the useless return value from charging_screen().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18791 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'flash/bootloader')
-rw-r--r--flash/bootloader/Makefile2
-rw-r--r--flash/bootloader/bootloader.c40
-rw-r--r--flash/bootloader/bootloader.h17
3 files changed, 29 insertions, 30 deletions
diff --git a/flash/bootloader/Makefile b/flash/bootloader/Makefile
index 6872fcbc99..e7bd17aae9 100644
--- a/flash/bootloader/Makefile
+++ b/flash/bootloader/Makefile
@@ -35,7 +35,7 @@ DEFINES= -DPLATFORM_$(PLATFORM)
OBJDIR := .
-CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(DEFINES)
+CFLAGS = -Os -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(DEFINES)
AFLAGS += -small -relax
diff --git a/flash/bootloader/bootloader.c b/flash/bootloader/bootloader.c
index dc094d1b2e..d1955c2ccd 100644
--- a/flash/bootloader/bootloader.c
+++ b/flash/bootloader/bootloader.c
@@ -27,6 +27,22 @@
#include "sh7034.h"
#include "bootloader.h"
+// prototypes
+static void PlatformInit(void);
+static int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
+static void DecompressStart(tImage* pImage);
+#ifdef USE_ADC
+static int ReadADC(int channel);
+#endif
+static int ButtonPressed(void);
+static tImage* GetStartImage(int nPreferred);
+// test functions
+static void SetLed(BOOL bOn);
+static void UartInit(void);
+static UINT8 UartRead(void);
+static void UartWrite(UINT8 byte);
+static void MiniMon(void);
+
#ifdef NO_ROM
/* start with the vector table */
@@ -71,7 +87,7 @@ void _main(void)
}
-void BootInit(void)
+static void BootInit(void)
{
/* inits from the boot ROM, whether they make sense or not */
PBDR &= 0xFFBF; /* LED off (0x131E) */
@@ -117,7 +133,7 @@ int main(void)
/* init code that is specific to certain platform */
-void PlatformInit(void)
+static void PlatformInit(void)
{
#ifdef NO_ROM
BootInit(); /* if not started by boot ROM, we need to init what it did */
@@ -177,7 +193,7 @@ void PlatformInit(void)
#define GETBIT(bb, src, ilen) \
(((bb = bb & 0x7f ? bb*2 : ((unsigned)src[ilen++]*2+1)) >> 8) & 1)
-int ucl_nrv2e_decompress_8(
+static int ucl_nrv2e_decompress_8(
const UINT8 *src, UINT8 *dst, UINT32* dst_len)
{
UINT32 bb = 0;
@@ -239,7 +255,7 @@ int ucl_nrv2e_decompress_8(
/* move the image into place and start it */
-void DecompressStart(tImage* pImage)
+static void DecompressStart(tImage* pImage)
{
UINT32* pSrc;
UINT32* pDest;
@@ -273,7 +289,7 @@ void DecompressStart(tImage* pImage)
}
#ifdef USE_ADC
-int ReadADC(int channel)
+static int ReadADC(int channel)
{
/* after channel 3, the ports wrap and get re-used */
volatile UINT16* pResult = (UINT16*)(ADDRAH_ADDR + 2 * (channel & 0x03));
@@ -289,7 +305,7 @@ int ReadADC(int channel)
/* This function is platform-dependent,
* until I figure out how to distinguish at runtime. */
-int ButtonPressed(void) /* return 1,2,3 for F1,F2,F3, 0 if none pressed */
+static int ButtonPressed(void) /* return 1,2,3 for F1,F2,F3, 0 if none pressed */
{
#ifdef USE_ADC
int value = ReadADC(CHANNEL);
@@ -316,7 +332,7 @@ int ButtonPressed(void) /* return 1,2,3 for F1,F2,F3, 0 if none pressed */
/* Determine the image to be started */
-tImage* GetStartImage(int nPreferred)
+static tImage* GetStartImage(int nPreferred)
{
tImage* pImage1;
tImage* pImage2 = NULL; /* default to not present */
@@ -357,7 +373,7 @@ tImage* GetStartImage(int nPreferred)
/* diagnostic functions */
-void SetLed(BOOL bOn)
+static void SetLed(BOOL bOn)
{
if (bOn)
PBDR |= 0x0040;
@@ -366,7 +382,7 @@ void SetLed(BOOL bOn)
}
-void UartInit(void)
+static void UartInit(void)
{
PBIOR &= 0xFBFF; /* input: RXD1 remote pin */
PBCR1 |= 0x00A0; /* set PB11+PB10 to UART */
@@ -378,7 +394,7 @@ void UartInit(void)
}
-UINT8 UartRead(void)
+static UINT8 UartRead(void)
{
UINT8 byte;
while (!(SSR1 & SCI_RDRF)); /* wait for char to be available */
@@ -388,7 +404,7 @@ UINT8 UartRead(void)
}
-void UartWrite(UINT8 byte)
+static void UartWrite(UINT8 byte)
{
while (!(SSR1 & SCI_TDRE)); /* wait for transmit buffer empty */
TDR1 = byte;
@@ -397,7 +413,7 @@ void UartWrite(UINT8 byte)
/* include the mini monitor as a rescue feature, started with F3 */
-void MiniMon(void)
+static void MiniMon(void)
{
UINT8 cmd;
UINT32 addr;
diff --git a/flash/bootloader/bootloader.h b/flash/bootloader/bootloader.h
index fc6bcb1eed..948311f55d 100644
--- a/flash/bootloader/bootloader.h
+++ b/flash/bootloader/bootloader.h
@@ -76,26 +76,9 @@ typedef struct
#define FLASH_BASE 0x02000000 // start of the flash memory
#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
-
// prototypes
void _main(void) __attribute__ ((section (".startup")));
int main(void);
-void PlatformInit(void);
-void DramInit(void);
-int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
-void DecompressStart(tImage* pImage);
-#ifdef USE_ADC
-int ReadADC(int channel);
-#endif
-int ButtonPressed(void);
-tImage* GetStartImage(int nPreferred);
-// test functions
-void SetLed(BOOL bOn);
-void UartInit(void);
-UINT8 UartRead(void);
-void UartWrite(UINT8 byte);
-void MiniMon(void);
-
// minimon commands
#define BAUDRATE 0x00 // followed by BRR value; response: command byte