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

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

Re: MS2 development/coding for dummies

Post by jsmcortina »

aut0m4tic1 wrote:James:
I notice that on line 11 there are 4 references to "usr/bin/m9s12x-elf-gcc do these need to be edited also?
Yes.

See if there are more.
$ grep m9s12x *

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".
aut0m4tic1
Experienced MS/Extra'er
Posts: 201
Joined: Mon Feb 06, 2012 12:32 pm
Location: Layton, Utah

Re: MS2 development/coding for dummies

Post by aut0m4tic1 »

James:

Success!! I also had to add the complete path to the elf files on line 11.
Now to the original reason I wanted to learn how to do this. In the ini file the pwm idle section has a multiplier/scaler or whatever of 0.398 or something and my pwm iac has a resolution of 0.4. Can I modify this to 0.1 and get better resolution, or is this set to match up with the pwm frequency of the microcontroller?

Thanks for the pointers.
Cory
jsmcortina
Site Admin
Posts: 39587
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

aut0m4tic1 wrote:James:

Success!! I also had to add the complete path to the elf files on line 11.
Now to the original reason I wanted to learn how to do this. In the ini file the pwm idle section has a multiplier/scaler or whatever of 0.398 or something and my pwm iac has a resolution of 0.4. Can I modify this to 0.1 and get better resolution, or is this set to match up with the pwm frequency of the microcontroller?
That won't work as it is limited by software PWM. Try upgrading to the pre-3.3 code as that uses a software dither technique for improved resolution.

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".
aut0m4tic1
Experienced MS/Extra'er
Posts: 201
Joined: Mon Feb 06, 2012 12:32 pm
Location: Layton, Utah

Re: MS2 development/coding for dummies

Post by aut0m4tic1 »

Thanks James, will do. :smile:
burkgul
MS/Extra Newbie
Posts: 2
Joined: Tue Jul 30, 2013 12:20 pm

Re: MS2 development/coding for dummies

Post by burkgul »

This worked for me in Win 7 64-bit:

1. Download and install Cygwin 32-bit and include the GNU version of make.
2. Download s12buildtools-win32.zip, extract and move "tools.tar.gz" to "c:\".
3. In Cygwin terminal, enter "cd c:/" and then enter "tar xfz tools.tar.gz".
4. Download and extract ms2extra_3.2.5_release.zip to "c:\usr\".
5. In Cygwin terminal, enter "cd c:/usr/ms2extra_3.2.5_release/ms2extra/" and then enter "make release".

To test if compiled binaris differ from the precompiled, enter "diff c:/usr/ms2extra_3.2.5_release/ms2extra/release/ms2_extra.s19 c:/usr/ms2extra_3.2.5_release/ms2_extra.s19" in Cygwin terminal. If compiled binaris differ from the precompiled, a list of the differences will appear. If not, success!
Last edited by burkgul on Tue Aug 06, 2013 7:11 am, edited 1 time in total.
acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: MS2 development/coding for dummies

Post by acab »

i have virtual pc with ubuntu server with all for compilating.
i can share.
jsmcortina
Site Admin
Posts: 39587
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

I found this doc last night that explain why we have to handle multiplies with casts. Although it is from Texas, it is highly applicable to us also.

http://www.ti.com/lit/an/spra683/spra683.pdf

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".
jsmcortina
Site Admin
Posts: 39587
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

The Debian S12 tools aren't what you need. Install the tools linked here.
i.e. http://www.msextra.com/tools/

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".
acab
Experienced MS/Extra'er
Posts: 243
Joined: Tue Aug 21, 2012 5:52 am

Re: MS2 development/coding for dummies

Post by acab »

I make little cheat for new dummies :)

1. Download and install VirtualBox.
2. Download and install PuTTY SSH client for work in console of VM.
3. Download and install WinSCP SFTP client for coping files.
4. Download and unpack my pre-builded Debian VM with all tools for compilating.
5. Run and enjoy VM via VirtualBox.
6. Log in to VM via user ms and password 123456. Root password is msextra.
7. Build your code for new versions of Megasquirt!
aut0m4tic1
Experienced MS/Extra'er
Posts: 201
Joined: Mon Feb 06, 2012 12:32 pm
Location: Layton, Utah

Re: MS2 development/coding for dummies

Post by aut0m4tic1 »

So... I'm setup where I can build a s19, but I don't really understand how the code is organized. (I might need a "coding for complete freakin idiots" book) I am only vaguely familiar with C, and that's probably my biggest hurdle. I don't have a specific goal in mind, I'm just interested in how the code works and enjoy learning. Ive programmed in the arduino environment, but this is way more advanced. Ive read almost every line of code including the ini. Is there a general outline for this uController somewhere?
Thanks
Cory
jsmcortina
Site Admin
Posts: 39587
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

