compiler flag optimization, issue #364

This commit is contained in:
kraus 2018-10-28 08:43:18 +01:00
parent 6425d2f179
commit 8e0fbc5eef
4 changed files with 43 additions and 33 deletions

View File

@ -72,6 +72,7 @@
//#define U8G2_16BIT //#define U8G2_16BIT
/* /*
The following macro enables a special check and optimization The following macro enables a special check and optimization
in the HVLine procedure for lines with one pixel length. in the HVLine procedure for lines with one pixel length.
@ -80,7 +81,25 @@
27 Oct 2018: The one pixel optimization is removed, it does not have any effect 27 Oct 2018: The one pixel optimization is removed, it does not have any effect
*/ */
#define U8G2_WITH_ONE_PIXEL_OPTIMIZATION //#define U8G2_WITH_ONE_PIXEL_OPTIMIZATION
/*
The following macro enables the HVLine speed optimization.
It will consume about 40 bytes more in flash memory of the AVR.
HVLine procedures are also used by the text drawing functions.
*/
#define U8G2_WITH_HVLINE_SPEED_OPTIMIZATION
/*
The following macro activates the early intersection check with the current visible area.
Clipping (and low level intersection calculation) will still happen and is controlled by U8G2_WITH_CLIPPING.
This early intersection check only improves speed for the picture loop (u8g2_FirstPage/NextPage).
With a full framebuffer in RAM and if most graphical elements are drawn within the visible area, then this
macro can be commented to reduce code size.
*/
#define U8G2_WITH_INTERSECTION
/* /*
Enable clip window support: Enable clip window support:
@ -91,29 +110,12 @@
*/ */
#define U8G2_WITH_CLIP_WINDOW_SUPPORT #define U8G2_WITH_CLIP_WINDOW_SUPPORT
/*
The following macro enables the HVLine speed optimization.
It will consume about 40 bytes more in flash memory of the AVR.
HVLine procedures are also used by the text drawing functions.
*/
#define U8G2_HVLINE_SPEED_OPTIMIZATION
/* /*
The following macro enables all four drawing directions for glyphs and strings. The following macro enables all four drawing directions for glyphs and strings.
If this macro is not defined, than a string can be drawn only in horizontal direction. If this macro is not defined, than a string can be drawn only in horizontal direction.
*/ */
#define U8G2_WITH_FONT_ROTATION #define U8G2_WITH_FONT_ROTATION
/*
The following macro activates the early intersection check with the current visible area.
Clipping (and low level intersection calculation) will still happen and is controlled by U8G2_WITH_CLIPPING.
This early intersection check only improves speed for the picture loop (u8g2_FirstPage/NextPage).
With a full framebuffer in RAM and if most graphical elements are drawn within the visible area, then this
macro can be commented to reduce code size.
*/
#define U8G2_WITH_INTERSECTION
/* /*
U8glib V2 contains support for unicode plane 0 (Basic Multilingual Plane, BMP). U8glib V2 contains support for unicode plane 0 (Basic Multilingual Plane, BMP).
The following macro activates this support. Deactivation would save some ROM. The following macro activates this support. Deactivation would save some ROM.

View File

@ -44,7 +44,7 @@
#endif #endif
#ifdef U8G2_WITH_INTERSECTION #if defined(U8G2_WITH_INTERSECTION) || defined(U8G2_WITH_CLIP_WINDOW_SUPPORT)
#ifdef OLD_VERSION_WITH_SYMETRIC_BOUNDARIES #ifdef OLD_VERSION_WITH_SYMETRIC_BOUNDARIES

View File

@ -59,7 +59,7 @@
*/ */
#ifdef U8G2_HVLINE_SPEED_OPTIMIZATION #ifdef U8G2_WITH_HVLINE_SPEED_OPTIMIZATION
/* /*
x,y Upper left position of the line within the local buffer (not the display!) x,y Upper left position of the line within the local buffer (not the display!)
@ -153,7 +153,7 @@ void u8g2_ll_hvline_vertical_top_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y,
#else /* U8G2_HVLINE_SPEED_OPTIMIZATION */ #else /* U8G2_WITH_HVLINE_SPEED_OPTIMIZATION */
/* /*
x,y position within the buffer x,y position within the buffer
@ -221,7 +221,7 @@ void u8g2_ll_hvline_vertical_top_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y,
} }
#endif /* U8G2_HVLINE_SPEED_OPTIMIZATION */ #endif /* U8G2_WITH_HVLINE_SPEED_OPTIMIZATION */
/*=================================================*/ /*=================================================*/
/* /*
@ -229,7 +229,7 @@ void u8g2_ll_hvline_vertical_top_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y,
ST7920 ST7920
*/ */
#ifdef U8G2_HVLINE_SPEED_OPTIMIZATION #ifdef U8G2_WITH_HVLINE_SPEED_OPTIMIZATION
/* /*
x,y Upper left position of the line within the local buffer (not the display!) x,y Upper left position of the line within the local buffer (not the display!)
@ -297,7 +297,7 @@ void u8g2_ll_hvline_horizontal_right_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_
} }
} }
#else /* U8G2_HVLINE_SPEED_OPTIMIZATION */ #else /* U8G2_WITH_HVLINE_SPEED_OPTIMIZATION */
/* /*
@ -365,4 +365,4 @@ void u8g2_ll_hvline_horizontal_right_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_
} }
} }
#endif /* U8G2_HVLINE_SPEED_OPTIMIZATION */ #endif /* U8G2_WITH_HVLINE_SPEED_OPTIMIZATION */

