mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
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
This commit is contained in:
parent
142ac2a35a
commit
ca99f8efa4
4 changed files with 33 additions and 40 deletions
|
@ -44,7 +44,7 @@
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "powermgmt.h"
|
#include "powermgmt.h"
|
||||||
|
|
||||||
void usb_screen(void)
|
static void usb_screen(void)
|
||||||
{
|
{
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_puts(0, 0, "USB mode");
|
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_clear_display();
|
||||||
lcd_puts(0, 0, "Rockbox");
|
lcd_puts(0, 0, "Rockbox");
|
||||||
|
@ -64,13 +64,7 @@ void show_logo(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
/*
|
static void charging_screen(void)
|
||||||
bool backlight_get_on_when_charging(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void charging_screen(void)
|
|
||||||
{
|
{
|
||||||
unsigned int button;
|
unsigned int button;
|
||||||
const char* msg;
|
const char* msg;
|
||||||
|
@ -123,7 +117,7 @@ void charging_screen(void)
|
||||||
#endif /* CONFIG_CHARGING */
|
#endif /* CONFIG_CHARGING */
|
||||||
|
|
||||||
/* prompt user to plug USB and fix a problem */
|
/* 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;
|
int button;
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
|
|
@ -35,7 +35,7 @@ DEFINES= -DPLATFORM_$(PLATFORM)
|
||||||
|
|
||||||
OBJDIR := .
|
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
|
AFLAGS += -small -relax
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,22 @@
|
||||||
#include "sh7034.h"
|
#include "sh7034.h"
|
||||||
#include "bootloader.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
|
#ifdef NO_ROM
|
||||||
/* start with the vector table */
|
/* 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 */
|
/* inits from the boot ROM, whether they make sense or not */
|
||||||
PBDR &= 0xFFBF; /* LED off (0x131E) */
|
PBDR &= 0xFFBF; /* LED off (0x131E) */
|
||||||
|
@ -117,7 +133,7 @@ int main(void)
|
||||||
|
|
||||||
|
|
||||||
/* init code that is specific to certain platform */
|
/* init code that is specific to certain platform */
|
||||||
void PlatformInit(void)
|
static void PlatformInit(void)
|
||||||
{
|
{
|
||||||
#ifdef NO_ROM
|
#ifdef NO_ROM
|
||||||
BootInit(); /* if not started by boot ROM, we need to init what it did */
|
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) \
|
#define GETBIT(bb, src, ilen) \
|
||||||
(((bb = bb & 0x7f ? bb*2 : ((unsigned)src[ilen++]*2+1)) >> 8) & 1)
|
(((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)
|
const UINT8 *src, UINT8 *dst, UINT32* dst_len)
|
||||||
{
|
{
|
||||||
UINT32 bb = 0;
|
UINT32 bb = 0;
|
||||||
|
@ -239,7 +255,7 @@ int ucl_nrv2e_decompress_8(
|
||||||
|
|
||||||
|
|
||||||
/* move the image into place and start it */
|
/* move the image into place and start it */
|
||||||
void DecompressStart(tImage* pImage)
|
static void DecompressStart(tImage* pImage)
|
||||||
{
|
{
|
||||||
UINT32* pSrc;
|
UINT32* pSrc;
|
||||||
UINT32* pDest;
|
UINT32* pDest;
|
||||||
|
@ -273,7 +289,7 @@ void DecompressStart(tImage* pImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_ADC
|
#ifdef USE_ADC
|
||||||
int ReadADC(int channel)
|
static int ReadADC(int channel)
|
||||||
{
|
{
|
||||||
/* after channel 3, the ports wrap and get re-used */
|
/* after channel 3, the ports wrap and get re-used */
|
||||||
volatile UINT16* pResult = (UINT16*)(ADDRAH_ADDR + 2 * (channel & 0x03));
|
volatile UINT16* pResult = (UINT16*)(ADDRAH_ADDR + 2 * (channel & 0x03));
|
||||||
|
@ -289,7 +305,7 @@ int ReadADC(int channel)
|
||||||
|
|
||||||
/* This function is platform-dependent,
|
/* This function is platform-dependent,
|
||||||
* until I figure out how to distinguish at runtime. */
|
* 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
|
#ifdef USE_ADC
|
||||||
int value = ReadADC(CHANNEL);
|
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 */
|
/* Determine the image to be started */
|
||||||
tImage* GetStartImage(int nPreferred)
|
static tImage* GetStartImage(int nPreferred)
|
||||||
{
|
{
|
||||||
tImage* pImage1;
|
tImage* pImage1;
|
||||||
tImage* pImage2 = NULL; /* default to not present */
|
tImage* pImage2 = NULL; /* default to not present */
|
||||||
|
@ -357,7 +373,7 @@ tImage* GetStartImage(int nPreferred)
|
||||||
|
|
||||||
/* diagnostic functions */
|
/* diagnostic functions */
|
||||||
|
|
||||||
void SetLed(BOOL bOn)
|
static void SetLed(BOOL bOn)
|
||||||
{
|
{
|
||||||
if (bOn)
|
if (bOn)
|
||||||
PBDR |= 0x0040;
|
PBDR |= 0x0040;
|
||||||
|
@ -366,7 +382,7 @@ void SetLed(BOOL bOn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UartInit(void)
|
static void UartInit(void)
|
||||||
{
|
{
|
||||||
PBIOR &= 0xFBFF; /* input: RXD1 remote pin */
|
PBIOR &= 0xFBFF; /* input: RXD1 remote pin */
|
||||||
PBCR1 |= 0x00A0; /* set PB11+PB10 to UART */
|
PBCR1 |= 0x00A0; /* set PB11+PB10 to UART */
|
||||||
|
@ -378,7 +394,7 @@ void UartInit(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UINT8 UartRead(void)
|
static UINT8 UartRead(void)
|
||||||
{
|
{
|
||||||
UINT8 byte;
|
UINT8 byte;
|
||||||
while (!(SSR1 & SCI_RDRF)); /* wait for char to be available */
|
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 */
|
while (!(SSR1 & SCI_TDRE)); /* wait for transmit buffer empty */
|
||||||
TDR1 = byte;
|
TDR1 = byte;
|
||||||
|
@ -397,7 +413,7 @@ void UartWrite(UINT8 byte)
|
||||||
|
|
||||||
|
|
||||||
/* include the mini monitor as a rescue feature, started with F3 */
|
/* include the mini monitor as a rescue feature, started with F3 */
|
||||||
void MiniMon(void)
|
static void MiniMon(void)
|
||||||
{
|
{
|
||||||
UINT8 cmd;
|
UINT8 cmd;
|
||||||
UINT32 addr;
|
UINT32 addr;
|
||||||
|
|
|
@ -76,26 +76,9 @@ typedef struct
|
||||||
#define FLASH_BASE 0x02000000 // start of the flash memory
|
#define FLASH_BASE 0x02000000 // start of the flash memory
|
||||||
#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
|
#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
|
||||||
|
|
||||||
|
|
||||||
// prototypes
|
// prototypes
|
||||||
void _main(void) __attribute__ ((section (".startup")));
|
void _main(void) __attribute__ ((section (".startup")));
|
||||||
int main(void);
|
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
|
// minimon commands
|
||||||
#define BAUDRATE 0x00 // followed by BRR value; response: command byte
|
#define BAUDRATE 0x00 // followed by BRR value; response: command byte
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue