Permalink
Browse files

Initial porting to Linux

  • Loading branch information...
shumatech committed Oct 16, 2010
1 parent 19724dd commit 40f102bc298df356ba0e60a702639ece345b5fc6
Showing with 14,992 additions and 14,847 deletions.
  1. +3 −0 .gitignore
  2. +192 −185 Makefile
  3. 0 appletgen
  4. +36 −36 src/Applet.cpp
  5. +37 −37 src/Applet.h
  6. +31 −31 src/BossaAbout.cpp
  7. +30 −30 src/BossaAbout.h
  8. +36 −35 src/BossaApp.cpp
  9. +50 −50 src/BossaApp.h
  10. +29 −24 src/BossaBitmaps.cpp
  11. +25 −23 src/BossaBitmaps.h
  12. +534 −534 src/BossaForm.cpp
  13. +8,033 −8,033 src/BossaForm.fbp
  14. +204 −204 src/BossaForm.h
  15. +215 −215 src/BossaIcon.cpp
  16. +74 −74 src/BossaInfo.cpp
  17. +30 −30 src/BossaInfo.h
  18. +491 −491 src/BossaLogo.cpp
  19. +21 −21 src/BossaProgress.cpp
  20. +33 −33 src/BossaProgress.h
  21. +335 −335 src/BossaThread.cpp
  22. +90 −90 src/BossaThread.h
  23. +505 −505 src/BossaWindow.cpp
  24. +65 −65 src/BossaWindow.h
  25. +131 −131 src/CmdOpts.cpp
  26. +60 −60 src/CmdOpts.h
  27. +42 −42 src/Driver.h
  28. +305 −305 src/EefcFlash.cpp
  29. +80 −80 src/EefcFlash.h
  30. +283 −283 src/EfcFlash.cpp
  31. +77 −77 src/EfcFlash.h
  32. +48 −48 src/Flash.cpp
  33. +124 −124 src/Flash.h
  34. +157 −157 src/FlashFactory.cpp
  35. +18 −18 src/FlashFactory.h
  36. +60 −0 src/LinuxPortFactory.cpp
  37. +29 −0 src/LinuxPortFactory.h
  38. +31 −28 src/PortFactory.h
  39. +238 −239 src/PosixSerialPort.cpp
  40. +32 −0 src/PosixSerialPort.h
  41. +478 −470 src/Samba.cpp
  42. +63 −63 src/Samba.h
  43. +50 −50 src/SerialPort.h
  44. +378 −378 src/ShumaTechLogo.cpp
  45. +31 −31 src/TemplateArm.asm
  46. +151 −151 src/WinPortFactory.cpp
  47. +52 −53 src/WinPortFactory.h
  48. +201 −204 src/WinSerialPort.cpp
  49. +33 −34 src/WinSerialPort.h
  50. +34 −34 src/WordCopyApplet.cpp
  51. +21 −21 src/WordCopyApplet.h
  52. +47 −47 src/WordCopyArm.asm
  53. +639 −638 src/bossac.cpp
