View unanswered posts | View active topics It is currently Thu Nov 15, 2018 6:56 am



Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Building FreeEMS on MacOS X 
Author Message
TO220 - Visibile

Joined: Sun Mar 07, 2010 5:55 pm
Posts: 12
I'm new to this forum and to ECU hacking in general, so I think a quick introduction is in order.

I'm located in Chicago, USA and am endeavoring to build an ECU for a genset unit. My ultimate goal is to have complete control and monitoring of my power generators over IP. Obviously, that's a pretty lofty goal, but I figured that this project was a great starting point.

I'm a fairly competent C programmer and have plenty of time to work on this. My electronics background is rather lacking compared to many of you, but I don't really see that as a limiting factor since much of the EE work can be gleaned from the interweb or the experts that seem to hang around here.

I already have the TA board and a jimstim. I was planning to buy a BDM box, but seeing that nobody else here uses them perhaps I'll spend that money on beverages for late-night hacking.


I've read quite a bit of the material here and want to congratulate you on what looks like a pretty nice piece of OSS. I managed to get a toolchain built and have also successfully compiled FreeEms.

I'm not entirely sure of the protocol on this, but I did have to make a quick change to the Makefile to get it to build. I'm not sure what ld you're using, but mine (2.17) doesn't have the
--print-gc-sections option. But, I didn't really think it was that important so I just removed it and everything built fine.

EDIT: I just read your thread about building on Windows and realized that you already knew about the print-gc-sections issue. I also noticed that you already asked for a MacOS tutorial. I'll go ahead and put one together.

I'm going to load it to the board in a few minutes and see what happens.

Also, if you'd like a quick tutorial on building the toolchain on Macos, I'm happy to write one.
Image


Mon Mar 08, 2010 3:28 am
Profile
TO220 - Visibile

Joined: Sun Mar 07, 2010 5:55 pm
Posts: 12
Mac OS 10.6 (Snow Leopard)
These instructions cover building Freeems on Snow Leopard. I don’t have a machine running original Leopard right now, so 10.6 is all you’re going to get. In theory, this should all work on 10.5, but YMMV.
Download and install Xcode
http://developer.apple.com/technologies/xcode.html
You’ll have to register for Apple developer network. Note that you need the newest Xcode they have available. The version on your CD probably has an outdated/screwed up autoconf.

Download and install fink
http://www.finkproject.org/download/srcdist.php
You’ll have to do a source install, since they don’t yet have a package for 10.6
During the fink install it will ask you about unstable, you need to answer YES.
If you miss this or forget to do it, you’ll have to run fink configure and enable it.
and then "you'll need to run a 'fink selfupdate' to pull in the packages, otherwise it will complain that the package doesn't exist" - Thanks

Once fink is installed and you have the unstable repo enabled, run the selfupdate like they request.
Also, don’t forget to add the fink init to your ~/.profile. They have instructions for this on the site and it reminds you after installing, but let this be an additional reminder.
Now, open a terminal and type
fink install m681x-binutils

It will run for a few minutes and throw an error about stat64.
(Note: You have to let it try the first time so that it will download everything so we can make the edits. I emailed the author of the package about fixing the snow leopard issues, but have not heard back from him yet, so this is currently the only way to do it.)
Now, you have to edit the fink info file for m681x-binutils.
Open a terminal and type:
(You could also use Textedit, but you’d have to run it from the prompt anyway so you can run it as root)

/sw/fink/10.4/unstable/main/finkinfo/devel
sudo vi m681x-binutils.info


Unless you’ve installed another console text editor, you’ll have to make the changes with vi. Here’s quick guide for the uninitiated:
http://www.cs.colostate.edu/helpdocs/vi.html

Image

Edit the ../configure line and add –disable-werror before –target

Now, you can run

fink install m681x-binutils

again to download and build the binutils.

Wait about 5 minutes or so for binutils to do it’s business. Once it’s done, you can go ahead and install the rest of the toolchain:

fink install m681x-gcc m681x-newlib m681x-gdb

Congratulations, you now have a functioning toolchain.

Building freeems

Download the newest freeems source distribution from

http://sourceforge.net/project/showfiles.php?group_id=214452&package_id=258422

Fire up terminal and cd to the directory where you downloaded the source file.
Extract it using tar, replace the filename with the exact name of your version:

tar xfvpj freeems-0.0.19-Doxygenated.tar.bz2

Once it’s extracted, cd into src inside the extracted directory

cd fredcooke-freeems-vanilla-f68b80facf5427b0b7e75ca953f9b0ac1c76869b/src

Now, back to vi for a minute to edit the Makefile
vi Makefile

Type:
/--print-gc and press Enter

Vi will find the line that we need to edit. Change the LINKOPTSGC from this:

LINKOPTSGC = -Wl,--gc-sections,--print-gc-sections,-defsym,vectors_addr=0xF710,-m,m68hc12elfb,-T,hc9s12xdp512elfb.x

To this:
LINKOPTSGC = -Wl,--gc-sections,-defsym,vectors_addr=0xF710,-m,m68hc12elfb,-T,hc9s12xdp512elfb.x

Removing the –print-gc-sections and the comma following it.
Save the file and quit vi

Cross your figners and type “make”
You should be met with a smiling happy face and a “Thanks for building FreeEMS”


Last edited by nhtshot on Sun Oct 03, 2010 4:59 am, edited 1 time in total.



Mon Mar 08, 2010 4:14 am
Profile
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 15194
Location: Home sweet home!
Firstly, thank you VERY much for an excellent write up and welcome to the board! :-)

Secondly, congratulations on being the first person to build FreeEMS on a Mac! :-) My sister has one, so I may even be able to get her round for a bit of testing if I'm nice to her.

