MS2 development/coding for dummies

This is a forum for discussing the development and testing of alpha MS2/Extra code. Documentation
(Runs on MS2 and Microsquirt)

Moderators: jsmcortina, muythaibxr

Fabius72
Experienced MS/Extra'er
Posts: 216
Joined: Sat Feb 07, 2009 12:17 am
Location: Aosta - Italy

Re: MS2 development/coding for dummies

Post by Fabius72 »

Hi all,
just to say that it works! My problem solved.
I have modified some values on the three tables with a single burn and TS shows an Difference Report with all changes I've made :yeah!:
Though I was lucky because it was a simple thing. ( i.e. I would like to have Spark & VE tables on the same page, but this is so difficult to me).

Cheers,
Fabio
Yamaha V-Max V4 paired odd-fire 1200cc engine - ITB - COP
MS2/Extra Pre 3.4 beta 11
Sequential spark & fuel - ITB Algorithm
Maverick5992
MS/Extra Newbie
Posts: 2
Joined: Tue Jun 09, 2015 3:42 pm

Re: MS2 development/coding for dummies

Post by Maverick5992 »

Hi, I have a couple of questions here.
currently we have an MS2 with firmware v3.2.5 flashed using the precompiled ms2_extra.s19 file. as a part of our graduation project we need to experiment a little with that code, I have been trying to compile it as is for a couple of days with no success except by using the VM that acab shared (thanks acab) but even then it produces a .s19 file that doesn't match the pre-compiled one. Only the pre3.3.2beta1 compiles the exact same file (diff gives no output)

So my questions are :
1- For v3.2.5 , was the pre-compiled .s19 made using the old tools (from 2010) ? and is that why it's different when I make it myself ?
I can't test it on the field for a couple of days but I'm on a deadline and finding out I can't compile right then would be a disaster !!

2- I tried installing the tools on cygwin and Ubuntu with no success following the exact instructions provided in the README and with the minor modifications, I realize the instructions are very clear but it still doesn't work, I noticed /usr/bin/m68hc11-elf-gcc.exe and another file have 0 size, I understand they are symbolic links but this particular file doesn't seem to work at all ( I get an error for missing ms2_extra_main.o so I think this is exactly where the problem is).

What I did was firing up cygwin, put a copy of tools.tar.gz in C:/cygwin64, typing

Code: Select all

cd /
tar xfz tools.tar.gz


then cd to the ms2extra folder and

Code: Select all

make
I am testing with 2010 tools and this is what I get:

Code: Select all

make --makefile Makefile.ms2
make[1]: Entering directory '/ms2extra_3.2.release/ms2extra_3.2.5_release/ms2exta'
echo '// setup for Megasquirt' > us_opt_c.h
echo '; setup for Megasquirt' > us_opt_asm.inc
/usr/bin/m9s12x-elf-gcc -g -Wall -Werror -O -fomit-frame-pointer -m68hcs12 -mshot -msoft-reg-count=5 -mauto-incdec -fsigned-char -DGCC_BUILD -c ms2_extra_mai.c -o ms2_extra_main.o
Makefile.ms2:47: recipe for target 'ms2_extra_main.o' failed
make[1]: *** [ms2_extra_main.o] Error 127
make[1]: Leaving directory '/ms2extra_3.2.release/ms2extra_3.2.5_release/ms2extr'
Makefile:16: recipe for target 'megasquirt' failed
make: *** [megasquirt] Error 2
for the 2012 tools I edit the makefile to replace m9s12x with m68h11 , I am not experienced enough to mess any more than that with a makefile. What am I doing wrong ??

Mohamed
Maverick5992
MS/Extra Newbie
Posts: 2
Joined: Tue Jun 09, 2015 3:42 pm

Re: MS2 development/coding for dummies

Post by Maverick5992 »

Alright, so I solved it and thought I would share.
I realized all my attempts were on 64-bit platforms except for the one that actually worked. I was stupid enough to download Cygwin64 just because I have 64-bit Windows, didn't pay attention to the binaries themselves.

