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 an unused function.

git-svn-id: svn://svn.rockbox.org/rockbox/branches/v3_0@18792 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2008-10-12 22:19:33 +00:00
parent 3d948cb27d
commit 85ac1ced98
4 changed files with 33 additions and 40 deletions

View file

@ -44,7 +44,7 @@
#include "usb.h"
#include "powermgmt.h"
void usb_screen(void)
static void usb_screen(void)
{
lcd_clear_display();
lcd_puts(0, 0, "USB mode");
@ -55,7 +55,7 @@ void usb_screen(void)
}
}
void show_logo(void)
static void show_logo(void)
{
lcd_clear_display();
lcd_puts(0, 0, "Rockbox");
@ -64,13 +64,7 @@ void show_logo(void)
}
#if CONFIG_CHARGING
/*
bool backlight_get_on_when_charging(void)
{
return false;
}
*/
void charging_screen(void)
static void charging_screen(void)
{
unsigned int button;
const char* msg;
@ -123,7 +117,7 @@ void charging_screen(void)
#endif /* CONFIG_CHARGING */
/* prompt user to plug USB and fix a problem */
void prompt_usb(const char* msg1, const char* msg2)
static void prompt_usb(const char* msg1, const char* msg2)
{
int button;
lcd_clear_display();

View file

@ -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

View file

@ -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;

View file

@ -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