Sansa e200v2: bootloader: fit size

Max allowed size: 120860
Old thumb build: 128494
New thumb build: 118514 (fits!)

Disabled:
Logo;
alpha blending capabilities for bitmaps;
Arm stack unwinder (backtrace);

Related forum discussion: https://forums.rockbox.org/index.php/topic,54768.0.html

Fixes FS#12380

Change-Id: I978720d795cb0ef5169103e467cf8386c21d8e93
This commit is contained in:
Roman Artiukhin 2024-02-19 13:59:51 +02:00 committed by Aidan MacDonald
parent 2570909e52
commit c36d7768c5
13 changed files with 41 additions and 11 deletions

View file

@ -25,8 +25,9 @@
#include <string.h> #include <string.h>
#include "version.h" #include "version.h"
#ifndef DISABLE_LOGO
#include "bitmaps/rockboxlogo.h" #include "bitmaps/rockboxlogo.h"
#endif
#if LCD_WIDTH <= 128 #if LCD_WIDTH <= 128
#define BOOT_VERFMT "Boot %s" #define BOOT_VERFMT "Boot %s"
#else #else
@ -54,7 +55,9 @@ void show_logo( void )
lcd_putsxy(text_xpos, 0, verstr); lcd_putsxy(text_xpos, 0, verstr);
lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 16); lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 16);
#else #else
#ifndef DISABLE_LOGO
lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 10); lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 10);
#endif
lcd_putsxy(text_xpos, LCD_HEIGHT-SYSFONT_HEIGHT, verstr); lcd_putsxy(text_xpos, LCD_HEIGHT-SYSFONT_HEIGHT, verstr);
#endif #endif

View file

@ -335,7 +335,7 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig
lcd_mono_bitmap_part(src, 0, 0, width, x, y, width, height); lcd_mono_bitmap_part(src, 0, 0, width, x, y, width, height);
} }
#ifndef DISABLE_ALPHA_BITMAP
/* About Rockbox' internal alpha channel format (for ALPHA_BPP == 4) /* About Rockbox' internal alpha channel format (for ALPHA_BPP == 4)
* *
* For each pixel, 4bit of alpha information is stored in a byte-stream, * For each pixel, 4bit of alpha information is stored in a byte-stream,
@ -654,3 +654,4 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(
BLEND_FINISH; BLEND_FINISH;
} }
#endif /* !DISABLE_ALPHA_BITMAP */

View file

@ -47,11 +47,13 @@
extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[]; extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[];
extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[]; extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[];
#ifndef DISABLE_ALPHA_BITMAP
static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image,
const unsigned char *src, int src_x, const unsigned char *src, int src_x,
int src_y, int x, int y, int src_y, int x, int y,
int width, int height, int width, int height,
int stride_image, int stride_src); int stride_image, int stride_src);
#endif /* !DISABLE_ALPHA_BITMAP */
#include "lcd-color-common.c" #include "lcd-color-common.c"
#include "lcd-bitmap-common.c" #include "lcd-bitmap-common.c"

View file

@ -47,12 +47,13 @@
extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[]; extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[];
extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[]; extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[];
#ifndef DISABLE_ALPHA_BITMAP
static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image,
const unsigned char *src, int src_x, const unsigned char *src, int src_x,
int src_y, int x, int y, int src_y, int x, int y,
int width, int height, int width, int height,
int stride_image, int stride_src); int stride_image, int stride_src);
#endif /* !DISABLE_ALPHA_BITMAP */
#include "lcd-color-common.c" #include "lcd-color-common.c"
#include "lcd-bitmap-common.c" #include "lcd-bitmap-common.c"
#include "lcd-16bit-common.c" #include "lcd-16bit-common.c"

View file

@ -47,13 +47,13 @@
extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[]; extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[];
extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[]; extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[];
#ifndef DISABLE_ALPHA_BITMAP
static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image,
const unsigned char *src, int src_x, const unsigned char *src, int src_x,
int src_y, int x, int y, int src_y, int x, int y,
int width, int height, int width, int height,
int stride_image, int stride_src); int stride_image, int stride_src);
#endif /* !DISABLE_ALPHA_BITMAP */
#include "lcd-color-common.c" #include "lcd-color-common.c"
#include "lcd-bitmap-common.c" #include "lcd-bitmap-common.c"

View file

@ -563,7 +563,7 @@ static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str)
bits = font_get_bits(pf, *ucs); bits = font_get_bits(pf, *ucs);
#if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) && !defined(DISABLE_ALPHA_BITMAP)
if (pf->depth) if (pf->depth)
lcd_alpha_bitmap_part(bits, ofs, 0, width, x, y, lcd_alpha_bitmap_part(bits, ofs, 0, width, x, y,
width - ofs, pf->height); width - ofs, pf->height);