So now I tried the 2010 tools, compiled on first try with no errors and the produced .s19 is perfectly similar to the pre-compiled version.
Tried again with the 2012 tools, produces exactly the same file I got on the VM , different from the precompiled.

I sure am glad I got to the bottom of this. Other posts in this thread suggest that this difference is ok and it even handles a bug. I'd be glad if you guys confirmed that.

Mohamed
Fabius72
Experienced MS/Extra'er
Posts: 216
Joined: Sat Feb 07, 2009 12:17 am
Location: Aosta - Italy

Re: MS2 development/coding for dummies

Post by Fabius72 »

I'm working with an Linux Mint 64bit platform and following the clear instructions provided with the tool, all has worked as expected (i.e I have had no problem since the first attempt).
md5sum of the provided .s19 file gave the same result of the one compiled by my machine.


Summarizing what I did for an MS2Extra on Linux Mint 64bit platform: (like Ubuntu)

1) download and extract s12buildtools-linux32bit-2012-10-24 wherever you want
2) open the extracted archive "tools.tar.gz" as administrator
3) extract the contained folder "usr" on the File system "/" (where the o.s. is)
3) extract on the home folder the downloaded actual firmware ms2extra-pre3.4beta11 (it contain the source code)
4) enter on the folder extracted and copy the four ms2loader_ files on the sub folder "ms2extra/utils"
5) open a terminal
6) cd ms2extra-pre3.4beta11/ms2extra
7) make clean (to delete all the old files created during the last compile, if presents)
8 ) make release (command to compile the source files)

don't close the terminal,
now on the ms2extra folder you can find a new sub folder named "release" that contain all the new files created

than
9) cd release
10) md5sum megasquirt2.s19 take note of the result shown
11) cd ..
12) cd .. (to go to the main folder "ms2extra-pre3.4beta11/" )
13) md5sum megasquirt2.s19 again but of the original one
14) compare the two results and obviously, if the compiler has well worked, the calculated numbers given by md5sum must be identical.
15) done

Hope that can help someone.

Cheers,
Fabio


