tools: introduce shared tooling for using BOSSA#7068
Conversation
|
I approve the idea and the plan in the PR description, but I'm not really able to a code review presently @aabadie or @kaspar030 will have to do it. |
|
thanks for the heads up! |
aabadie
left a comment
There was a problem hiding this comment.
Found a typo ! Otherwise it looks good codewise.
dist/tools/bossa/bossa.sh
Outdated
| elif [ `uname` = "Darwin" ]; then | ||
| STTY_FLAG=-f | ||
| else | ||
| echo "error: your host system is not support by the bossa.sh script" |
| # define path to bossac binary | ||
| export BOSSAC ?= $(RIOTBASE)/dist/tools/bossa/bossac | ||
|
|
||
| # if we go with the default (BOSSA shipped with RIOT), we download and build |
There was a problem hiding this comment.
The autot build of bossa doesn't work for me. I have to build it first in dist:
$ make BOARD=arduino-mkr1000 -C examples/default flash
make: Entering directory '/home/aabadie/softs/src/riot/RIOT/examples/default'
Building application "default" for "arduino-mkr1000" with MCU "samd21".
[...]
env -u CXX make -C /home/aabadie/softs/src/riot/RIOT/dist/tools/bossa
mkdir -p /home/aabadie/softs/src/riot/RIOT/dist/tools/bossa/src
git clone "https://github.com/shumatech/BOSSA" "/home/aabadie/softs/src/riot/RIOT/dist/tools/bossa/src"
Cloning into '/home/aabadie/softs/src/riot/RIOT/dist/tools/bossa/src'...
[...]
COMMON_CXXFLAGS="-std=c++11" make -C /home/aabadie/softs/src/riot/RIOT/dist/tools/bossa/src strip-bossac
CPP APPLET src/WordCopyArm.cpp
CPP COMMON src/Samba.cpp
CPP COMMON src/Flash.cpp
[...]
LD /home/aabadie/softs/src/riot/RIOT/examples/default/bin/arduino-mkr1000/bossac
STRIP /home/aabadie/softs/src/riot/RIOT/examples/default/bin/arduino-mkr1000/bossac
mv: cannot stat '/home/aabadie/softs/src/riot/RIOT/dist/tools/bossa/src/bin/bossac': No such file or directoryAs you can see, the BOSSA Makefile creates the executable in the application directory.
There was a problem hiding this comment.
hmm, will check where this comes from
4f1ef46 to
281e970
Compare
|
fixed the issue above and found one more that I fixed. In summery:
|
|
@aabadie would you mind to give this another test with your boards? Thanks! |
dist/tools/bossa/bossa.sh
Outdated
| fi | ||
|
|
||
| # now we flash the binary onto the target board | ||
| ${BOSSAC} --port="${PORT}" ${BOSSAC_FLAGS} "${HEXFILE}" |
There was a problem hiding this comment.
Please change the script to not use environment but cmdline for options (as far as easily possible).
Setting
FFLAGS:="-i -e -w -v -b -R --PORT=$(PORT) $(HEXFILE)"
in makefiles/tools/bossac.mk and using
${BOSSAC} $*
here keeps the configuration whithin the makefiles, and more consistent for different flashers.
Ideally you'd also create a phony target for stty, depend on that for flashing, and drop the shell script altogether.
281e970 to
270bd3e
Compare
|
done: removed the shell script and moved everything into |
|
Gave another try but still fails for the same reason. I'm not expert with Makefile so I can't really help. Maybe adding an error message if bossac is not present in either PATH or dist/tools/bossa would be enough for the moment. what do you think ? |
|
ups, seems like my last change broke something again. Will fix it |
|
its an issue I had earlier today, but though it was solved: the |
270bd3e to
a8cd4c4
Compare
|
just gave it another test with a freshly booted host system: it works as expected for me running from RIOTBASE dir: |
|
Tested this one again following the previous comment where there is a subtle difference with the command I tried: I did: The first one works and the second doesn't. So not passing BOARD as an environment variable messes up the destination directory of bossac. |
dist/tools/bossa/Makefile
Outdated
| @@ -0,0 +1,25 @@ | |||
| NAME = bossa | |||
There was a problem hiding this comment.
wait a minute, this PR was first :-). But I will adjust this, makes sense.
|
@aabadie: I see, so I more debugging is needed. I wonder why this subtle difference is screwing thing up... |
a8cd4c4 to
d0b959d
Compare
|
@kaspar030, @aabadie now using |
kaspar030
left a comment
There was a problem hiding this comment.
Minor nitpick regarding port name change.
Tested successfully on arduino due.
Don't have the other boards.
| export OFLAGS = -O binary | ||
| export FFLAGS = -R -e -w -v -b bin/$(BOARD)/$(APPLICATION).hex | ||
| # define the default port depending on host OS | ||
| PORT_LINUX ?= /dev/ttyACM0 |
There was a problem hiding this comment.
the default port name changed, is that intended?
what was it? |
| @echo "[INFO] compiling bossac from source now" | ||
| @env -u CXX COMMON_CXXFLAGS="-std=c++11" $(MAKE) BINDIR=$(PKG_BUILDDIR) -C $(PKG_BUILDDIR) strip-bossac | ||
| @mv $(PKG_BUILDDIR)/bossac $(CURDIR)/bossac | ||
|
|
There was a problem hiding this comment.
It would be nice to add a clean target ?
There was a problem hiding this comment.
should be implicit by using pkg.mk. try "make distclean"
Don't know if I really can explain what it was exactly, but when building with |
Hm, thought so, too. But just tried it out, and |
RIOTBASE=$(pwd) make -C dist/tools/bossa/ distclean ... cleans bin/. "bossac" would need an extra rule in "dist/tools/bossa/": ... and calling distclean for host tools should go into another PR. |
I pushed that into your branch. |
| @env -u CXX COMMON_CXXFLAGS="-std=c++11" $(MAKE) BINDIR=$(PKG_BUILDDIR) -C $(PKG_BUILDDIR) strip-bossac | ||
| @mv $(PKG_BUILDDIR)/bossac $(CURDIR)/bossac | ||
|
|
||
| distclean:: |
There was a problem hiding this comment.
why ::. I thought : is enough.
There was a problem hiding this comment.
tl;dr if there are multiple rules with the same name, they must use double colon.
There was a problem hiding this comment.
thanks, I'll have to read the Makefile manual in detail one day...
|
@aabadie PR's all yours. ;) |
Some boards (
arduino-due,udoo,arduino-mkr1000) shipped with some binaries for flashing, a tool called BOSSA (bossac). This is not only ugly, but does also bring problems with different host systems (32 vs 64 bit, different system compiler version...). The tool itself is open source and hosted on github, so there is actually no problem in downloading and building it ourselves.So what happening now is:
make flashfor your board (e.g. thearduino-due). Per default, RIOT tries to use it's ownbossacbinarybossacbinary from itThis PR brings the following improvements:
bossacfrom sourcemakefiles/tools/bossa.inc.mkthat can be used from different boardsdist/tools/bossa/bossa.shthat takes care of actually flashing a boardOpen issue:
Needs proper testing!