From: David Odin Date: Tue, 20 Jun 2017 23:13:16 +0000 (+0200) Subject: cleaner asm X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=8a520f25eb0ccf603d7a81db18994d9613446fa9;p=soft%2Flpc122x%2Fcore cleaner asm --- diff --git a/Makefile b/Makefile index 3f7ef78..9d2ec29 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ ARCH = armv6-m CROSS_COMPILE ?= arm-none-eabi- CC = $(CROSS_COMPILE)gcc -#DEBUG = -g +# DEBUG = -ggdb3 LD_DEBUG = $(DEBUG) #LD_DEBUG = $(DEBUG) -Wl,--print-memory-usage #LD_DEBUG = $(DEBUG) -Wl,--print-gc-sections -Wl,--print-output-format \ @@ -34,10 +34,16 @@ INCLUDES = include/ TARGET_INCLUDES = $(TARGET_DIR)/ OBJDIR = objs -SRC = $(wildcard */*.c) -SRC += $(wildcard lib/*/*.c) -SRC += $(wildcard lib/protocols/*/*.c) -OBJS = ${SRC:%.c=${OBJDIR}/%.o} +C_SRC = $(wildcard */*.c) +C_SRC += $(wildcard lib/*/*.c) +C_SRC += $(wildcard lib/protocols/*/*.c) + +A_SRC = $(wildcard */*.s) +A_SRC += $(wildcard lib/*/*.s) +A_SRC += $(wildcard lib/protocols/*/*.s) + + +OBJS = ${C_SRC:%.c=${OBJDIR}/%.o} ${A_SRC:%.s=${OBJDIR}/%.o} DEPS = ${OBJS:%.o=$(OBJDIR)/%.d} NAME_SRC = $(wildcard $(TARGET_DIR)/*.c) diff --git a/extdrv/ssd130x_oled_buffer.c b/extdrv/ssd130x_oled_buffer.c index 89018b6..6c048c2 100644 --- a/extdrv/ssd130x_oled_buffer.c +++ b/extdrv/ssd130x_oled_buffer.c @@ -56,7 +56,7 @@ int ssd130x_buffer_set_tile(uint8_t* gddram, uint8_t x0, uint8_t y0, uint8_t* ti } /* Simple RLE decompressor */ -void uncompress_image(uint8_t *compressed_data, +void uncompress_image(const uint8_t *compressed_data, uint8_t *buffer) { int i; @@ -79,8 +79,8 @@ void uncompress_image(uint8_t *compressed_data, } /* Simple RLE decompressor, asm implementation, experimental */ -void uncompress_image_asm(uint8_t *compressed_data, - uint8_t *buffer) +void uncompress_image_asm_old(const uint8_t *compressed_data, + uint8_t *buffer) { // note: r0 is compressed_data/in, r1 is buffer // r2 is end_buffer diff --git a/extdrv/ssd130x_oled_buffer_s.s b/extdrv/ssd130x_oled_buffer_s.s new file mode 100644 index 0000000..91f0805 --- /dev/null +++ b/extdrv/ssd130x_oled_buffer_s.s @@ -0,0 +1,58 @@ +@ extdrv/ssd130x_oled_buffer.c +@ +@ Set of functions helping using the 128x64 buffer for the SSD130X +@ +@ Copyright 2017 Nathael Pajani +@ +@ +@ This program is free software: you can redistribute it and/or modify +@ it under the terms of the GNU General Public License as published by +@ the Free Software Foundation, either version 2 of the License, or +@ (at your option) any later version. +@ +@ This program is distributed in the hope that it will be useful, +@ but WITHOUT ANY WARRANTY; without even the implied warranty of +@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +@ GNU General Public License for more details. +@ +@ You should have received a copy of the GNU General Public License +@ along with this program. If not, see . + +.syntax unified +.cpu cortex-m0 +.thumb + +@ exported symbol: +.global uncompress_image_asm + +/* Simple RLE decompressor, asm implementation, experimental */ +.thumb_func +uncompress_image_asm: + push {r4,r5,r14} @ + movs r2, 128 @ + lsls r2, 3 @ + adds r2, r2, r1 @ +.label1: + ldrb r3, [r0] @ + adds r0, 1 @ + sxtb r3, r3 @ + cmp r3, 0 @ + bpl .set + rsbs r3, r3, 0 @ negs... + movs r5, 1 @ + b .copy2 +.set: + adds r3, 3 @ + movs r5, 0 @ +.copy2: + ldrb r4, [r0] @ + strb r4, [r1] @ + adds r0, r5 @ + adds r1, 1 @ + subs r3, 1 @ + bne .copy2 + subs r0, r0, r5 @ + adds r0, r0, 1 @ + cmp r1, r2 @ + bne .label1 + pop {r4,r5,r15} @ restaure r4 & r5 diff --git a/include/extdrv/ssd130x_oled_buffer.h b/include/extdrv/ssd130x_oled_buffer.h index 2241d8a..d3b9f49 100644 --- a/include/extdrv/ssd130x_oled_buffer.h +++ b/include/extdrv/ssd130x_oled_buffer.h @@ -34,9 +34,11 @@ int ssd130x_buffer_set_pixel(uint8_t* gddram, uint8_t x0, uint8_t y0, uint8_t st int ssd130x_buffer_set_tile(uint8_t* gddram, uint8_t x0, uint8_t y0, uint8_t* tile); /* Simple RLE decompressor (two implementations, wip) */ -void uncompress_image(uint8_t* compressed_data, +void uncompress_image(const uint8_t* compressed_data, uint8_t* buffer); -void uncompress_image_asm(uint8_t* compressed_data, +void uncompress_image_asm(const uint8_t* compressed_data, + uint8_t* buffer); +void uncompress_image_asm_old(const uint8_t* compressed_data, uint8_t* buffer); #endif