(EDIT: I have edited the second last post of page#5 because I forgot to mention about an error I did and to explain how I finally got it working)
Yamaha V-Max V4 paired odd-fire 1200cc engine - ITB - COP
MS2/Extra Pre 3.4 beta 11
Sequential spark & fuel - ITB Algorithm
frontrangeFJ40
MS/Extra Newbie
Posts: 32
Joined: Sun Jul 31, 2016 6:42 am

Re: MS2 development/coding for dummies

Post by frontrangeFJ40 »

Guys - I'm trying to build on a 64 bit Win10, using 64 bit Cygwin and the 2012 tools but got this and couldn't find any other references. Any ideas please?

$ make release
rm -f -rf release *~
make clean_all
make[1]: Entering directory '/home/steve/ms2extra-release-3.4.2/ms2extra'
rm -f -f megasquirt2.elf microsquirt.elf microsquirt-module.elf mspnp2.elf
rm -f -f megasquirt2.s19 microsquirt.s19 microsquirt-module.s19 mspnp2.s19
rm -f -f megasquirt2.dmp microsquirt.dmp microsquirt-module.dmp mspnp2.dmp
rm -f -f megasquirt2.map microsquirt.map microsquirt-module.map mspnp2.map
rm -f -f megasquirt2.ini microsquirt.ini microsquirt-module.ini mspnp2.ini
rm -f -f ms2_extra_main.o ms2_extra_can.o ms2_extra_can_isr.o ms2_extra_ego.o ms2_extra_ign.o ms2_extra_ign_wheel.o ms2_extra_misc.o premain.o ms2_extra_init.o sigs.o ms2_extra_ign_in.o ms2_extra_inj.o ms2_extra_idle.o ms2_extra_user.o serial.o msii_flash_gcc.o ms2_sermon.o ms2_conferr.o ms2_extra_burner.o isr_inj.o isr_sci.o isr_rtc.o ms2_extra_asm.o isr_timerovf.o isr_ign.o crc32.o interp.o
rm -f -f us_opt_c.h
rm -f -f us_opt_asm.inc ms2_extra_defines.h ms2_extra_defines.inc ms2_extra_main_vars.h
make[1]: Leaving directory '/home/steve/ms2extra-release-3.4.2/ms2extra'
rm -f -f ms2_extra_ign.o ms2_extra_ign_in.o ms2_extra_init.o ms2_extra_misc.o isr_ign.o isr_inj.o isr_rtc.o ms2_extra_main.o ms2_extra_idle.o ms2_extra_inj.o sigs.o ms2_extra_defines.h ms2_extra_defines.inc ms2_extra_main_vars.h
make make_megasquirt2
make[1]: Entering directory '/home/steve/ms2extra-release-3.4.2/ms2extra'
echo '// setup for Megasquirt' > us_opt_c.h
echo '; setup for Megasquirt' > us_opt_asm.inc
grep -v "^#[12345]" ms2extra.ini | sed 's/^#0//' > megasquirt2.ini
echo "/* DO NOT EDIT - this file is automatically generated during build */" > ms2_extra_defines.h
grep "^#define" ms2_extra_vars.h >> ms2_extra_defines.h
echo "; DO NOT EDIT - this file is automatically generated during build" > ms2_extra_defines.inc
grep "^#define" ms2_extra_vars.h | awk '{print ".equ",$2,",",$3};' >> ms2_extra_defines.inc
echo "/* DO NOT EDIT - this file is automatically generated during build */" > ms2_extra_main_vars.h
cat ms2_extra_vars.h | sed 's/extern //' | grep -v "^#" >> ms2_extra_main_vars.h
/usr/bin/m68hc11-elf-gcc -g -Wall -Werror -Wsign-compare -Wshadow -O -fomit-frame-pointer -m68hcs12 -mshort -msoft-reg-count=5 -mauto-incdec -fsigned-char -c ms2_extra_main.c
make[1]: *** [Makefile:158: ms2_extra_main.o] Error 127
make[1]: Leaving directory '/home/steve/ms2extra-release-3.4.2/ms2extra'
make: *** [Makefile:56: megasquirt] Error 2
jsmcortina
Site Admin
Posts: 39569
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

Try the 32bit version of Cygwin.

I don't know why this fails, but I've seen it reported previously.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
frontrangeFJ40
MS/Extra Newbie
Posts: 32
Joined: Sun Jul 31, 2016 6:42 am

Re: MS2 development/coding for dummies

Post by frontrangeFJ40 »

Thanks James, the 32 bit version has fixed the problem.
frontrangeFJ40
MS/Extra Newbie
Posts: 32
Joined: Sun Jul 31, 2016 6:42 am

Re: MS2 development/coding for dummies

Post by frontrangeFJ40 »

Another question - I've been reading up on the HCS12 programming and keep seeing where the serial loader is seriously deprecated vs BDM for speed and reliability, so I looked at the BDM hardware, which is very cheap and bought one. I have the Windows drivers installed and the device is now recognized, so now I'm looking for a loader tool. Any recommendations for WIN10 or 7? I know Codewarrior will load via BDM, but it seems like a lot to install and learn for just the BDM loader part of the package. I'm using this for the MS2 processor on a version 3.0 board if that matters at all.
jsmcortina
Site Admin
Posts: 39569
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

It's best to use the serial loader like everyone else to load the firmware. I've never tried using BDM.

Our source code isn't compatible with Codewarrior syntax. Even if it was, you would need the $1k(?) "standard" version to build that large a project.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
frontrangeFJ40
MS/Extra Newbie
Posts: 32
Joined: Sun Jul 31, 2016 6:42 am

Re: MS2 development/coding for dummies

Post by frontrangeFJ40 »

OK, but I never planned on using C/W to build the project, I was just mentioning that I knew the included BDM loader in the C/W library was one option. The loader and assembler in C/W don't have the 32K limit that exists for C sources.

It still seems to me that if the rest of the Freescale world is using BDM, I'd like to learn how to do that. I'm thinking about just buying another MS2 daughter card and giving it a go. I could use a spare anyway. If I do bollix the MS2, is there a way to recover/reload the serial loader? Is the serial loader M/S specific, or is it the standard Freescale serial loader?

TIA
jsmcortina
Site Admin
Posts: 39569
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

frontrangeFJ40 wrote:It still seems to me that if the rest of the Freescale world is using BDM, I'd like to learn how to do that. I'm thinking about just buying another MS2 daughter card and giving it a go. I could use a spare anyway. If I do bollix the MS2, is there a way to recover/reload the serial loader? Is the serial loader M/S specific, or is it the standard Freescale serial loader?
Trying to use BDM to load modified firmware is over complicating things. For it to work you would need to load the monitor AND the firmware having, I presume created a co-joined S19 file. As I say, I've never tried it. Unless you have a very good reason to do that and understand exactly why, don't.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
esso
Helpful MS/Extra'er
Posts: 65
Joined: Sat May 22, 2010 10:51 pm

Re: MS2 development/coding for dummies

Post by esso »

ok i have made some minor changes in firmwares MS1 MS2 , and was successfully but only edit some rules not adding new one
my concern now that i want to add a new features with new codes mainly from MS3 . i will remove some unwanted features from MS2 and add some feature from MS3 (tables , code ,....etc )
to add a feature in MS2 like antilag , i need to know the procedure of doing it . to add code , table codes and the part missing how to free memory and asign new feature to the memory
just if have a guide for this will be helpful

thanks
jsmcortina
Site Admin
Posts: 39569
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

If you want to add anti-lag you need to write it from scratch. The MS3 code license does not permit back-porting to MS2.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
esso
Helpful MS/Extra'er
Posts: 65
Joined: Sat May 22, 2010 10:51 pm

Re: MS2 development/coding for dummies

Post by esso »

please illustrate more ? i will write it from scratch for sure but just take the code as a reference and implement it into MS2
Manu
Master MS/Extra'er
Posts: 723
Joined: Mon Feb 15, 2010 4:57 am
Location: Alès - France
Contact:

Re: MS2 development/coding for dummies

Post by Manu »

I guess that taking MS3 code for reference is close to back port code. If you want to implement new function to ms2 it's up to you to use a different method/algo to do it, as Baldur done in the past.
I can supply, repair or upgrade Megasquirts in FRANCE.

Image
https://www.megasquirt.fr
sunfield
MS/Extra Newbie
Posts: 29
Joined: Mon Jun 30, 2008 11:54 am
Location: Apeldoorn, Netherlands

Re: MS2 development/coding for dummies

Post by sunfield »

I am using the makefile for the ms2 extra but got the massage the file "...../m68hc11-elf-gcc : no such file ..". Without Google I can not found this file. Who can help me to get this file.


Verstuurd vanaf mijn Nexus 10 met Tapatalk
jsmcortina
Site Admin
Posts: 39569
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

Sounds like you didn't install the toolchain.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
sunfield
MS/Extra Newbie
Posts: 29
Joined: Mon Jun 30, 2008 11:54 am
Location: Apeldoorn, Netherlands

Re: MS2 development/coding for dummies

Post by sunfield »

jsmcortina wrote:Sounds like you didn't install the toolchain.

James
Can you give me soms hints to installatie the toolchain. I can not find it in the setup from the cygwin. The site www.gnu... is not accessable.


Verstuurd vanaf mijn Nexus 10 met Tapatalk
jsmcortina
Site Admin
Posts: 39569
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
sunfield
MS/Extra Newbie
Posts: 29
Joined: Mon Jun 30, 2008 11:54 am
Location: Apeldoorn, Netherlands

Re: MS2 development/coding for dummies

Post by sunfield »

jsmcortina wrote:See the third post here: http://www.msextra.com/forums/viewtopic ... 01#p308151

James
The upload went well. The tar created the directory d:/usr/.... In the usr/bin the are a lot of variations of m68hc11-elf-....... But the file I expected m68hc11-elf-gcc has the extention .exe and there is no one named without extention. What am I doing wrong?

Verstuurd vanaf mijn Nexus 10 met Tapatalk
Post Reply