Thirdly, this :

nhtshot wrote:
I already have the TA board and a jimstim. I was planning to buy a BDM box, but seeing that nobody else here uses them perhaps I'll spend that money on beverages for late-night hacking.

Made me laugh :-) You are more than welcome to be the first on that too, if you want.

Lastly, though it's currently not up to date, I'd recommend grabbing the latest code from github instead of or as well as the last release. In a few weeks it will be up to date and with a little luck this forum will, once again, come alive :-)

Awesome work! Thanks for signing up!!!

Fred.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Tue Mar 09, 2010 12:03 am
Profile WWW
LQFP112 - Up with the play
User avatar

Joined: Thu Sep 10, 2009 9:23 am
Posts: 244
Location: Dayton, OH
how many sean's are on this board ... at least it looks like you're a sean :lol2:

+1 on vi ;)


Wed Apr 14, 2010 3:30 am
Profile
TO220 - Visibile

Joined: Sun Mar 07, 2010 5:55 pm
Posts: 12
I am a Sean.


Thu Apr 15, 2010 1:47 pm
Profile
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 15194
Location: Home sweet home!
For now, I've linked this from the hacking guide :

viewtopic.php?f=8&t=508&p=6385#p6385

Thanks again! :-)

Fred.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Tue Apr 27, 2010 6:59 am
Profile WWW
QFP80 - Contributor

Joined: Wed Sep 15, 2010 10:36 pm
Posts: 33
I'm crunching through your guide right now, and I have a couple of updates:

1) If you didn't enable the unstable branch, when you do, you'll need to run a 'fink selfupdate' to pull in the packages, otherwise it will complain that the package doesn't exist

2) Looks like m681x-binutils has been fixed, it built clean on my 10.6 system

3) You also need to comment out this line in the Makefile to get it build on OSX:

PREFIX = m6811-elf-
#PREFIX = m68hc11-

(as the unix versions apparently use m6811-elf- as the bin prefix as explained in the comments...)

################################################################################
# #
# Thank you for building FreeEMS firmware!!! #
# #
################################################################################

Woot! Looks like I have some firmware. Now what to do with this new shiny blob of bits... hmmm ;)


Thu Sep 16, 2010 9:54 am
Profile
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 15194
Location: Home sweet home!
Cool, the second person to build it on a Mac :-)

In the future, SeanK will have a nice unified set of tools to use. At that point, mac, win, lin, will all share the same prefixes and those double options wont be required.

Fred.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Fri Sep 17, 2010 3:34 am
Profile WWW
DIP8 - Involved

Joined: Sat Sep 18, 2010 1:32 pm
Posts: 18
Location: Orangeville, Ontario, Canada
I'm having significantly more difficulty building this on my Mac.

1) the prefix needs to be changed to
GCCPREFIX = m6812-elf-
PREFIX = m6812-elf-
GCCLIBBASEDIR = /sw/share/m6812/lib/gcc-lib/m6812-elf/3.3.6-m68hc1x-20060122/

and now I get
m6812-elf-ld: /m68hc12/mshort: No such file: No such file or directory


Tue Sep 21, 2010 2:16 pm
Profile
DIP8 - Involved

Joined: Sat Sep 18, 2010 1:32 pm
Posts: 18
Location: Orangeville, Ontario, Canada
Here's my Makefile diff

diff --git a/src/Makefile b/src/Makefile
index cb726ba..1c80266 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -98,11 +98,10 @@ TAGNAME = $(OUTDIR)/gitTagName.txt
# of three . . . in a row or the line will be missing from
# the windows version. Likewise sets of ### longer than 6
# or so are also at risk :-)
-GCCLIBBASEDIR = /usr/lib/gcc-lib/m68hc11/3.3.6-m68hc1x-20060122
-GCCPREFIX = m6811-elf-
-GCCPREFIX = m68hc11-
+GCCLIBBASEDIR = /sw/share/m6812/lib/gcc-lib/m6812-elf/3.3.6-m68hc1x-20060122
+GCCPREFIX = m6812-elf-
PREFIX = m6811-elf-
-PREFIX = m68hc12-
+PREFIX = m6812-elf-
PATHSEP = \\
PATHSEP = /#...

@@ -257,7 +256,8 @@ GCCOPTS = $(GCCOPTS1) $(GCCOPTS2)
# pass to linker, link for hc12
# The vectors address in the linker options is the VMA address and must be short form 0xF710, not a paged address.
LINKOPTS = -defsym vectors_addr=0xF710 -T hc9s12xdp512elfb.x
-LINKOPTSGC = --gc-sections --print-gc-sections -defsym vectors_addr=0xF710 -T hc9s12xdp512elfb.x
+#LINKOPTSGC = --gc-sections --print-gc-sections -defsym vectors_addr=0xF710 -T hc9s12xdp512elfb.x
+LINKOPTSGC = --gc-sections -defsym vectors_addr=0xF710 -T hc9s12xdp512elfb.x
# Use this to get a map dump when the linker fails in a confusing way : --print-map

# If using the below option for paged flash, the ADDRESS_TYPE
@@ -530,7 +530,7 @@ $(ALLELFS): $(OUTDIR)/$(LABEL)-%.elf: $(OBJDIR)/%.o $(OBJECTS)
################################################################################
# Linking $@ ...
################################################################################
- $(LD) -o $@ -L$(GCCLIBBASEDIR)/m68hc12/mshort -L$(GCCLIBBASEDIR) -L/usr/m68hc11/lib $(LINKOPTS) $< $(GCCLIBBASEDIR):


Tue Sep 21, 2010 7:15 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 19 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF. ColorizeIt.