View
@@ -1,3 +1,6 @@
*.bin
obj
*.exe
*~
bossa
bossac
View
377 Makefile
@@ -1,185 +1,192 @@
#
# Version
#
VERSION=0.1.0b
#
# Source files
#
COMMON_SRCS=Samba.cpp Flash.cpp EfcFlash.cpp EefcFlash.cpp FlashFactory.cpp Applet.cpp WordCopyApplet.cpp
APPLET_SRCS=WordCopyArm.asm
BOSSA_SRCS=BossaForm.cpp BossaWindow.cpp BossaAbout.cpp BossaApp.cpp BossaBitmaps.cpp BossaInfo.cpp BossaThread.cpp BossaProgress.cpp
BOSSA_PNGS=BossaLogo.png BossaIcon.png ShumaTechLogo.png
BOSSA_RC=BossaRes.rc
BOSSAC_SRCS=bossac.cpp CmdOpts.cpp
#
# Windows sources
#
OS:=$(shell uname -o)
ifeq ($(OS),Msys)
EXE=.exe
COMMON_SRCS+=WinSerialPort.cpp WinPortFactory.cpp
endif
#
# Build directories
#
OBJDIR=obj
SRCDIR=src
RESDIR=res
#
# Object files
#
COMMON_OBJS=$(foreach src,$(COMMON_SRCS),$(OBJDIR)/$(src:%.cpp=%.o))
APPLET_OBJS=$(foreach src,$(APPLET_SRCS),$(OBJDIR)/$(src:%.asm=%.o))
BOSSA_OBJS=$(APPLET_OBJS) $(COMMON_OBJS) $(foreach src,$(BOSSA_SRCS),$(OBJDIR)/$(src:%.cpp=%.o)) $(OBJDIR)/$(BOSSA_RC:%.rc=%.o)
BOSSAC_OBJS=$(APPLET_OBJS) $(COMMON_OBJS) $(foreach src,$(BOSSAC_SRCS),$(OBJDIR)/$(src:%.cpp=%.o))
#
# Dependencies
#
DEPENDS=$(COMMON_SRCS:%.cpp=$(OBJDIR)/%.d)
DEPENDS+=$(APPLET_SRCS:%.asm=$(OBJDIR)/%.d)
DEPENDS+=$(BOSSA_SRCS:%.cpp=$(OBJDIR)/%.d)
DEPENDS+=$(BOSSAC_SRCS:%.cpp=$(OBJDIR)/%.d)
#
# Tools
#
#Q=@
CXX=g++
ARM=arm-none-eabi-
ARMAS=$(ARM)as
ARMOBJCOPY=$(ARM)objcopy
#
# CXX Flags
#
COMMON_CXXFLAGS=-Wall -Werror -MT $@ -MD -MP -MF $(@:%.o=%.d) -O2 -DVERSION=\"$(VERSION)\" -g
WX_CXXFLAGS:=$(shell wx-config --cxxflags)
BOSSA_CXXFLAGS=$(COMMON_CXXFLAGS) $(WX_CXXFLAGS)
#-DWX_PRECOMP -mthreads -Wno-ctor-dtor-privacy -fno-strict-aliasing
BOSSAC_CXXFLAGS=$(COMMON_CXXFLAGS)
#
# LD Flags
#
COMMON_LDFLAGS=-Wl,--enable-auto-import -g -static-libstdc++ -static-libgcc
BOSSA_LDFLAGS=$(COMMON_LDFLAGS)
BOSSAC_LDFLAGS=$(COMMON_LDFLAGS)
#
# Libs
#
COMMON_LIBS=-lsetupapi
WX_LIBS:=$(shell wx-config --libs)
BOSSA_LIBS=$(COMMON_LIBS) $(WX_LIBS)
BOSSAC_LIBS=$(COMMON_LIBS)
#
# Main targets
#
all: bossa bossac
release: all bossa-release bossac-release
#
# Common rules
#
define common_obj
$(OBJDIR)/$(1:%.cpp=%.o): $(SRCDIR)/$(1)
@echo CPP $$<
$$(Q)$$(CXX) $$(COMMON_CXXFLAGS) -c -o $$@ $$<
endef
$(foreach src,$(COMMON_SRCS),$(eval $(call common_obj,$(src))))
#
# Applet rules
#
define applet_obj
$(OBJDIR)/$(1:%.asm=%.o): $(SRCDIR)/$(1)
@echo APPLET $(1:%.asm=%)
$$(Q)$$(ARMAS) -o $$(@:%.o=%.obj) $$<
$$(Q)$$(ARMOBJCOPY) -O binary $$(@:%.o=%.obj) $$(@:%.o=%.bin)
$$(Q)appletgen $(1:%.asm=%) $(SRCDIR) $(OBJDIR)
$$(Q)$$(CXX) $$(COMMON_CXXFLAGS) -c -o $$(@) $$(<:%.asm=%.cpp)
endef
$(foreach src,$(APPLET_SRCS),$(eval $(call applet_obj,$(src))))
#
# BOSSA rules
#
define bossa_obj
$(OBJDIR)/$(1:%.cpp=%.o): $(SRCDIR)/$(1)
@echo CPP $$<
$$(Q)$$(CXX) $$(BOSSA_CXXFLAGS) -c -o $$@ $$<
endef
$(foreach src,$(BOSSA_SRCS),$(eval $(call bossa_obj,$(src))))
#
# Resource rules
#
$(OBJDIR)/$(BOSSA_RC:%.rc=%.o): $(RESDIR)/$(BOSSA_RC)
@echo RC $<
$(Q)`wx-config --rescomp` -o $@ $<
#
# BOSSAC rules
#
define bossac_obj
$(OBJDIR)/$(1:%.cpp=%.o): $(SRCDIR)/$(1)
@echo CPP $$<
$$(Q)$$(CXX) $$(BOSSAC_CXXFLAGS) -c -o $$@ $$<
endef
$(foreach src,$(BOSSAC_SRCS),$(eval $(call bossac_obj,$(src))))
#
# PNG rules
#
define bossa_png
$(SRCDIR)/$(1:%.png=%.cpp): $(RESDIR)/$(1)
@echo BIN2C $$<
$(Q)bin2c $$< $$@
endef
$(foreach png,$(BOSSA_PNGS),$(eval $(call bossa_png,$(png))))
#
# Directory rules
#
$(OBJDIR):
@mkdir $@
$(BINDIR):
@mkdir $@
#
# Target rules
#
bossa: $(OBJDIR) $(BINDIR) $(foreach png,$(BOSSA_PNGS),$(SRCDIR)/$(png:%.png=%.cpp)) $(BOSSA_OBJS)
@echo LD $@
$(Q)$(CXX) $(BOSSA_LDFLAGS) -o $@ $(BOSSA_OBJS) $(BOSSA_LIBS)
bossa-release: bossa
@echo STRIP $^
$(Q)strip $^$(EXE)
@echo UPX $^
$(Q)upx $^$(EXE)
bossac: $(OBJDIR) $(BINDIR) $(BOSSAC_OBJS)
@echo LD $@
$(Q)$(CXX) $(BOSSAC_LDFLAGS) -o $@ $(BOSSAC_OBJS) $(BOSSAC_LIBS)
bossac-release: bossac
@echo STRIP $^
$(Q)strip $^$(EXE)
@echo UPX $^
$(Q)upx $^$(EXE)
clean:
@echo CLEAN
$(Q)rm -rf bossa$(EXE) bossac$(EXE) $(OBJDIR)
#
# Include dependencies
#
-include $(DEPENDS)
#
# Version
#
VERSION=0.1.0b
#
# Source files
#
COMMON_SRCS=Samba.cpp Flash.cpp EfcFlash.cpp EefcFlash.cpp FlashFactory.cpp Applet.cpp WordCopyApplet.cpp
APPLET_SRCS=WordCopyArm.asm
BOSSA_SRCS=BossaForm.cpp BossaWindow.cpp BossaAbout.cpp BossaApp.cpp BossaBitmaps.cpp BossaInfo.cpp BossaThread.cpp BossaProgress.cpp
BOSSA_PNGS=BossaLogo.png BossaIcon.png ShumaTechLogo.png
BOSSAC_SRCS=bossac.cpp CmdOpts.cpp
#
# Windows sources
#
OS:=$(shell uname -s)
ifeq ($(OS),MINGW32_NT-6.1)
EXE=.exe
COMMON_SRCS+=WinSerialPort.cpp WinPortFactory.cpp
COMMON_LDFLAGS=-Wl,--enable-auto-import
COMMON_LIBS=-lsetupapi
BOSSA_RC=BossaRes.rc
endif
ifeq ($(OS),Linux)
COMMON_SRCS+=PosixSerialPort.cpp LinuxPortFactory.cpp
endif
#
# Build directories
#
OBJDIR=obj
SRCDIR=src
RESDIR=res
#
# Object files
#
COMMON_OBJS=$(foreach src,$(COMMON_SRCS),$(OBJDIR)/$(src:%.cpp=%.o))
APPLET_OBJS=$(foreach src,$(APPLET_SRCS),$(OBJDIR)/$(src:%.asm=%.o))
BOSSA_OBJS=$(APPLET_OBJS) $(COMMON_OBJS) $(foreach src,$(BOSSA_SRCS),$(OBJDIR)/$(src:%.cpp=%.o))
ifdef BOSSA_RC
BOSSA_OBJS+=$(OBJDIR)/$(BOSSA_RC:%.rc=%.o)
endif
BOSSAC_OBJS=$(APPLET_OBJS) $(COMMON_OBJS) $(foreach src,$(BOSSAC_SRCS),$(OBJDIR)/$(src:%.cpp=%.o))
#
# Dependencies
#
DEPENDS=$(COMMON_SRCS:%.cpp=$(OBJDIR)/%.d)
DEPENDS+=$(APPLET_SRCS:%.asm=$(OBJDIR)/%.d)
DEPENDS+=$(BOSSA_SRCS:%.cpp=$(OBJDIR)/%.d)
DEPENDS+=$(BOSSAC_SRCS:%.cpp=$(OBJDIR)/%.d)
#
# Tools
#
#Q=@
CXX=g++
ARM=arm-none-eabi-
ARMAS=$(ARM)as
ARMOBJCOPY=$(ARM)objcopy
#
# CXX Flags
#
COMMON_CXXFLAGS+=-Wall -Werror -MT $@ -MD -MP -MF $(@:%.o=%.d) -DVERSION=\"$(VERSION)\" -g
WX_CXXFLAGS:=$(shell wx-config --cxxflags) -DWX_PRECOMP -pthread -Wno-ctor-dtor-privacy -O2 -fno-strict-aliasing
BOSSA_CXXFLAGS=$(COMMON_CXXFLAGS) $(WX_CXXFLAGS)
BOSSAC_CXXFLAGS=$(COMMON_CXXFLAGS)
#
# LD Flags
#
COMMON_LDFLAGS+=-g -static-libstdc++ -static-libgcc
BOSSA_LDFLAGS=$(COMMON_LDFLAGS)
BOSSAC_LDFLAGS=$(COMMON_LDFLAGS)
#
# Libs
#
COMMON_LIBS+=
WX_LIBS:=$(shell wx-config --libs)
BOSSA_LIBS=$(COMMON_LIBS) $(WX_LIBS)
BOSSAC_LIBS=$(COMMON_LIBS)
#
# Main targets
#
all: bossa bossac
release: all bossa-release bossac-release
#
# Common rules
#
define common_obj
$(OBJDIR)/$(1:%.cpp=%.o): $(SRCDIR)/$(1)
@echo CPP $$<
$$(Q)$$(CXX) $$(COMMON_CXXFLAGS) -c -o $$@ $$<
endef
$(foreach src,$(COMMON_SRCS),$(eval $(call common_obj,$(src))))
#
# Applet rules
#
define applet_obj
$(OBJDIR)/$(1:%.asm=%.o): $(SRCDIR)/$(1)
@echo APPLET $(1:%.asm=%)
$$(Q)$$(ARMAS) -o $$(@:%.o=%.obj) $$<
$$(Q)$$(ARMOBJCOPY) -O binary $$(@:%.o=%.obj) $$(@:%.o=%.bin)
$$(Q)appletgen $(1:%.asm=%) $(SRCDIR) $(OBJDIR)
$$(Q)$$(CXX) $$(COMMON_CXXFLAGS) -c -o $$(@) $$(<:%.asm=%.cpp)
endef
$(foreach src,$(APPLET_SRCS),$(eval $(call applet_obj,$(src))))
#
# BOSSA rules
#
define bossa_obj
$(OBJDIR)/$(1:%.cpp=%.o): $(SRCDIR)/$(1)
@echo CPP $$<
$$(Q)$$(CXX) $$(BOSSA_CXXFLAGS) -c -o $$@ $$<
endef
$(foreach src,$(BOSSA_SRCS),$(eval $(call bossa_obj,$(src))))
#
# Resource rules
#
$(OBJDIR)/$(BOSSA_RC:%.rc=%.o): $(RESDIR)/$(BOSSA_RC)
@echo RC $<
$(Q)`wx-config --rescomp` -o $@ $<
#
# BOSSAC rules
#
define bossac_obj
$(OBJDIR)/$(1:%.cpp=%.o): $(SRCDIR)/$(1)
@echo CPP $$<
$$(Q)$$(CXX) $$(BOSSAC_CXXFLAGS) -c -o $$@ $$<
endef
$(foreach src,$(BOSSAC_SRCS),$(eval $(call bossac_obj,$(src))))
#
# PNG rules
#
define bossa_png
$(SRCDIR)/$(1:%.png=%.cpp): $(RESDIR)/$(1)
@echo BIN2C $$<
$(Q)bin2c $$< $$@
endef
$(foreach png,$(BOSSA_PNGS),$(eval $(call bossa_png,$(png))))
#
# Directory rules
#
$(OBJDIR):
@mkdir $@
$(BINDIR):
@mkdir $@
#
# Target rules
#
bossa: $(OBJDIR) $(BINDIR) $(foreach png,$(BOSSA_PNGS),$(SRCDIR)/$(png:%.png=%.cpp)) $(BOSSA_OBJS)
@echo LD $@
$(Q)$(CXX) $(BOSSA_LDFLAGS) -o $@ $(BOSSA_OBJS) $(BOSSA_LIBS)
bossa-release: bossa
@echo STRIP $^
$(Q)strip $^$(EXE)
@echo UPX $^
$(Q)upx $^$(EXE)
bossac: $(OBJDIR) $(BINDIR) $(BOSSAC_OBJS)
@echo LD $@
$(Q)$(CXX) $(BOSSAC_LDFLAGS) -o $@ $(BOSSAC_OBJS) $(BOSSAC_LIBS)
bossac-release: bossac
@echo STRIP $^
$(Q)strip $^$(EXE)
@echo UPX $^
$(Q)upx $^$(EXE)
clean:
@echo CLEAN
$(Q)rm -rf bossa$(EXE) bossac$(EXE) $(OBJDIR)
#
# Include dependencies
#
-include $(DEPENDS)
View
0 appletgen 100644 → 100755
No changes.
Oops, something went wrong.

0 comments on commit 40f102b

Please sign in to comment.