summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Artiukhin <bahusdrive@gmail.com>2024-02-19 13:59:51 +0200
committerAidan MacDonald <amachronic@protonmail.com>2024-04-01 11:02:04 -0400
commitc36d7768c539921754dd26ded343a08e11ccc0f0 (patch)
tree2001649699a6d646f6d2fc4ec5400841ee293277
parent2570909e52b4121d69b0bc6638af8882dae87176 (diff)
downloadrockbox-c36d7768c5.tar.gz
rockbox-c36d7768c5.zip
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
-rw-r--r--bootloader/show_logo.c5
-rw-r--r--firmware/drivers/lcd-16bit-common.c3
-rw-r--r--firmware/drivers/lcd-16bit-vert.c2
-rw-r--r--firmware/drivers/lcd-16bit.c3
-rw-r--r--firmware/drivers/lcd-24bit.c4
-rw-r--r--firmware/drivers/lcd-bitmap-common.c2
-rw-r--r--firmware/drivers/lcd-color-common.c4
-rw-r--r--firmware/export/config/sansae200v2.h7
-rw-r--r--firmware/export/lcd.h2
-rw-r--r--firmware/export/system.h2
-rw-r--r--firmware/panic.c2
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c12
-rw-r--r--firmware/target/arm/system-arm.c4
13 files changed, 41 insertions, 11 deletions
diff --git a/bootloader/show_logo.c b/bootloader/show_logo.c
index 6584e3f24d..cafcb45dcf 100644
--- a/bootloader/show_logo.c
+++ b/bootloader/show_logo.c
@@ -25,8 +25,9 @@
#include <string.h>
#include "version.h"
+#ifndef DISABLE_LOGO
#include "bitmaps/rockboxlogo.h"
-
+#endif
#if LCD_WIDTH <= 128
#define BOOT_VERFMT "Boot %s"
#else
@@ -54,7 +55,9 @@ void show_logo( void )
lcd_putsxy(text_xpos, 0, verstr);
lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 16);
#else
+#ifndef DISABLE_LOGO
lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 10);
+#endif
lcd_putsxy(text_xpos, LCD_HEIGHT-SYSFONT_HEIGHT, verstr);
#endif
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c
index 9d24dfe16e..ab136bf238 100644
--- a/firmware/drivers/lcd-16bit-common.c
+++ b/firmware/drivers/lcd-16bit-common.c
@@ -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);
}
-
+#ifndef DISABLE_ALPHA_BITMAP
/* About Rockbox' internal alpha channel format (for ALPHA_BPP == 4)
*
* 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;
}
+#endif /* !DISABLE_ALPHA_BITMAP */ \ No newline at end of file
diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c
index d4ad218d14..6532ea5121 100644
--- a/firmware/drivers/lcd-16bit-vert.c
+++ b/firmware/drivers/lcd-16bit-vert.c
@@ -47,11 +47,13 @@
extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[];
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,
const unsigned char *src, int src_x,
int src_y, int x, int y,
int width, int height,
int stride_image, int stride_src);
+#endif /* !DISABLE_ALPHA_BITMAP */
#include "lcd-color-common.c"
#include "lcd-bitmap-common.c"
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index fbf6700f28..967878b2e4 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -47,12 +47,13 @@
extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[];
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,
const unsigned char *src, int src_x,
int src_y, int x, int y,
int width, int height,
int stride_image, int stride_src);
-
+#endif /* !DISABLE_ALPHA_BITMAP */
#include "lcd-color-common.c"
#include "lcd-bitmap-common.c"
#include "lcd-16bit-common.c"
diff --git a/firmware/drivers/lcd-24bit.c b/firmware/drivers/lcd-24bit.c
index dbb7e543af..64ddf4a201 100644
--- a/firmware/drivers/lcd-24bit.c
+++ b/firmware/drivers/lcd-24bit.c
@@ -47,13 +47,13 @@
extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[];
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,
const unsigned char *src, int src_x,
int src_y, int x, int y,
int width, int height,
int stride_image, int stride_src);
-
+#endif /* !DISABLE_ALPHA_BITMAP */
#include "lcd-color-common.c"
#include "lcd-bitmap-common.c"
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index 975c494b5a..75d31e3453 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -563,7 +563,7 @@ static void LCDFN(putsxyofs)(int x, int y, int ofs, const unsigned char *str)
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)
lcd_alpha_bitmap_part(bits, ofs, 0, width, x, y,
width - ofs, pf->height);
diff --git a/firmware/drivers/lcd-color-common.c b/firmware/drivers/lcd-color-common.c
index 5f83160dab..1ec965d816 100644
--- a/firmware/drivers/lcd-color-common.c
+++ b/firmware/drivers/lcd-color-common.c
@@ -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);
}
+#ifndef DISABLE_ALPHA_BITMAP
/* draw alpha bitmap for anti-alias font */
void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x,
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);
}
+#endif /* !DISABLE_ALPHA_BITMAP */
/* 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,
@@ -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);
if (bm->format == FORMAT_MONO)
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)
lcd_alpha_bitmap_part_mix((fb_data*)bm->data, bm->data+bm->alpha_offset,
src_x, src_y, x, y, width, height,
bitmap_stride, ALIGN_UP(bm->width, 2));
+#endif /* !DISABLE_ALPHA_BITMAP */
else
lcd_bitmap_transparent_part((fb_data*)bm->data,
src_x, src_y, bitmap_stride, x, y, width, height);
diff --git a/firmware/export/config/sansae200v2.h b/firmware/export/config/sansae200v2.h
index 00833d56a6..e7ff291cc7 100644
--- a/firmware/export/config/sansae200v2.h
+++ b/firmware/export/config/sansae200v2.h
@@ -65,14 +65,17 @@
#define HAVE_LCD_SLEEP
#define HAVE_LCD_SLEEP_SETTING
*/
-#endif
/* define this if you can flip your LCD */
#define HAVE_LCD_FLIP
/* define this if you can invert the colours on your LCD */
#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 */
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 67b22190ad..05d12cc2ec 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -237,7 +237,7 @@ extern bool lcd_putsxy_scroll_func(int x, int y, const unsigned char *string,
/* performance function */
#if defined(HAVE_LCD_COLOR)
-#if MEMORYSIZE > 2
+#if MEMORYSIZE > 2 && !defined(BOOTLOADER)
#define LCD_YUV_DITHER 0x1
extern void lcd_yuv_set_options(unsigned options);
extern void lcd_blit_yuv(unsigned char * const src[3],
diff --git a/firmware/export/system.h b/firmware/export/system.h
index 172fe05b6e..552540a1db 100644
--- a/firmware/export/system.h
+++ b/firmware/export/system.h
@@ -266,8 +266,10 @@ static inline void cpu_boost_unlock(void)
/* Define this if target has support for generating backtraces */
#if defined(CPU_ARM) || \
(defined(CPU_MIPS) && (CONFIG_PLATFORM & PLATFORM_NATIVE))
+#ifndef DISABLE_BACKTRACE
#define HAVE_RB_BACKTRACE
#endif
+#endif
#ifndef MIN_STACK_ALIGN
#define MIN_STACK_ALIGN (sizeof (uintptr_t))
diff --git a/firmware/panic.c b/firmware/panic.c
index d7f330caf1..bbe241a26d 100644
--- a/firmware/panic.c
+++ b/firmware/panic.c
@@ -46,7 +46,7 @@ static char panic_buf[128];
#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, ...);
/* we wrap panicf() here with naked function to catch SP value */
diff --git a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
index f69ad48793..1344ea6fa8 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
+++ b/firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
@@ -149,6 +149,7 @@ static void lcd_write_reg(int reg, int value)
void lcd_set_invert_display(bool yesno)
{
+#ifdef HAVE_LCD_INVERT
r_disp_control_rev = yesno ? R_DISP_CONTROL_REV :
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);
}
+#else
+ (void)yesno;
+#endif
}
+#ifdef HAVE_LCD_FLIP
static bool display_flipped = false;
/* 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_HORZ_NORMAL;
}
+#endif // HAVE_LCD_FLIP
static void lcd_window(int xmin, int ymin, int xmax, int ymax)
{
+#ifdef HAVE_LCD_FLIP
if (!display_flipped)
+#endif
{
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_RAM_ADDR_SET, (ymin << 8) | xmin);
}
+#ifdef HAVE_LCD_FLIP
else
{
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_HEIGHT-1 - ymin) << 8) | (LCD_WIDTH-1 - xmin));
}
+#endif // HAVE_LCD_FLIP
}
static void _display_on(void)
@@ -431,7 +441,7 @@ void lcd_blit_yuv(unsigned char * const src[3],
}
}
-#endif
+#endif /* !BOOTLOADER */
/* Update the display.
diff --git a/firmware/target/arm/system-arm.c b/firmware/target/arm/system-arm.c
index 74df5ed277..41d0cce723 100644
--- a/firmware/target/arm/system-arm.c
+++ b/firmware/target/arm/system-arm.c
@@ -145,11 +145,15 @@ void NORETURN_ATTR UIE(unsigned int pc, unsigned int num)
} /* num == 1 || num == 2 // prefetch/data abort */
#endif /* !defined(CPU_ARM7TDMI */
+#ifdef HAVE_RB_BACKTRACE
if (!triggered)
{
triggered = true;
rb_backtrace(pc, __get_sp(), &line);
}
+#else
+ (void)triggered;
+#endif
lcd_update();