Skip to content

Commit

Permalink
New BOSSA shell command line application to do basic memory, flash, a…
Browse files Browse the repository at this point in the history
…nd PIO diagnostics

Workaround for SAM3U firmware bug
Fixed a bug with setting boot to flash bit on SAM3 devices
  • Loading branch information
sshumate authored and sshumate committed Oct 20, 2011
1 parent ff9fb31 commit acea002
Show file tree
Hide file tree
Showing 38 changed files with 16,271 additions and 744 deletions.
Empty file modified LICENSE.txt 100755 → 100644
Empty file.
55 changes: 44 additions & 11 deletions Makefile
Expand Up @@ -3,16 +3,17 @@
#
# Version
#
VERSION=1.1
VERSION=1.2

#
# Source files
#
COMMON_SRCS=Samba.cpp Flash.cpp EfcFlash.cpp EefcFlash.cpp FlashFactory.cpp Applet.cpp WordCopyApplet.cpp
COMMON_SRCS=Samba.cpp Flash.cpp EfcFlash.cpp EefcFlash.cpp FlashFactory.cpp Applet.cpp WordCopyApplet.cpp Flasher.cpp
APPLET_SRCS=WordCopyArm.asm
BOSSA_SRCS=BossaForm.cpp BossaWindow.cpp BossaAbout.cpp BossaApp.cpp BossaBitmaps.cpp BossaInfo.cpp BossaThread.cpp BossaProgress.cpp
BOSSA_BMPS=BossaLogo.bmp BossaIcon.bmp ShumaTechLogo.bmp
BOSSAC_SRCS=bossac.cpp CmdOpts.cpp
BOSSASH_SRCS=bossash.cpp Shell.cpp Command.cpp arm-dis/arm-dis.cpp arm-dis/floatformat.cpp

#
# Build directories
Expand All @@ -34,16 +35,16 @@ OS:=$(shell uname -s)
ifeq ($(OS),MINGW32_NT-6.1)
EXE=.exe
COMMON_SRCS+=WinSerialPort.cpp WinPortFactory.cpp
COMMON_LDFLAGS=-Wl,--enable-auto-import -static-libstdc++ -static-libgcc
COMMON_LIBS=-Wl,--as-needed -lsetupapi
COMMON_LDFLAGS=-Wl,--enable-auto-import -static -static-libstdc++ -static-libgcc
COMMON_LIBS=-Wl,--as-needed -lsetupapi -ltermcap
BOSSA_RC=BossaRes.rc
WIXDIR="C:\Program Files (x86)\Windows Installer XML v3.5\bin"

$(OBJDIR)\\bossa-$(VERSION).wixobj: $(INSTALLDIR)\\bossa.wxs
$(WIXDIR)\\candle.exe -arch x86 -out $@ -ext $(WIXDIR)\\WixUIExtension.dll -ext $(WIXDIR)\\WixDifxAppExtension.dll $<
$(WIXDIR)\\candle.exe -dVersion=$(VERSION) -arch x86 -out $@ -ext $(WIXDIR)\\WixUIExtension.dll -ext $(WIXDIR)\\WixDifxAppExtension.dll $<

$(OBJDIR)\\bossa64-$(VERSION).wixobj: $(INSTALLDIR)\\bossa.wxs
$(WIXDIR)\\candle.exe -arch x64 -out $@ -ext $(WIXDIR)\\WixUIExtension.dll -ext $(WIXDIR)\\WixDifxAppExtension.dll $<
$(WIXDIR)\\candle.exe -dVersion=$(VERSION) -arch x64 -out $@ -ext $(WIXDIR)\\WixUIExtension.dll -ext $(WIXDIR)\\WixDifxAppExtension.dll $<

$(BINDIR)\\bossa-$(VERSION).msi: $(OBJDIR)\\bossa-$(VERSION).wixobj
$(WIXDIR)\\light.exe -cultures:null -out $@ -pdbout $(OBJDIR)\\bossa.wixpdb -sice:ICE57 -ext $(WIXDIR)\\WixUIExtension.dll -ext $(WIXDIR)\\WixDifxAppExtension.dll $(WIXDIR)\\difxapp_x86.wixlib $<
Expand All @@ -68,7 +69,7 @@ COMMON_LIBS=-Wl,--as-needed
MACHINE:=$(shell uname -m)

install: pack
tar cvzf $(BINDIR)/bossa-$(MACHINE)-$(VERSION).tgz -C $(BINDIR) bossa$(EXE) bossac$(EXE)
tar cvzf $(BINDIR)/bossa-$(MACHINE)-$(VERSION).tgz -C $(BINDIR) bossa$(EXE) bossac$(EXE) bossash$(EXE)
endif