View File

@ -32,15 +32,23 @@
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 Oct 2018: 27 Oct 2018:
U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2 U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2
make -f Makefile.184.uno make -f Makefile.184.uno
text data bss dec hex filename
8440 152 420 9012 2334 HelloWorld.elf text
8732 default, all active
8500 -232 -2.65% no U8G2_WITH_CLIP_WINDOW_SUPPORT
8316 -416 -4.76% no U8G2_WITH_FONT_ROTATION
8606 -126 -1.44% no U8G2_WITH_UNICODE
8692 -40 -0.45% no U8G2_WITH_INTERSECTION
8328 -404 -4.62% no U8G2_WITH_INTERSECTION no U8G2_WITH_CLIP_WINDOW_SUPPORT
8718 -14 -4.86% no U8G2_WITH_HVLINE_SPEED_OPTIMIZATION
8026 -706 -8.08% no U8G2_WITH_FONT_ROTATION no U8G2_WITH_INTERSECTION no U8G2_WITH_CLIP_WINDOW_SUPPORT
Some flags depend on each other: `U8G2_WITH_INTERSECTION` is required for `U8G2_WITH_CLIP_WINDOW_SUPPORT`, so `U8G2_WITH_INTERSECTION` is partly active as long
as `U8G2_WITH_CLIP_WINDOW_SUPPORT` is requested.
8422
8470
8676
*/ */
#include <Arduino.h> #include <Arduino.h>
@ -69,8 +77,8 @@
// Please update the pin numbers according to your setup. Use U8X8_PIN_NONE if the reset pin is not connected // Please update the pin numbers according to your setup. Use U8X8_PIN_NONE if the reset pin is not connected
//U8G2_NULL u8g2(U8G2_R0); // null device, a 8x8 pixel display which does nothing //U8G2_NULL u8g2(U8G2_R0); // null device, a 8x8 pixel display which does nothing
//U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6); // Arduboy (Production, Kickstarter Edition) //U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 12, /* dc=*/ 4, /* reset=*/ 6); // Arduboy (Production, Kickstarter Edition)
//U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); U8G2_SSD1306_128X64_NONAME_1_4W_HW_SPI u8g2(U8G2_R0, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);
//U8G2_SSD1306_128X64_NONAME_1_3W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* reset=*/ 8); //U8G2_SSD1306_128X64_NONAME_1_3W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* reset=*/ 8);
//U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); //U8G2_SSD1306_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
//U8G2_SSD1306_128X64_ALT0_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // same as the NONAME variant, but may solve the "every 2nd line skipped" problem //U8G2_SSD1306_128X64_ALT0_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // same as the NONAME variant, but may solve the "every 2nd line skipped" problem