[Horus] Bitmaps must be word aligned!

This commit is contained in:
Bertrand Songis
2016-01-09 01:05:09 +01:00
parent 87f8ea516b
commit 1ff32c64f5
9 changed files with 44 additions and 38 deletions
+3 -2
View File
@@ -743,10 +743,10 @@ if(ARCH STREQUAL ARM)
set(CMAKE_SYSTEM_VERSION 1) set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -o <OBJECT> <SOURCE>") set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -o <OBJECT> <SOURCE>")
set(COMMON_FLAGS "-mcpu=${MCU} -mthumb -fomit-frame-pointer -fverbose-asm -Wa,-ahlms=opentx.lst -O${OPT} -gdwarf-2 -DHSE_VALUE=${HSE_VALUE} -fno-exceptions -fdata-sections -ffunction-sections ${WARNING_FLAGS}") set(COMMON_FLAGS "-mcpu=${MCU} -mthumb -fomit-frame-pointer -fverbose-asm -Wa,-ahlms=firmware.lst -O${OPT} -gdwarf-2 -DHSE_VALUE=${HSE_VALUE} -fno-exceptions -fdata-sections -ffunction-sections ${WARNING_FLAGS}")
set(CMAKE_C_FLAGS "${COMMON_FLAGS} -Wimplicit") set(CMAKE_C_FLAGS "${COMMON_FLAGS} -Wimplicit")
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS}") set(CMAKE_CXX_FLAGS "${COMMON_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -nostartfiles -lm -T${RADIO_SRC_DIRECTORY}/${LINKER_SCRIPT} -Wl,-Map=opentx.map,--cref,--no-warn-mismatch,--gc-sections") set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${MCU} -mthumb -nostartfiles -lm -T${RADIO_SRC_DIRECTORY}/${LINKER_SCRIPT} -Wl,-Map=firmware.map,--cref,--no-warn-mismatch,--gc-sections")
if(PCB STREQUAL TARANIS) if(PCB STREQUAL TARANIS)
add_subdirectory(targets/${TARGET_DIR}/bootloader) add_subdirectory(targets/${TARGET_DIR}/bootloader)
@@ -808,6 +808,7 @@ endif()
add_custom_target(firmware.lss add_custom_target(firmware.lss
COMMAND avr-objdump -h -S firmware.elf > firmware.lss COMMAND avr-objdump -h -S firmware.elf > firmware.lss
DEPENDS firmware.elf DEPENDS firmware.elf
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
) )
if(CPU_FAMILY STREQUAL STM32) if(CPU_FAMILY STREQUAL STM32)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