View file

@ -166,6 +166,7 @@ void lcd_bitmap_transparent(const fb_data *src, int x, int y,
STRIDE(SCREEN_MAIN, width, height), x, y, width, height); STRIDE(SCREEN_MAIN, width, height), x, y, width, height);
} }
#ifndef DISABLE_ALPHA_BITMAP
/* draw alpha bitmap for anti-alias font */ /* draw alpha bitmap for anti-alias font */
void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x, void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
int src_y, int stride, int x, int y, int src_y, int stride, int x, int y,
@ -173,6 +174,7 @@ void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
{ {
lcd_alpha_bitmap_part_mix(NULL, src, src_x, src_y, x, y, width, height, 0, stride); lcd_alpha_bitmap_part_mix(NULL, src, src_x, src_y, x, y, width, height, 0, stride);
} }
#endif /* !DISABLE_ALPHA_BITMAP */
/* Draw a partial bitmap (mono or native) including alpha channel */ /* Draw a partial bitmap (mono or native) including alpha channel */
void ICODE_ATTR lcd_bmp_part(const struct bitmap* bm, int src_x, int src_y, void ICODE_ATTR lcd_bmp_part(const struct bitmap* bm, int src_x, int src_y,
@ -181,10 +183,12 @@ void ICODE_ATTR lcd_bmp_part(const struct bitmap* bm, int src_x, int src_y,
int bitmap_stride = LCD_FBSTRIDE(bm->width, bm->height); int bitmap_stride = LCD_FBSTRIDE(bm->width, bm->height);
if (bm->format == FORMAT_MONO) if (bm->format == FORMAT_MONO)
lcd_mono_bitmap_part(bm->data, src_x, src_y, bm->width, x, y, width, height); lcd_mono_bitmap_part(bm->data, src_x, src_y, bm->width, x, y, width, height);
#ifndef DISABLE_ALPHA_BITMAP
else if (bm->alpha_offset > 0) else if (bm->alpha_offset > 0)
lcd_alpha_bitmap_part_mix((fb_data*)bm->data, bm->data+bm->alpha_offset, lcd_alpha_bitmap_part_mix((fb_data*)bm->data, bm->data+bm->alpha_offset,
src_x, src_y, x, y, width, height, src_x, src_y, x, y, width, height,
bitmap_stride, ALIGN_UP(bm->width, 2)); bitmap_stride, ALIGN_UP(bm->width, 2));
#endif /* !DISABLE_ALPHA_BITMAP */
else else
lcd_bitmap_transparent_part((fb_data*)bm->data, lcd_bitmap_transparent_part((fb_data*)bm->data,
src_x, src_y, bitmap_stride, x, y, width, height); src_x, src_y, bitmap_stride, x, y, width, height);

View file

@ -65,14 +65,17 @@
#define HAVE_LCD_SLEEP #define HAVE_LCD_SLEEP
#define HAVE_LCD_SLEEP_SETTING #define HAVE_LCD_SLEEP_SETTING
*/ */
#endif
/* define this if you can flip your LCD */ /* define this if you can flip your LCD */
#define HAVE_LCD_FLIP #define HAVE_LCD_FLIP
/* define this if you can invert the colours on your LCD */ /* define this if you can invert the colours on your LCD */
#define HAVE_LCD_INVERT #define HAVE_LCD_INVERT
#else /* !BOOTLOADER */
#define DISABLE_ALPHA_BITMAP
#define DISABLE_LOGO
#define DISABLE_BACKTRACE
#endif /* !BOOTLOADER */
/* put the lcd frame buffer in IRAM */ /* put the lcd frame buffer in IRAM */
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR #define IRAM_LCDFRAMEBUFFER IBSS_ATTR

View file

@ -237,7 +237,7 @@ extern bool lcd_putsxy_scroll_func(int x, int y, const unsigned char *string,
/* performance function */ /* performance function */
#if defined(HAVE_LCD_COLOR) #if defined(HAVE_LCD_COLOR)
#if MEMORYSIZE > 2 #if MEMORYSIZE > 2 && !defined(BOOTLOADER)
#define LCD_YUV_DITHER 0x1 #define LCD_YUV_DITHER 0x1
extern void lcd_yuv_set_options(unsigned options); extern void lcd_yuv_set_options(unsigned options);
extern void lcd_blit_yuv(unsigned char * const src[3], extern void lcd_blit_yuv(unsigned char * const src[3],

View file

@ -266,8 +266,10 @@ static inline void cpu_boost_unlock(void)
/* Define this if target has support for generating backtraces */ /* Define this if target has support for generating backtraces */
#if defined(CPU_ARM) || \ #if defined(CPU_ARM) || \
(defined(CPU_MIPS) && (CONFIG_PLATFORM & PLATFORM_NATIVE)) (defined(CPU_MIPS) && (CONFIG_PLATFORM & PLATFORM_NATIVE))
#ifndef DISABLE_BACKTRACE
#define HAVE_RB_BACKTRACE #define HAVE_RB_BACKTRACE
#endif #endif
#endif
#ifndef MIN_STACK_ALIGN #ifndef MIN_STACK_ALIGN
#define MIN_STACK_ALIGN (sizeof (uintptr_t)) #define MIN_STACK_ALIGN (sizeof (uintptr_t))

View file

@ -46,7 +46,7 @@ static char panic_buf[128];
#define LINECHARS (LCD_WIDTH/SYSFONT_WIDTH) - 2 #define LINECHARS (LCD_WIDTH/SYSFONT_WIDTH) - 2
#if defined(CPU_ARM) #if defined(CPU_ARM) && defined(HAVE_RB_BACKTRACE)
void panicf_f( const char *fmt, ...); void panicf_f( const char *fmt, ...);
/* we wrap panicf() here with naked function to catch SP value */ /* we wrap panicf() here with naked function to catch SP value */

View file

@ -149,6 +149,7 @@ static void lcd_write_reg(int reg, int value)
void lcd_set_invert_display(bool yesno) void lcd_set_invert_display(bool yesno)
{ {
#ifdef HAVE_LCD_INVERT
r_disp_control_rev = yesno ? R_DISP_CONTROL_REV : r_disp_control_rev = yesno ? R_DISP_CONTROL_REV :
R_DISP_CONTROL_NORMAL; R_DISP_CONTROL_NORMAL;
@ -156,9 +157,13 @@ void lcd_set_invert_display(bool yesno)
{ {
lcd_write_reg(R_DISP_CONTROL1, 0x0033 | r_disp_control_rev); lcd_write_reg(R_DISP_CONTROL1, 0x0033 | r_disp_control_rev);
} }
#else
(void)yesno;
#endif
} }
#ifdef HAVE_LCD_FLIP
static bool display_flipped = false; static bool display_flipped = false;
/* turn the display upside down */ /* turn the display upside down */
@ -169,15 +174,19 @@ void lcd_set_flip(bool yesno)
r_entry_mode = yesno ? R_ENTRY_MODE_HORZ_FLIPPED : r_entry_mode = yesno ? R_ENTRY_MODE_HORZ_FLIPPED :
R_ENTRY_MODE_HORZ_NORMAL; R_ENTRY_MODE_HORZ_NORMAL;
} }
#endif // HAVE_LCD_FLIP
static void lcd_window(int xmin, int ymin, int xmax, int ymax) static void lcd_window(int xmin, int ymin, int xmax, int ymax)
{ {
#ifdef HAVE_LCD_FLIP
if (!display_flipped) if (!display_flipped)
#endif
{ {
lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin); lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin);
lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin);
lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | xmin); lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | xmin);
} }
#ifdef HAVE_LCD_FLIP
else else
{ {
lcd_write_reg(R_HORIZ_RAM_ADDR_POS, lcd_write_reg(R_HORIZ_RAM_ADDR_POS,
@ -187,6 +196,7 @@ static void lcd_window(int xmin, int ymin, int xmax, int ymax)
lcd_write_reg(R_RAM_ADDR_SET, lcd_write_reg(R_RAM_ADDR_SET,
((LCD_HEIGHT-1 - ymin) << 8) | (LCD_WIDTH-1 - xmin)); ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_WIDTH-1 - xmin));
} }
#endif // HAVE_LCD_FLIP
} }
static void _display_on(void) static void _display_on(void)
@ -431,7 +441,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
} }
} }
#endif #endif /* !BOOTLOADER */
/* Update the display. /* Update the display.

View file

@ -145,11 +145,15 @@ void NORETURN_ATTR UIE(unsigned int pc, unsigned int num)
} /* num == 1 || num == 2 // prefetch/data abort */ } /* num == 1 || num == 2 // prefetch/data abort */
#endif /* !defined(CPU_ARM7TDMI */ #endif /* !defined(CPU_ARM7TDMI */
#ifdef HAVE_RB_BACKTRACE
if (!triggered) if (!triggered)
{ {
triggered = true; triggered = true;
rb_backtrace(pc, __get_sp(), &line); rb_backtrace(pc, __get_sp(), &line);
} }
#else
(void)triggered;
#endif
lcd_update(); lcd_update();