#
Expand All @@ -95,6 +96,7 @@ install: pack app
hdiutil attach -noautoopen $(BINDIR)/$(DMG)
cp -R $(BINDIR)/$(APP) /Volumes/$(VOLUME)/
cp $(BINDIR)/bossac$(EXE) /Volumes/$(VOLUME)/
cp $(BINDIR)/bossash$(EXE) /Volumes/$(VOLUME)/
ln -s /Applications /Volumes/$(VOLUME)/Applications
ln -s /usr/bin /Volumes/$(VOLUME)/bin
mkdir /Volumes/$(VOLUME)/.background
Expand All @@ -115,6 +117,7 @@ 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))
BOSSASH_OBJS=$(APPLET_OBJS) $(COMMON_OBJS) $(foreach src,$(BOSSASH_SRCS),$(OBJDIR)/$(src:%.cpp=%.o))

#
# Dependencies
Expand All @@ -123,6 +126,7 @@ DEPENDS=$(COMMON_SRCS:%.cpp=$(OBJDIR)/%.d)
DEPENDS+=$(APPLET_SRCS:%.asm=$(OBJDIR)/%.d)
DEPENDS+=$(BOSSA_SRCS:%.cpp=$(OBJDIR)/%.d)
DEPENDS+=$(BOSSAC_SRCS:%.cpp=$(OBJDIR)/%.d)
DEPENDS+=$(BOSSASH_SRCS:%.cpp=$(OBJDIR)/%.d)

#
# Tools
Expand All @@ -136,17 +140,19 @@ ARMOBJCOPY=$(ARM)objcopy
#
# CXX Flags
#
COMMON_CXXFLAGS+=-Wall -Werror -MT $@ -MD -MP -MF $(@:%.o=%.d) -DVERSION=\"$(VERSION)\" -g
COMMON_CXXFLAGS+=-Wall -Werror -MT $@ -MD -MP -MF $(@:%.o=%.d) -DVERSION=\"$(VERSION)\" -g -O2
WX_CXXFLAGS:=$(shell wx-config --cxxflags) -DWX_PRECOMP -Wno-ctor-dtor-privacy -O2 -fno-strict-aliasing
BOSSA_CXXFLAGS=$(COMMON_CXXFLAGS) $(WX_CXXFLAGS)
BOSSAC_CXXFLAGS=$(COMMON_CXXFLAGS)
BOSSASH_CXXFLAGS=$(COMMON_CXXFLAGS) -Isrc/arm-dis

#
# LD Flags
#
COMMON_LDFLAGS+=-g
BOSSA_LDFLAGS=$(COMMON_LDFLAGS)
BOSSAC_LDFLAGS=$(COMMON_LDFLAGS)
BOSSASH_LDFLAGS=$(COMMON_LDFLAGS)

#
# Libs
Expand All @@ -155,11 +161,12 @@ COMMON_LIBS+=
WX_LIBS:=$(shell wx-config --libs)
BOSSA_LIBS=$(COMMON_LIBS) $(WX_LIBS)
BOSSAC_LIBS=$(COMMON_LIBS)
BOSSASH_LIBS=-lreadline $(COMMON_LIBS)

#
# Main targets
#
all: $(BINDIR)/bossa$(EXE) $(BINDIR)/bossac$(EXE)
all: $(BINDIR)/bossa$(EXE) $(BINDIR)/bossac$(EXE) $(BINDIR)/bossash$(EXE)

#
# Common rules
Expand Down Expand Up @@ -215,6 +222,16 @@ $(OBJDIR)/$(1:%.cpp=%.o): $(SRCDIR)/$(1)
endef
$(foreach src,$(BOSSAC_SRCS),$(eval $(call bossac_obj,$(src))))

#
# BOSSASH rules
#
define bossash_obj
$(OBJDIR)/$(1:%.cpp=%.o): $(SRCDIR)/$(1)
@echo CPP $$<
$$(Q)$$(CXX) $$(BOSSASH_CXXFLAGS) -c -o $$@ $$<
endef
$(foreach src,$(BOSSASH_SRCS),$(eval $(call bossash_obj,$(src))))

#
# BMP rules
#
Expand All @@ -231,6 +248,9 @@ $(foreach bmp,$(BOSSA_BMPS),$(eval $(call bossa_bmp,$(bmp))))
$(OBJDIR):
@mkdir $@

$(OBJDIR)/arm-dis:
@mkdir $@

$(BINDIR):
@mkdir $@

Expand All @@ -247,6 +267,11 @@ $(BINDIR)/bossac$(EXE): $(BOSSAC_OBJS) | $(BINDIR)
@echo LD $@
$(Q)$(CXX) $(BOSSAC_LDFLAGS) -o $@ $(BOSSAC_OBJS) $(BOSSAC_LIBS)

$(BOSSASH_OBJS): | $(OBJDIR) $(OBJDIR)/arm-dis
$(BINDIR)/bossash$(EXE): $(BOSSASH_OBJS) | $(BINDIR)
@echo LD $@
$(Q)$(CXX) $(BOSSASH_LDFLAGS) -o $@ $(BOSSASH_OBJS) $(BOSSASH_LIBS)