aut0m4tic1 wrote:Is there a general outline for this uController somewhere?
Thanks
Cory
Go to www.freescale.com and download the datasheet for MC9S12C64

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".
stefracer
MS/Extra Newbie
Posts: 1
Joined: Tue Mar 04, 2014 4:47 am

Re: MS2 development/coding for dummies

Post by stefracer »

Dear All,

I woiuld like to know how to change the frequencty of the boostcontrol.
I need 250 Hz and ony 73 Hz is avalible. I am in the process of searching the code but have not found it yet.
Can anyone tell me where in the code the frequency is set?
Or is what i want not possible at all.

I want to use a duty cycle controlled throttle body to control boost by means of controlling air flow in the intake side of my rotrex supercharger/compressor.

any help is apreciated

Regards

Stef de Winter
Belal Elkady
MS/Extra Newbie
Posts: 5
Joined: Tue Mar 11, 2014 3:28 am

Re: MS2 development/coding for dummies

Post by Belal Elkady »

please can any one help me in this post

http://www.msextra.com/forums/viewtopic ... 51#p394351
Nfsjunkie91
MS/Extra Newbie
Posts: 8
Joined: Sun Jan 12, 2014 9:19 pm

Re: MS2 development/coding for dummies

Post by Nfsjunkie91 »

Currently attempting to compile virgin MS2E 3.3.1A. Followed all the readmes, I get the error that is attached to this post. I'm running 64 bit Win7, so I also tried the suggestions made in burkgul's post from last August but I continue to get the same error. I am now attempting to download the custom Debian distro from acab and am going to give that a shot. I'll be reporting back shortly with my findings.

Something I feel that may be happening is that Cygwin is not allowed to write new files, then again the "make clean" command works just fine, as does writing the us_opt_c.h etc. I'm looking in to that too.

EDIT: Using the Debian development v-box that as uploaded in this thread compiled it just fine. Thanks to acab for that one.
jsmcortina
Site Admin
Posts: 39587
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: MS2 development/coding for dummies

Post by jsmcortina »

What happens if you try to run the gcc line (all of it) from the command line ?

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".
firyembers
MS/Extra Newbie
Posts: 7
Joined: Sat Aug 13, 2011 9:51 am

Re: MS2 development/coding for dummies

Post by firyembers »

Hi There

Not sure if i am hijacking or interfering with this thread(moderators please do accordingly)

This link i was guided to via Matt from DIYAutoTune when i asked for guidance to achieve my goal

I want to run my gpz 1260 with suzuki tb that has dual injectors and a second throttle valve.

The idea from Suzuki is big for max air and fuel for high speed and the 2nd valve for town work reduce the air.

I need to learn MS2 and rewrite the code to control i think from the iac already in place.

Since i am not a programmer of any kind,well except for gcodes and plc ladder stuff in for cnc machinery this is going to be a ride to learn

I would appreciate any suggestions,guide line pointers, whatever to help achieve my goal

I do not expect answers that is my job to do and learn,but a road to be shifted to will be appreciated..Thanks
gslender
Super MS/Extra'er
Posts: 1072
Joined: Fri Sep 16, 2011 5:29 am
Location: Brisbane, Australia
Contact:

Re: MS2 development/coding for dummies

Post by gslender »

firyembers wrote: I would appreciate any suggestions,guide line pointers, whatever to help achieve my goal

I do not expect answers that is my job to do and learn,but a road to be shifted to will be appreciated..Thanks
Start by just getting used to building apps with C or C++ so that you can be familiar with the build process, code and compiler errors, what code does what etc... something as simple as HelloWorld with more and more complexity to get you familiar would be best. If you try to jump into the firmware code 1st up, too much will be lost and unclear - so start small.

G
Mazda MX5 + MS3 Pro
firyembers
MS/Extra Newbie
Posts: 7
Joined: Sat Aug 13, 2011 9:51 am

Re: MS2 development/coding for dummies

Post by firyembers »

any particular version c or c++
Or all is good with ms2 code

This will be my ride fast and fun

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

Re: MS2 development/coding for dummies

Post by jsmcortina »

This looks like it could be useful for you
http://tartley.com/?p=358 I've skim-read the start only.

MS2/3 are coded in C and assembler. Not in C++. So make sure you learn the appropriate language.
Understanding bits, bytes and pointers is important.

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".
boofhead
MS/Extra Newbie
Posts: 23
Joined: Tue Dec 18, 2012 1:53 am

Re: MS2 development/coding for dummies

Post by boofhead »

C is a beautiful language. It is very simple to learn as it has a very small language construct set though it is hard to be skill at using it as it requires a lot of details to be managed. Building pointer trees and walking them, self managed memory management, and bit manipulation makes it very powerful, very fast and for less experienced easy to make mistakes. I love working with C.
Post Reply