+16 -16
View File
@@ -200,31 +200,31 @@ const uint8_t * const LBM_MODEL_ICONS[] = {
* Model selection screen bitmaps * Model selection screen bitmaps
*/ */
const uint8_t LBM_LIBRARY_ICON[] = { const uint8_t LBM_LIBRARY_ICON[] __attribute__((aligned(32))) = {
#include "mask_library.lbm" #include "mask_library.lbm"
}; };
const uint8_t LBM_LIBRARY_SLOT[] = { const uint8_t LBM_LIBRARY_SLOT[] __attribute__((aligned(32))) = {
#include "mask_library_slot.lbm" #include "mask_library_slot.lbm"
}; };
const uint8_t LBM_LIBRARY_CURSOR[] = { const uint8_t LBM_LIBRARY_CURSOR[] __attribute__((aligned(32))) = {
#include "mask_library_category_index.lbm" #include "mask_library_category_index.lbm"
}; };
const uint8_t LBM_SCORE0[] = { const uint8_t LBM_SCORE0[] __attribute__((aligned(32))) = {
#include "mask_library_score_0.lbm" #include "mask_library_score_0.lbm"
}; };
const uint8_t LBM_SCORE1[] = { const uint8_t LBM_SCORE1[] __attribute__((aligned(32))) = {
#include "mask_library_score_1.lbm" #include "mask_library_score_1.lbm"
}; };
const uint8_t LBM_STAR0[] = { const uint8_t LBM_STAR0[] __attribute__((aligned(32))) = {
#include "mask_library_star_0.lbm" #include "mask_library_star_0.lbm"
}; };
const uint8_t LBM_STAR1[] = { const uint8_t LBM_STAR1[] __attribute__((aligned(32))) = {
#include "mask_library_star_1.lbm" #include "mask_library_star_1.lbm"
}; };
@@ -232,30 +232,30 @@ const uint8_t LBM_STAR1[] = {
* Other * Other
*/ */
const uint8_t LBM_ASTERISK[] = { const uint8_t LBM_ASTERISK[] __attribute__((aligned(32))) = {
#include "asterisk.lbm" #include "asterisk.lbm"
}; };
const uint8_t LBM_POINT[] = { const uint8_t LBM_POINT[] __attribute__((aligned(32))) = {
#include "mask_point.lbm" #include "mask_point.lbm"
}; };
const uint8_t LBM_CURVE_POINT[] = { const uint8_t LBM_CURVE_POINT[] __attribute__((aligned(32))) = {
#include "mask_cvpoint.lbm" #include "mask_cvpoint.lbm"
}; };
const uint8_t LBM_CURVE_POINT_CENTER[] = { const uint8_t LBM_CURVE_POINT_CENTER[] __attribute__((aligned(32))) = {
#include "mask_cvpoint_center.lbm" #include "mask_cvpoint_center.lbm"
}; };
const uint8_t LBM_CURVE_COORD_SHADOW[] = { const uint8_t LBM_CURVE_COORD_SHADOW[] __attribute__((aligned(32))) = {
#include "mask_coord_shadow.lbm" #include "mask_coord_shadow.lbm"
}; };
/*
const uint8_t LBM_SHUTDOWN[] = { const uint8_t LBM_SHUTDOWN[] __attribute__((aligned(32))) = {
#include "shutdown.lbm" #include "shutdown.lbm"
}; };
const uint8_t LBM_SLEEP[] = { const uint8_t LBM_SLEEP[] __attribute__((aligned(32))) = {
#include "sleep.lbm" #include "sleep.lbm"
}; */ };
+1
View File
@@ -119,6 +119,7 @@ extern const uint8_t LBM_STAR0[];
extern const uint8_t LBM_STAR1[]; extern const uint8_t LBM_STAR1[];
// Other icons // Other icons
extern const uint8_t LBM_SPLASH[];
extern const uint8_t LBM_ASTERISK[]; extern const uint8_t LBM_ASTERISK[];
extern const uint8_t LBM_POINT[]; extern const uint8_t LBM_POINT[];
extern const uint8_t LBM_CURVE_POINT[]; extern const uint8_t LBM_CURVE_POINT[];
+10 -10
View File
@@ -870,17 +870,17 @@ inline void lcdDrawBitmapDMA(coord_t x, coord_t y, coord_t width, coord_t height
#endif #endif
#if !defined(BOOT) #if !defined(BOOT)
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, coord_t width, int scale) void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, coord_t height, int scale)
{ {
int w = getBitmapWidth(bmp); int width = getBitmapWidth(bmp);
int height = getBitmapHeight(bmp); int h = getBitmapHeight(bmp);
if (!width || width > w) { if (!height || height > h) {
width = w; height = h;
} }
if (x+width > LCD_W) { if (x+height > LCD_W) {
width = LCD_W-x; height = LCD_W-x;
} }
if (width == 0 || height == 0) { if (width == 0 || height == 0) {
@@ -888,12 +888,12 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, co
} }
if (scale == 0) { if (scale == 0) {
lcdDrawBitmapDMA(x, y, width, height, bmp+4); lcdDrawBitmapDMA(x, y, width, height, bmp + 4 + offset*width*2);
} }
else if (scale < 0) { else if (scale < 0) {
for (coord_t i=0, row=0; row<height; i+=1, row-=scale) { for (coord_t i=0, row=0; row<height; i+=1, row-=scale) {
display_t * p = &displayBuf[(y+i)*LCD_W + x]; display_t * p = &displayBuf[(y+i)*LCD_W + x];
const uint8_t * q = bmp + 4 + (row*w + offset) * 2; const uint8_t * q = bmp + 4 + (offset+row)*width*2;
for (coord_t col=0; col<width; col-=scale) { for (coord_t col=0; col<width; col-=scale) {
lcdDrawPixel(p, *((uint16_t *)q)); lcdDrawPixel(p, *((uint16_t *)q));
p++; q-=2*scale; p++; q-=2*scale;
@@ -904,7 +904,7 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, co
for (coord_t row=0; row<height; row++) { for (coord_t row=0; row<height; row++) {
for (int i=0; i<scale; i++) { for (int i=0; i<scale; i++) {
display_t * p = &displayBuf[(y+scale*row+i)*LCD_W + x]; display_t * p = &displayBuf[(y+scale*row+i)*LCD_W + x];
const uint8_t * q = bmp + 4 + (row*w + offset) * 2; const uint8_t * q = bmp + 4 + (offset+row)*width*2;
for (coord_t col=0; col<width; col++) { for (coord_t col=0; col<width; col++) {
for (int j=0; j<scale; j++) { for (int j=0; j<scale; j++) {
lcdDrawPixel(p, *((uint16_t *)q)); lcdDrawPixel(p, *((uint16_t *)q));
+1 -1
View File
@@ -303,7 +303,7 @@ inline int getBitmapScaledSize(int size, int scale)
int getBitmapScale(const uint8_t * bmp, int dstWidth, int dstHeight); int getBitmapScale(const uint8_t * bmp, int dstWidth, int dstHeight);
int getTextWidth(const pm_char *s, int len=0, LcdFlags flags=0); int getTextWidth(const pm_char *s, int len=0, LcdFlags flags=0);
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_t width=0, int scale=0); void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_t height=0, int scale=0);
void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags flags=0, coord_t offset=0, coord_t width=0); void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags flags=0, coord_t offset=0, coord_t width=0);
#define lcdSetRefVolt(...) #define lcdSetRefVolt(...)
+2 -2
View File
@@ -20,8 +20,8 @@
#include "../../opentx.h" #include "../../opentx.h"
const uint8_t LBM_SPLASH[] = { const uint8_t LBM_SPLASH[] __attribute__((aligned(32))) = {
#include "../../bitmaps/horus/splash.lbm" #include "splash.lbm"
}; };
#if defined(SPLASH) #if defined(SPLASH)
+10 -6
View File
@@ -324,16 +324,20 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
} }
#endif #endif
#define SLEEP_BITMAP_WIDTH 60
#define SLEEP_BITMAP_HEIGHT 60
void drawSleepBitmap() void drawSleepBitmap()
{ {
/* lcdClear(); lcdClear();
lcdDrawBitmap(POPUP_X-80, POPUP_Y-30, LBM_SLEEP); lcdDrawBitmap((LCD_W-SLEEP_BITMAP_WIDTH)/2, (LCD_H-SLEEP_BITMAP_HEIGHT)/2, LBM_SLEEP);
lcdRefresh(); */ lcdRefresh();
} }
#define SHUTDOWN_BITMAP_WIDTH 60
#define SHUTDOWN_BITMAP_HEIGHT 60
void drawShutdownBitmap(uint8_t index) void drawShutdownBitmap(uint8_t index)
{ {
/*lcdClear(); lcdClear();
lcdDrawBitmap(76, 2, LBM_SHUTDOWN, index * 60, 60); lcdDrawBitmap((LCD_W-SHUTDOWN_BITMAP_WIDTH)/2, (LCD_H-SHUTDOWN_BITMAP_HEIGHT)/2, LBM_SHUTDOWN, index*SHUTDOWN_BITMAP_WIDTH, SHUTDOWN_BITMAP_WIDTH);
lcdRefresh();*/ lcdRefresh();
} }
+1 -1
View File
@@ -29,7 +29,7 @@ Clipboard clipboard;
#endif #endif
#if (defined(PCBTARANIS) || defined(PCBHORUS)) && defined(SDCARD) #if (defined(PCBTARANIS) || defined(PCBHORUS)) && defined(SDCARD)
uint8_t modelBitmap[MODEL_BITMAP_SIZE]; uint8_t modelBitmap[MODEL_BITMAP_SIZE] __attribute__((aligned(32)));
bool loadModelBitmap(char * name, uint8_t * bitmap) bool loadModelBitmap(char * name, uint8_t * bitmap)
{ {
uint8_t len = zlen(name, LEN_BITMAP_NAME); uint8_t len = zlen(name, LEN_BITMAP_NAME);