pack-bossa: $(BINDIR)/bossa$(EXE)
@echo UPX $^
$(Q)upx $^
Expand All @@ -255,7 +280,11 @@ pack-bossac: $(BINDIR)/bossac$(EXE)
@echo UPX $^
$(Q)upx $^

pack: strip pack-bossa pack-bossac
pack-bossash: $(BINDIR)/bossash$(EXE)
@echo UPX $^
$(Q)upx $^

pack: strip pack-bossa pack-bossac pack-bossash

strip-bossa: $(BINDIR)/bossa$(EXE)
@echo STRIP $^
Expand All @@ -265,7 +294,11 @@ strip-bossac: $(BINDIR)/bossac$(EXE)
@echo STRIP $^
$(Q)strip $^

strip: strip-bossa strip-bossac
strip-bossash: $(BINDIR)/bossash$(EXE)
@echo STRIP $^
$(Q)strip $^

strip: strip-bossa strip-bossac strip-bossash

clean:
@echo CLEAN
Expand Down
22 changes: 22 additions & 0 deletions README
@@ -0,0 +1,22 @@
BOSSA 1.2

FILES
-----
bossa-1.2.msi -- Windows 2000+
bossa64-1.2.msi -- Windows 2000+ 64-bit
bossa-i686-1.2.tgz -- Linux GTK
bossa-x86_64-1.2.tgz -- Linux GTK 64-bit
bossa-1.2.dmg -- MAC OS X 10.6+

NEW IN THIS RELEASE
-------------------
* New BOSSA shell command line application to do basic memory, flash, and PIO diagnostics
* Workaround for SAM3U firmware bug
* Fixed a bug with setting boot to flash bit on SAM3 devices

RELEASE NOTES
-------------
* The OS X USB driver detects an Atmel device as a USB modem. When prompted about a new network interface, click Cancel to continue.
* Some stability issues have been seen with the OS X USB driver using BOSSA. When running BOSSA a second time to the same Atmel device, the USB driver can lock up causing BOSSA to freeze. As a workaround, always disconnect and reconnect the Atmel device before running BOSSA again.
* The firmware inside of SAM3U devices has a bug where non-word flash reads return zero instead of the real data. BOSSA implements a transparent workaround for flash operations that copies flash to SRAM before reading. Direct reads using the BOSSA shell will see the bug.
* There are reports that the USB controller in some AMD-based systems has difficulty communicating with SAM devices. The only known workaround is to use a different, preferrably Intel-based, system.
1 change: 0 additions & 1 deletion install/bossa.wxs
Expand Up @@ -4,7 +4,6 @@

<?define Manufacturer="ShumaTech"?>
<?define Product="BOSSA"?>
<?define Version="1.1"?>

<Product Id="*"
Name="$(var.Product) $(var.Version)"
Expand Down
110 changes: 55 additions & 55 deletions src/Applet.h
@@ -1,55 +1,55 @@
///////////////////////////////////////////////////////////////////////////////
// BOSSA
//
// Copyright (C) 2011 ShumaTech http://www.shumatech.com/
//
// 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 3 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 <http://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////////////////////////////
#ifndef _APPLET_H
#define _APPLET_H

#include <stdint.h>

#include "Samba.h"

class Applet
{
public:
Applet(Samba& samba,
uint32_t addr,
uint8_t* code,
uint32_t size,
uint32_t start,
uint32_t stack,
uint32_t reset);
virtual ~Applet() {}

virtual uint32_t size() { return _size; }
virtual uint32_t addr() { return _addr; }

virtual void setStack(uint32_t stack);

virtual void run();
virtual void runv();

protected:
Samba& _samba;
uint32_t _addr;
uint32_t _size;
uint32_t _start;
uint32_t _stack;
uint32_t _reset;
};

#endif // _APPLET_H
///////////////////////////////////////////////////////////////////////////////
// BOSSA
//
// Copyright (C) 2011 ShumaTech http://www.shumatech.com/
//
// 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 3 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 <http://www.gnu.org/licenses/>.
///////////////////////////////////////////////////////////////////////////////
#ifndef _APPLET_H
#define _APPLET_H

#include <stdint.h>

#include "Samba.h"

class Applet
{
public:
Applet(Samba& samba,
uint32_t addr,
uint8_t* code,
uint32_t size,
uint32_t start,
uint32_t stack,
uint32_t reset);
virtual ~Applet() {}

virtual uint32_t size() { return _size; }
virtual uint32_t addr() { return _addr; }

virtual void setStack(uint32_t stack);

virtual void run();
virtual void runv();

protected:
Samba& _samba;
uint32_t _addr;
uint32_t _size;
uint32_t _start;
uint32_t _stack;
uint32_t _reset;
};

#endif // _APPLET_H

0 comments on commit acea002

Please sign in to comment.