A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

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

authored by

Roman Artiukhin and committed by
Aidan MacDonald
c36d7768 2570909e

+41 -11
+4 -1
bootloader/show_logo.c
··· 25 25 #include <string.h> 26 26 #include "version.h" 27 27 28 + #ifndef DISABLE_LOGO 28 29 #include "bitmaps/rockboxlogo.h" 29 - 30 + #endif 30 31 #if LCD_WIDTH <= 128 31 32 #define BOOT_VERFMT "Boot %s" 32 33 #else ··· 54 55 lcd_putsxy(text_xpos, 0, verstr); 55 56 lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 16); 56 57 #else 58 + #ifndef DISABLE_LOGO 57 59 lcd_bmp(&bm_rockboxlogo, LOGO_XPOS, 10); 60 + #endif 58 61 lcd_putsxy(text_xpos, LCD_HEIGHT-SYSFONT_HEIGHT, verstr); 59 62 #endif 60 63
+2 -1
firmware/drivers/lcd-16bit-common.c
··· 335 335 lcd_mono_bitmap_part(src, 0, 0, width, x, y, width, height); 336 336 } 337 337 338 - 338 + #ifndef DISABLE_ALPHA_BITMAP 339 339 /* About Rockbox' internal alpha channel format (for ALPHA_BPP == 4) 340 340 * 341 341 * For each pixel, 4bit of alpha information is stored in a byte-stream, ··· 654 654 655 655 BLEND_FINISH; 656 656 } 657 + #endif /* !DISABLE_ALPHA_BITMAP */
+2
firmware/drivers/lcd-16bit-vert.c
··· 47 47 extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[]; 48 48 extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[]; 49 49 50 + #ifndef DISABLE_ALPHA_BITMAP 50 51 static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, 51 52 const unsigned char *src, int src_x, 52 53 int src_y, int x, int y, 53 54 int width, int height, 54 55 int stride_image, int stride_src); 56 + #endif /* !DISABLE_ALPHA_BITMAP */ 55 57 56 58 #include "lcd-color-common.c" 57 59 #include "lcd-bitmap-common.c"
+2 -1
firmware/drivers/lcd-16bit.c
··· 47 47 extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[]; 48 48 extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[]; 49 49 50 + #ifndef DISABLE_ALPHA_BITMAP 50 51 static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, 51 52 const unsigned char *src, int src_x, 52 53 int src_y, int x, int y, 53 54 int width, int height, 54 55 int stride_image, int stride_src); 55 - 56 + #endif /* !DISABLE_ALPHA_BITMAP */ 56 57 #include "lcd-color-common.c" 57 58 #include "lcd-bitmap-common.c" 58 59 #include "lcd-16bit-common.c"
+2 -2
firmware/drivers/lcd-24bit.c
··· 47 47 48 48 extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[]; 49 49 extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_bgcolor[]; 50 - 50 + #ifndef DISABLE_ALPHA_BITMAP 51 51 static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, 52 52 const unsigned char *src, int src_x, 53 53 int src_y, int x, int y, 54 54 int width, int height, 55 55 int stride_image, int stride_src); 56 - 56 + #endif /* !DISABLE_ALPHA_BITMAP */ 57 57 #include "lcd-color-common.c" 58 58 #include "lcd-bitmap-common.c" 59 59
+1 -1
firmware/drivers/lcd-bitmap-common.c
··· 563 563 564 564 bits = font_get_bits(pf, *ucs); 565 565 566 - #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) 566 + #if defined(MAIN_LCD) && defined(HAVE_LCD_COLOR) && !defined(DISABLE_ALPHA_BITMAP) 567 567 if (pf->depth) 568 568 lcd_alpha_bitmap_part(bits, ofs, 0, width, x, y, 569 569 width - ofs, pf->height);
+4
firmware/drivers/lcd-color-common.c
··· 166 166 STRIDE(SCREEN_MAIN, width, height), x, y, width, height); 167 167 } 168 168 169 + #ifndef DISABLE_ALPHA_BITMAP 169 170 /* draw alpha bitmap for anti-alias font */ 170 171 void ICODE_ATTR lcd_alpha_bitmap_part(const unsigned char *src, int src_x, 171 172 int src_y, int stride, int x, int y, ··· 173 174 { 174 175 lcd_alpha_bitmap_part_mix(NULL, src, src_x, src_y, x, y, width, height, 0, stride); 175 176 } 177 + #endif /* !DISABLE_ALPHA_BITMAP */ 176 178 177 179 /* Draw a partial bitmap (mono or native) including alpha channel */ 178 180 void ICODE_ATTR lcd_bmp_part(const struct bitmap* bm, int src_x, int src_y, ··· 181 183 int bitmap_stride = LCD_FBSTRIDE(bm->width, bm->height); 182 184 if (bm->format == FORMAT_MONO) 183 185 lcd_mono_bitmap_part(bm->data, src_x, src_y, bm->width, x, y, width, height); 186 + #ifndef DISABLE_ALPHA_BITMAP 184 187 else if (bm->alpha_offset > 0) 185 188 lcd_alpha_bitmap_part_mix((fb_data*)bm->data, bm->data+bm->alpha_offset, 186 189 src_x, src_y, x, y, width, height, 187 190 bitmap_stride, ALIGN_UP(bm->width, 2)); 191 + #endif /* !DISABLE_ALPHA_BITMAP */ 188 192 else 189 193 lcd_bitmap_transparent_part((fb_data*)bm->data, 190 194 src_x, src_y, bitmap_stride, x, y, width, height);
+5 -2
firmware/export/config/sansae200v2.h
··· 65 65 #define HAVE_LCD_SLEEP 66 66 #define HAVE_LCD_SLEEP_SETTING 67 67 */ 68 - #endif 69 68 70 69 /* define this if you can flip your LCD */ 71 70 #define HAVE_LCD_FLIP 72 71 73 72 /* define this if you can invert the colours on your LCD */ 74 73 #define HAVE_LCD_INVERT 75 - 74 + #else /* !BOOTLOADER */ 75 + #define DISABLE_ALPHA_BITMAP 76 + #define DISABLE_LOGO 77 + #define DISABLE_BACKTRACE 78 + #endif /* !BOOTLOADER */ 76 79 /* put the lcd frame buffer in IRAM */ 77 80 #define IRAM_LCDFRAMEBUFFER IBSS_ATTR 78 81
+1 -1
firmware/export/lcd.h
··· 237 237 238 238 /* performance function */ 239 239 #if defined(HAVE_LCD_COLOR) 240 - #if MEMORYSIZE > 2 240 + #if MEMORYSIZE > 2 && !defined(BOOTLOADER) 241 241 #define LCD_YUV_DITHER 0x1 242 242 extern void lcd_yuv_set_options(unsigned options); 243 243 extern void lcd_blit_yuv(unsigned char * const src[3],
+2
firmware/export/system.h
··· 266 266 /* Define this if target has support for generating backtraces */ 267 267 #if defined(CPU_ARM) || \ 268 268 (defined(CPU_MIPS) && (CONFIG_PLATFORM & PLATFORM_NATIVE)) 269 + #ifndef DISABLE_BACKTRACE 269 270 #define HAVE_RB_BACKTRACE 271 + #endif 270 272 #endif 271 273 272 274 #ifndef MIN_STACK_ALIGN
+1 -1
firmware/panic.c
··· 46 46 47 47 #define LINECHARS (LCD_WIDTH/SYSFONT_WIDTH) - 2 48 48 49 - #if defined(CPU_ARM) 49 + #if defined(CPU_ARM) && defined(HAVE_RB_BACKTRACE) 50 50 void panicf_f( const char *fmt, ...); 51 51 52 52 /* we wrap panicf() here with naked function to catch SP value */
+11 -1
firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
··· 149 149 150 150 void lcd_set_invert_display(bool yesno) 151 151 { 152 + #ifdef HAVE_LCD_INVERT 152 153 r_disp_control_rev = yesno ? R_DISP_CONTROL_REV : 153 154 R_DISP_CONTROL_NORMAL; 154 155 ··· 156 157 { 157 158 lcd_write_reg(R_DISP_CONTROL1, 0x0033 | r_disp_control_rev); 158 159 } 160 + #else 161 + (void)yesno; 162 + #endif 159 163 160 164 } 161 165 166 + #ifdef HAVE_LCD_FLIP 162 167 static bool display_flipped = false; 163 168 164 169 /* turn the display upside down */ ··· 169 174 r_entry_mode = yesno ? R_ENTRY_MODE_HORZ_FLIPPED : 170 175 R_ENTRY_MODE_HORZ_NORMAL; 171 176 } 177 + #endif // HAVE_LCD_FLIP 172 178 173 179 static void lcd_window(int xmin, int ymin, int xmax, int ymax) 174 180 { 181 + #ifdef HAVE_LCD_FLIP 175 182 if (!display_flipped) 183 + #endif 176 184 { 177 185 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin); 178 186 lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); 179 187 lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | xmin); 180 188 } 189 + #ifdef HAVE_LCD_FLIP 181 190 else 182 191 { 183 192 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, ··· 187 196 lcd_write_reg(R_RAM_ADDR_SET, 188 197 ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_WIDTH-1 - xmin)); 189 198 } 199 + #endif // HAVE_LCD_FLIP 190 200 } 191 201 192 202 static void _display_on(void) ··· 431 441 } 432 442 } 433 443 434 - #endif 444 + #endif /* !BOOTLOADER */ 435 445 436 446 437 447 /* Update the display.
+4
firmware/target/arm/system-arm.c
··· 145 145 } /* num == 1 || num == 2 // prefetch/data abort */ 146 146 #endif /* !defined(CPU_ARM7TDMI */ 147 147 148 + #ifdef HAVE_RB_BACKTRACE 148 149 if (!triggered) 149 150 { 150 151 triggered = true; 151 152 rb_backtrace(pc, __get_sp(), &line); 152 153 } 154 + #else 155 + (void)triggered; 156 + #endif 153 157 154 158 lcd_update(); 155 159