[Ovmsdev] Development on FreeBSD
Craig Leres
leres at xse.com
Sun Jun 24 03:49:29 HKT 2018
Initially I got a build environment up on a spare ubuntu system. But I
wanted to work under FreeBSD so I wrote FreeBSD port for the tool chain:
https://www.freshports.org/devel/xtensa-esp32-elf/
My ubuntu system says:
sea 1 % xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a)
5.2.0
And FreeBSD says:
ice 250 % xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG
crosstool-ng-1.22.0-80-g6c4433a5) 5.2.0
So I believe I have the same version. To make the tool chain available I
used:
mkdir ~/esp
ln -s ../../../../../usr/local/xtensa-esp32-elf ~/esp
A bonus of having the toolchain under FreeBSD is that (with a little
work) it should be possible to build esp32 arduino sketches (which BTW
is where all of my previous esp8266 and esp32 experience is).
In the process of getting this up I ran into a few rough edges.
First, on FreeBSD libintl.a is part of the gettext-runtime and installs
with /usr/local as the PREFIX. Attached is the change I made to
esp-idf/tools/kconfig/Makefile. It makes more sense to me to use -I and
-L based on what files are found rather than keying off OS/OSNAME but I
can't easily test this change on Windows. If this looks ok I can
generate a pull request.
I had trouble getting a working copy esp-idf. The developer guide says
to check out remotes/origin/release/v2.1 but that version was giving C
errors. Eventually I diff'ed against the copy I had on ubuntu and found
this to be a good set of instructions:
git clone https://github.com/openvehicles/esp-idf.git
cd esp-idf
git submodule update --init
I assume the v2.1 step is obsolete. When I need to update it I use:
git pull
git submodule update
(If correct) I think this would worth adding to the developers guide. (I
have to admit I'm pretty inexperienced with git; a majority of the work
I do is with subversion.)
The developers guid says to:
cp sdkconfig.default sdkconfig
This should be updated to
cp support/sdkconfig.default.hw31 sdkconfig
And there are a lot of new options missing from
support/sdkconfig.default.hw31. Maybe the guide should say, "using the
defaults is usually safe." (Would it be possible to automatically
generate a version of sdkconfig using the defaults and not asking any
questions?)
I cloned Open-Vehicle-Monitoring-System-3 and to update it I've been using:
git fetch upstream
git checkout master
git merge upstream/master
git push
My module is currently running:
3.1.007-2-gc3e62cc-dirty/ota_0/main (build idf
v3.1-dev-987-g55d915e9-dirty Jun 23 2018 12:04:27)
built on a FreeBSD 11.1-RELEASE system.
Craig
P.S. Thanks to Steve for all the offline help.
-------------- next part --------------
diff --git a/tools/kconfig/Makefile b/tools/kconfig/Makefile
index 2454e47a..2af54460 100644
--- a/tools/kconfig/Makefile
+++ b/tools/kconfig/Makefile
@@ -230,12 +230,20 @@ LOADLIBES_nconf = $(shell \
|| pkg-config --libs menu panel ncurses 2>/dev/null \
|| echo "-lmenu -lpanel -lncurses" )
-ifeq ("$(OS)","Windows_NT")
-# Windows toolchains don't seem to count libintl
-# as a system library
+# Sometimes libintl is in a separate library (Windows, FreeBSD)
+ifneq ($(wildcard /usr/local/lib/libintl.a),)
+LOADLIBES_mconf += -L/usr/local/lib -lintl
+LOADLIBES_nconf += -L/usr/local/lib -lintl
+
+ifneq ($(wildcard /usr/local/include/libintl.h),)
+CFLAGS += -I/usr/local/include
+endif
+else
+ifneq ($(wildcard /usr/lib/libintl.a),)
LOADLIBES_mconf += -lintl
LOADLIBES_nconf += -lintl
endif
+endif
qconf.o: .tmp_qtcheck
More information about the OvmsDev
mailing list