Add CXXFLAGS; Add recursive targets. | ||
M | 1.2 | devlib/config.mk |
M | 1.2 | devlib/rules.mk |
diff -u devtools/devlib/config.mk:1.1 devtools/devlib/config.mk:1.2 --- devtools/devlib/config.mk:1.1 Wed Mar 22 10:51:53 2006 +++ devtools/devlib/config.mk Mon Mar 27 06:48:33 2006 @@ -10,6 +10,9 @@ # Author: Bernie Innocenti <bernie@develer.com> # # $Log$ +# Revision 1.2 2006/03/27 04:48:33 bernie +# Add CXXFLAGS; Add recursive targets. +# # Revision 1.1 2006/03/22 09:51:53 bernie # Add build infrastructure. # @@ -66,31 +69,51 @@ DOXYGEN = doxygen UISP = uisp AVRDUDE = avrdude +FLEXCAT = $(top_srcdir)/tools/flexcat/flexcat # output format can be srec, ihex (avrobj is always created) FORMAT = srec #FORMAT = ihex +# Compiler flags for generating dependencies +DEP_FLAGS = -MMD -MP + +# Compiler flags for generating source listings +LIST_FLAGS = -Wa,-anhlmsd=$(@:.o=.lst) + +# Linker flags for generating map files +MAP_FLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref + +# Compiler warning flags for both C and C++ WARNFLAGS = \ -W -Wformat -Wall -Wundef -Wpointer-arith -Wcast-qual \ - -Wcast-align -Wwrite-strings -Wsign-compare -Wstrict-prototypes \ - -Wmissing-prototypes -Wmissing-noreturn - -# default compiler flags -CFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \ - -MMD -MP -Wa,-anhlmsd=$(@:.o=.lst) -std=gnu99 + -Wcast-align -Wwrite-strings -Wsign-compare \ + -Wmissing-prototypes -Wmissing-noreturn \ + -Wextra -Wstrict-aliasing=2 + +# Compiler warning flags for C only +C_WARNFLAGS = \ + -Wmissing-prototypes -Wstrict-prototypes + +# Default C compiler flags +CFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) $(C_WARNFLAGS) \ + $(DEP_FLAGS) $(LIST_FLAGS) -std=gnu99 + +# Default C++ compiler flags +CXXFLAGS = $(INCDIR) $(OPTCFLAGS) $(DEBUGCFLAGS) $(WARNFLAGS) \ + $(DEP_FLAGS) $(LIST_FLAGS) -# default compiler assembly flags +# Default compiler assembly flags CPPAFLAGS = $(DEBUGCFLAGS) -MMD -# default assembler flags +# Default assembler flags ASFLAGS = $(DEBUGCFLAGS) -# default linker flags -#LDFLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref -Wl,--reduce-memory-overheads -LDFLAGS = -Wl,-Map=$(@:%.elf=%.map),--cref -Wl,--gc-sections +# Default linker flags +#LDFLAGS = $(MAP_FLAGS) -Wl,--reduce-memory-overheads +LDFLAGS = $(MAP_FLAGS) -Wl,--gc-sections -# flags for avrdude +# Flags for avrdude AVRDUDEFLAGS = $(DPROG) # additional libs diff -u devtools/devlib/rules.mk:1.1 devtools/devlib/rules.mk:1.2 --- devtools/devlib/rules.mk:1.1 Wed Mar 22 10:51:53 2006 +++ devtools/devlib/rules.mk Mon Mar 27 06:48:33 2006 @@ -10,6 +10,9 @@ # Author: Bernie Innocenti <bernie@develer.com> # # $Log$ +# Revision 1.2 2006/03/27 04:48:33 bernie +# Add CXXFLAGS; Add recursive targets. +# # Revision 1.1 2006/03/22 09:51:53 bernie # Add build infrastructure. # @@ -96,9 +99,12 @@ TRG_ROM = $(TRG:%=$(OUTDIR)/%.rom) TRG_COF = $(TRG:%=$(OUTDIR)/%.cof) + +RECURSIVE_TARGETS = all-recursive install-recursive clean-recursive + # The default target .PHONY: all -all:: $(TRG_S19) $(TRG_HEX) +all:: all-recursive $(TRG_S19) $(TRG_HEX) # Generate project documentation .PHONY: docs @@ -130,15 +136,15 @@ # Compile: instructions to create assembler and/or object files from C source $$($(1)_COBJ) : $$(OBJDIR)/$(1)/%.o : %.c - $L "$(1): Compiling $$<" + $L "$(1): Compiling $$< (C)" @$$(MKDIR_P) $$(dir $$@) $Q $$(CC) -c $$(CFLAGS) $$($(1)_CFLAGS) $$< -o $$@ # Compile: instructions to create assembler and/or object files from C++ source $$($(1)_CXXOBJ) : $$(OBJDIR)/$(1)/%.o : %.cpp - $L "$(1): Compiling $$<" + $L "$(1): Compiling $$< (C++)" @$$(MKDIR_P) $$(dir $$@) - $Q $$(CXX) -c $$(CFLAGS) $$($(1)_CFLAGS) $$< -o $$@ + $Q $$(CXX) -c $$(CXXFLAGS) $$($(1)_CXXFLAGS) $$< -o $$@ # Generate assembly sources from C files (debug) $$(OBJDIR)/$(1)/%.s : %.c @@ -235,12 +241,33 @@ # $(COFFCONVERT) -O coff-avr $< $@ # For use with AVRstudio 3 #make instruction to delete created files -clean: +clean: clean-recursive -$(RM_R) $(OBJDIR) -$(RM_R) $(OUTDIR) +$(RECURSIVE_TARGETS): + @target=`echo $@ | sed s/-recursive//`; \ + for dir in $(SUBDIRS); do \ + if [ -e $$dir/configure.in ] || [ -e $$dir/configure.ac ] && [ ! -x $$dir/configure ]; then \ + echo "Running autogen.sh in $$dir..."; \ + ( cd $$dir && chmod a+x autogen.sh && ./autogen.sh && rm -f Makefile || exit 1 ); \ + fi; \ + if [ ! -e $$dir/Makefile ]; then \ + if [ -e "$$dir/build-$(ARCH)" ]; then \ + echo "Running build script in $$dir..."; \ + ( cd $$dir && chmod a+x build && ./build || exit 1 ); \ + else \ + echo "Running configure in $$dir..."; \ + ( cd $$dir && ./configure --prefix=$(PREFIX) || exit 1 ); \ + fi; \ + fi; \ + $(MAKE) -C $$dir $$target || exit 1; \ + done + BUILDREV_H = buildrev.h +ifeq ($(shell [ -e verstag.c ] && echo yes), yes) +.PHONY: bumprev bumprev: @buildnr=0; \ if [ -f $(BUILDREV_H) ]; then \ @@ -251,7 +278,13 @@ echo "#define VERS_BUILD $$buildnr" >"$(BUILDREV_H)"; \ echo "#define VERS_HOST \"$$buildhost\"" >>"$(BUILDREV_H)"; \ echo "Building revision $$buildnr" +else +.PHONY: bumprev +bumprev: + +endif # Include dependencies +ifneq ($(strip $(OBJ)),) -include $(OBJ:%.o=%.d) - +endif
gfx_blitImage(): New function; gfx_blitRaster(): Fix clipping bug. | ||
M | 1.8 | devlib/gfx/bitmap.c |
M | 1.12 | devlib/gfx/gfx.h |
diff -u devtools/devlib/gfx/bitmap.c:1.7 devtools/devlib/gfx/bitmap.c:1.8 --- devtools/devlib/gfx/bitmap.c:1.7 Tue Mar 7 23:18:04 2006 +++ devtools/devlib/gfx/bitmap.c Mon Mar 27 06:48:56 2006 @@ -162,9 +165,15 @@ } -void gfx_blitRaster(Bitmap *dst, coord_t dxmin, coord_t dymin, const uint8_t *raster, coord_t w, coord_t h, coord_t stride) +/** + * Blit a raster to a Bitmap. + * + * \see gfx_blit() + */ +void gfx_blitRaster(Bitmap *dst, coord_t dxmin, coord_t dymin, + const uint8_t *raster, coord_t w, coord_t h, coord_t stride) { - coord_t dxmax, dymax; + coord_t dxmax = dxmin + w, dymax = dymin + h; coord_t sxmin = 0, symin = 0; coord_t dx, dy, sx, sy; @@ -181,8 +190,11 @@ symin += dst->cr.ymin - dymin; dymin = dst->cr.ymin; } - dxmax = MIN(dxmin + w, dst->cr.xmax); - dymax = MIN(dymin + h, dst->cr.ymax); + dxmax = MIN(dxmax, dst->cr.xmax); + dymax = MIN(dymax, dst->cr.ymax); + + //kprintf("dxmin=%d, sxmin=%d, dxmax=%d; ", dxmin, sxmin, dxmax); + //kprintf("dymin=%d, symin=%d, dymax=%d\n", dymin, symin, dymax); /* TODO: make it not as dog slow as this */ for (dx = dxmin, sx = sxmin; dx < dxmax; ++dx, ++sx) @@ -190,6 +202,19 @@ BM_DRAWPIXEL(dst, dx, dy, RAST_READPIXEL(raster, sx, sy, stride)); } +/** + * Blit an Image to a Bitmap. + * + * \see gfx_blit() + */ +void gfx_blitImage(Bitmap *dst, coord_t dxmin, coord_t dymin, const Image *image) +{ + ASSERT(image); + + gfx_blitRaster(dst, dxmin, dymin, + image->raster, image->width, image->height, image->stride); +} + /*! * Set the bitmap clipping rectangle to the specified coordinates. diff -u devtools/devlib/gfx/gfx.h:1.11 devtools/devlib/gfx/gfx.h:1.12 --- devtools/devlib/gfx/gfx.h:1.11 Tue Mar 7 23:18:04 2006 +++ devtools/devlib/gfx/gfx.h Mon Mar 27 06:48:56 2006 @@ -121,7 +124,7 @@ { uint8_t *raster; /*!< Pointer to byte array to hold the data */ coord_t width, height; /*!< Width/Height in pixels */ - coord_t stride; /*!< Bytes per row. */ + coord_t stride; /*!< Bytes per row. */ coord_t penX, penY; /*!< Current pen position MoveTo()/LineTo() */ Rect cr; /*!< Clip drawing inside this rectangle */ @@ -150,6 +153,19 @@ } Bitmap; +/** + * Hold image pixels. + * + * \todo Use this as Bitmap and change Bitmap to Drawable. + */ +typedef struct Image +{ + const uint8_t *raster; /*!< Pointer to byte array to hold the data. */ + coord_t width; /*!< Raster width in pixels. */ + coord_t height; /*!< Raster height in pixels. */ + coord_t stride; /*!< Bytes per row. */ +}; + #if CONFIG_BITMAP_FMT == BITMAP_FMT_PLANAR_H_MSB /** * Compute the size in bytes of a raster suitable for @@ -173,6 +189,7 @@ void gfx_bitmapClear(Bitmap *bm); void gfx_blit (Bitmap *dst, const Rect *rect, const Bitmap *src, coord_t srcx, coord_t srcy); void gfx_blitRaster (Bitmap *dst, coord_t dx, coord_t dy, const uint8_t *raster, coord_t w, coord_t h, coord_t stride); +void gfx_blitImage (Bitmap *dst, coord_t dx, coord_t dy, const Image *image); void gfx_line (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2); void gfx_rectDraw (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2); void gfx_rectFillC (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t color);
CPU_IDLE(): Fix for new emulator. | ||
M | 1.13 | devlib/cfg/cpu.h |
M | 1.30 | devlib/kern/proc.c |
diff -u devtools/devlib/cfg/cpu.h:1.12 devtools/devlib/cfg/cpu.h:1.13 --- devtools/devlib/cfg/cpu.h:1.12 Tue Mar 21 11:52:39 2006 +++ devtools/devlib/cfg/cpu.h Mon Mar 27 06:49:23 2006 @@ -75,6 +78,7 @@ #define DEVLIB_CPU_H #include <cfg/compiler.h> /* for uintXX_t */ +#include <cfg/arch_config.h> /* ARCH_EMUL */ /*! @@ -578,15 +582,12 @@ #if defined(ARCH_EMUL) && (ARCH & ARCH_EMUL) /* This emulator hook should yield the CPU to the host. */ EXTERN_C_BEGIN - void SchedulerIdle(void); + void emul_idle(void); EXTERN_C_END - #define CPU_IDLE SchedulerIdle() + #define CPU_IDLE emul_idle() #else /* !ARCH_EMUL */ #define CPU_IDLE do { /* nothing */ } while (0) #endif /* !ARCH_EMUL */ #endif /* !CPU_IDLE */ -/* OBSOLETE */ -#define SCHEDULER_IDLE CPU_IDLE - #endif /* DEVLIB_CPU_H */ diff -u devtools/devlib/kern/proc.c:1.29 devtools/devlib/kern/proc.c:1.30 --- devtools/devlib/kern/proc.c:1.29 Fri Feb 24 02:17:05 2006 +++ devtools/devlib/kern/proc.c Mon Mar 27 06:49:23 2006 @@ -331,7 +334,7 @@ * reason to do this. */ IRQ_ENABLE; - SCHEDULER_IDLE; + CPU_IDLE; IRQ_DISABLE; } IRQ_RESTORE(flags);
Add bouncing logo demo. | ||
M | 1.2 | devlib/app/demo/demo.c |
M | 1.2 | devlib/app/demo/demo.mk |
diff -u devtools/devlib/app/demo/demo.c:1.1 devtools/devlib/app/demo/demo.c:1.2 --- devtools/devlib/app/demo/demo.c:1.1 Wed Mar 22 10:52:13 2006 +++ devtools/devlib/app/demo/demo.c Mon Mar 27 06:49:50 2006 @@ -32,7 +35,7 @@ #include <gfx/win.h> #include <gfx/text.h> #include <gfx/font.h> -#include <icons/artwork.h> +#include <icons/logo.h> #include <mware/menu.h> #include <cfg/macros.h> @@ -108,15 +111,8 @@ usleep(10000); } -int main(int argc, char *argv[]) +void hello_world(void) { - emul_init(&argc, argv); - timer_init(); - buz_init(); - kbd_init(); - lcd_init(); - proc_init(); - gfx_bitmapClear(&lcd_bitmap); extern const Font font_10x20; extern const Font font_helvB10; @@ -133,11 +129,58 @@ lcd_blit_bitmap(&lcd_bitmap); emul_idle(); } - gfx_blitRaster(&lcd_bitmap, 0, 0, powersoft_logo, 122, 32, 4); - lcd_blit_bitmap(&lcd_bitmap); - emul_idle(); - sleep(1); - //timer_delay(1000); +} + +/** + * Show the splash screen + */ +void bouncing_logo(void) +{ + const long SPEED_SCALE = 1000; + const long GRAVITY_ACCEL = 10; + const long BOUNCE_ELASTICITY = 2; + long h = (long)(-grillo_logo.height) * SPEED_SCALE; + long speed = 1000; + + /* Repeat until logo stands still on the bottom edge */ + while (!((speed == 0) && (h == 0))) + { + /* Move */ + h += speed; + + /* Gravity acceleration */ + speed += GRAVITY_ACCEL; + + if (h > 0 && speed > 0) + { + /* Bounce */ + speed = - (speed / BOUNCE_ELASTICITY); + + } + + /* Update graphics */ + gfx_bitmapClear(&lcd_bitmap); + gfx_blitImage(&lcd_bitmap, + (lcd_bitmap.width - grillo_logo.width) / 2, + h / SPEED_SCALE, + &grillo_logo); + lcd_blit_bitmap(&lcd_bitmap); + + timer_delay(10); + } +} + +int main(int argc, char *argv[]) +{ + emul_init(&argc, argv); + timer_init(); + buz_init(); + kbd_init(); + lcd_init(); + proc_init(); + + hello_world(); + bouncing_logo(); const coord_t small_left = 45, small_top = 30, small_width = 50, small_height = 30; const coord_t large_left = -10, large_top = 10, large_width = 85, large_height = 41; diff -u devtools/devlib/app/demo/demo.mk:1.1 devtools/devlib/app/demo/demo.mk:1.2 --- devtools/devlib/app/demo/demo.mk:1.1 Wed Mar 22 10:52:13 2006 +++ devtools/devlib/app/demo/demo.mk Mon Mar 27 06:49:50 2006 @@ -8,6 +8,9 @@ # Author: Bernie Innocenti <bernie@develer.com> # # $Log$ +# Revision 1.2 2006/03/27 04:49:50 bernie +# Add bouncing logo demo. +# # Revision 1.1 2006/03/22 09:52:13 bernie # Add demo application. # @@ -41,6 +44,7 @@ fonts/luBS14.c \ fonts/ncenB18.c \ icons/artwork.c \ + icons/logo.c \ drv/kbd.c \ drv/timer.c \ drv/buzzer.c \ @@ -68,11 +72,12 @@ EMUL_CFLAGS = -I/usr/local/kde4/include/Qt -I/usr/local/kde4/include -DQT_CLEAN_NAMESPACE -DQT3_SUPPORT EMUL_LDFLAGS = -L /usr/local/kde4/lib64 -lQtGui -lQtCore demo_CFLAGS = -Os -D_QT=4 -D'ARCH=ARCH_EMUL' -Ihw $(EMUL_CFLAGS) +demo_CXXFLAGS = -Os -D_QT=4 -D'ARCH=ARCH_EMUL' -Ihw $(EMUL_CFLAGS) demo_LDFLAGS = $(EMUL_LDFLAGS) # Debug stuff -#ifeq ($(demo_DEBUG),1) -# demo_CFLAGS += -D_DEBUG +ifeq ($(demo_DEBUG),1) + demo_CFLAGS += -D_DEBUG # demo_PCSRC += drv/kdebug.c -#endif +endif
--
Generated by Deluxe Loginfo 2.87 by Bernie Innocenti <bernie@develer.com>