MS2 development/coding for dummies
Moderators: jsmcortina, muythaibxr
-
- Helpful MS/Extra'er
- Posts: 99
- Joined: Fri Feb 25, 2011 6:31 am
MS2 development/coding for dummies
Can anyone help me understand how to begin the task of looking through the MS code (just out of curiosity, to see if I can understand any of it)?
I'm 20+ years out of date, and even then I was working in Fortran or 8-bit assembler, but I thought "how hard can this be?". So I tried following the clues on another couple of threads here.
Downloaded Cygwin, which gives me a nice window with a command line prompt. Stared helplessly at that for a while. Quit.
Next I downloaded the windows zip file of tools. And on second thoughts the Linux version too. Now I'm going round in circles trying to copy what others did in the couple of threads I found. Getting nowhere and not at all aware of what I'm doing...
Grateful for any nudges in the right direction. Please be gentle. Even if I understand in principle what you are saying, syntax will probably fly harmlessly over my head. I have zero knowledge of Unix.
I'm 20+ years out of date, and even then I was working in Fortran or 8-bit assembler, but I thought "how hard can this be?". So I tried following the clues on another couple of threads here.
Downloaded Cygwin, which gives me a nice window with a command line prompt. Stared helplessly at that for a while. Quit.
Next I downloaded the windows zip file of tools. And on second thoughts the Linux version too. Now I'm going round in circles trying to copy what others did in the couple of threads I found. Getting nowhere and not at all aware of what I'm doing...
Grateful for any nudges in the right direction. Please be gentle. Even if I understand in principle what you are saying, syntax will probably fly harmlessly over my head. I have zero knowledge of Unix.
-
- Site Admin
- Posts: 39613
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: MS2 development/coding for dummies
If you just want to look at the code (not change and recompile it) then you don't need Cygwin or the tools.
The whole source for MS2/Extra is included within the MS2/Extra firmware zips in the "ms2extra" subdirectory.
The C files are *.c
The C headers are *.h
The assembler files are *.s
The assembler includes are *.inc
Fire up your chosen text editor, open a file and start reading.
James
The whole source for MS2/Extra is included within the MS2/Extra firmware zips in the "ms2extra" subdirectory.
The C files are *.c
The C headers are *.h
The assembler files are *.s
The assembler includes are *.inc
Fire up your chosen text editor, open a file and start reading.
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".
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".
-
- Super MS/Extra'er
- Posts: 1072
- Joined: Fri Sep 16, 2011 5:29 am
- Location: Brisbane, Australia
- Contact:
Re: MS2 development/coding for dummies
Ok, let me start ya off...
The main developers (Ken/James/Jean) I believe use Linux as the main platform for development, but you can successfully build and work in Windoze too !!
As you've done, download and install Cygwin and make sure you include the entire Development packages. It will ensure GCC, make and the needed libraries are installed.
Also, download Windows zip : s12buildtools-win32.zip from http://www.msextra.com/tools/
Exract that zip and follow README.txt and untar the gzip'd archive.
In the c:\cygwin folder, create and expand a MS2 (or MS3) release such that it looks like this ...
C:\cygwin\ms2extra_3.2.1_release\
Then run a Cygwin command shell and then "cd /ms2extra_3.2.1_release/ms2extra/"
You should then be able to run "make release" and if all goes well, it should compile and build a release for both megasquirt and microsquirt.
Done.
The main developers (Ken/James/Jean) I believe use Linux as the main platform for development, but you can successfully build and work in Windoze too !!
As you've done, download and install Cygwin and make sure you include the entire Development packages. It will ensure GCC, make and the needed libraries are installed.
Also, download Windows zip : s12buildtools-win32.zip from http://www.msextra.com/tools/
Exract that zip and follow README.txt and untar the gzip'd archive.
In the c:\cygwin folder, create and expand a MS2 (or MS3) release such that it looks like this ...
C:\cygwin\ms2extra_3.2.1_release\
Then run a Cygwin command shell and then "cd /ms2extra_3.2.1_release/ms2extra/"
You should then be able to run "make release" and if all goes well, it should compile and build a release for both megasquirt and microsquirt.
Done.
Mazda MX5 + MS3 Pro
-
- Helpful MS/Extra'er
- Posts: 99
- Joined: Fri Feb 25, 2011 6:31 am
Re: MS2 development/coding for dummies
Thanks. I'd tried opening a couple of files in Notepad but the formatting was messed up. Just tried Wordpad and suddenly it looks more like something humans might read.
-
- Super MS/Extra'er
- Posts: 1072
- Joined: Fri Sep 16, 2011 5:29 am
- Location: Brisbane, Australia
- Contact:
Re: MS2 development/coding for dummies
You'll need a text editor that is designed to be used for coding (unix and windows) - there are bazillions out there, but here one that should work for you http://notepad-plus-plus.org/Martin Young wrote:Thanks. I'd tried opening a couple of files in Notepad but the formatting was messed up. Just tried Wordpad and suddenly it looks more like something humans might read.
g
Mazda MX5 + MS3 Pro
-
- Super MS/Extra'er
- Posts: 9130
- Joined: Sun May 02, 2004 6:51 am
- Location: Quebec, Canada
- Contact:
Re: MS2 development/coding for dummies
Just FYI, I use Windows (with cygwin). So it does work fine. And I use Notepad++ as my editor.gslender wrote:The main developers (Ken/James/Jean) I believe use Linux as the main platform for development, but you can successfully build and work in Windoze too !!
Jean
-
- Super MS/Extra'er
- Posts: 1072
- Joined: Fri Sep 16, 2011 5:29 am
- Location: Brisbane, Australia
- Contact:
Re: MS2 development/coding for dummies
Me too! I was too afraid to come out of the closet with that... fear of being bashed by Ken or James for being such a girl and not using *nix.racingmini_mtl wrote:Just FYI, I use Windows (with cygwin). So it does work fine. And I use Notepad++ as my editor.gslender wrote:The main developers (Ken/James/Jean) I believe use Linux as the main platform for development, but you can successfully build and work in Windoze too !!
Jean
Mazda MX5 + MS3 Pro
-
- Site Admin
- Posts: 39613
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: MS2 development/coding for dummies
I use Linux because I prefer it, not as some kind of crusade! Each to his own.gslender wrote:Me too! I was too afraid to come out of the closet with that... fear of being bashed by Ken or James for being such a girl and not using *nix.
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".
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".
-
- Helpful MS/Extra'er
- Posts: 99
- Joined: Fri Feb 25, 2011 6:31 am
Re: MS2 development/coding for dummies
OK. Here I'm stuck. I read this:gslender wrote:...
Exract that zip and follow README.txt and untar the gzip'd archive.
...
cd /
tar xfz <path>/tools.tar.gz
... and I don't know what it means.
"cd" looks like "change directory" I vaguely recall from DOS, but the "/" is a mystery.
As for "tar", well having typed "info tar" into Cygwin it looks like i have a day's reading to do.
Anyway, I try to follow the instruction but having entered the tar command with the path to get to the tools.tar.gz file, nothing appears to happen. I don't know if anything ought to happen, but nothing does.
Re: MS2 development/coding for dummies
Fortran to C is a pretty big leap (Fortran IV and 77 had no pointers, no data structures and pretty feeble control structures and these are fundamental in C) and 20+ years of accumulated cobwebs won't have helped, so you should probably read up on C programming. Depending on which processor you were using, the assembly language might be surprisingly familiar. In the early '80s the Motorola 6809 was an elegant 8-bit processor that I enjoyed programming. It was quite a nostalgia kick 25 years on to see the Megasquirt processor's assembly language so similar. But if you were working with Z80/808x or 68k, your earlier assembly language experience won't be so applicable.
Plenty to delve into. At some stage, you may find my tutorial helps you get started understanding some of the oddities of this all-in-one processor. (see further down the subject headings)
Have fun,
Rob.
Plenty to delve into. At some stage, you may find my tutorial helps you get started understanding some of the oddities of this all-in-one processor. (see further down the subject headings)
Have fun,
Rob.
-
- Site Admin
- Posts: 39613
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: MS2 development/coding for dummies
If it didn't give an error message then it worked.Martin Young wrote:Anyway, I try to follow the instruction but having entered the tar command with the path to get to the tools.tar.gz file, nothing appears to happen. I don't know if anything ought to happen, but nothing does.
If you prefer to see tons of output, use:
cd /
tar xvfz <path>/tools.tar.gz
To see if it extracted:
ls -l /usr/bin/m9s*
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".
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".
-
- Helpful MS/Extra'er
- Posts: 99
- Joined: Fri Feb 25, 2011 6:31 am
Re: MS2 development/coding for dummies
Last time I looked at assembler was a couple of years ago when I spent ages on a more or less futile attempt to decode my '94 MX-5's ECU. I was seeing 6811 code in my sleep. Pity if it's irrelevant.robs wrote:... Depending on which processor you were using, the assembly language might be surprisingly familiar. In the early '80s the Motorola 6809 was an elegant 8-bit processor that I enjoyed programming. It was quite a nostalgia kick 25 years on to see the Megasquirt processor's assembly language so similar. But if you were working with Z80/808x or 68k, your earlier assembly language experience won't be so applicable...
-
- Site Admin
- Posts: 39613
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Re: MS2 development/coding for dummies
If you know 6811, then the assembler sections should be familiar as the 9S12 CPUs are a superset of the 6811 family.Martin Young wrote:I was seeing 6811 code in my sleep. Pity if it's irrelevant.
I have been thinking about drawing up a block diagram / flowchart of the code to help understanding. But these things all take time.
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".
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".
-
- Site Admin
- Posts: 8230
- Joined: Thu Oct 14, 2004 12:48 pm
Re: MS2 development/coding for dummies
gslender wrote:Me too! I was too afraid to come out of the closet with that... fear of being bashed by Ken or James for being such a girl and not using *nix.racingmini_mtl wrote:Just FYI, I use Windows (with cygwin). So it does work fine. And I use Notepad++ as my editor.gslender wrote:The main developers (Ken/James/Jean) I believe use Linux as the main platform for development, but you can successfully build and work in Windoze too !!
Jean
You're such a girl. You should use *nix.
Just kidding.
I don't care. I prefer linux because the tools used in windows (cygwin) are ridiculously slow and klunky compared with just using the tools natively in linux (or FreeBSD, which I also use).
Ken
Megasquirt is not for use on pollution controlled vehicles. Any advice I give is for off road use only.
-
- Experienced MS/Extra'er
- Posts: 151
- Joined: Wed Dec 21, 2011 11:54 am
Re: MS2 development/coding for dummies
Is that it? Oh boy...gslender wrote:Ok, let me start ya off...
The main developers (Ken/James/Jean) I believe use Linux as the main platform for development, but you can successfully build and work in Windoze too !!
As you've done, download and install Cygwin and make sure you include the entire Development packages. It will ensure GCC, make and the needed libraries are installed.
Also, download Windows zip : s12buildtools-win32.zip from http://www.msextra.com/tools/
Exract that zip and follow README.txt and untar the gzip'd archive.
In the c:\cygwin folder, create and expand a MS2 (or MS3) release such that it looks like this ...
C:\cygwin\ms2extra_3.2.1_release\
Then run a Cygwin command shell and then "cd /ms2extra_3.2.1_release/ms2extra/"
You should then be able to run "make release" and if all goes well, it should compile and build a release for both megasquirt and microsquirt.
Done.
-
- Experienced MS/Extra'er
- Posts: 151
- Joined: Wed Dec 21, 2011 11:54 am
Re: MS2 development/coding for dummies
So when 'make" returns a 'make: command not found'... Is because that package was not selected when installing cygwin?
I'm already in the ms2extra directory, Am I missing an argument or something?
I'm already in the ms2extra directory, Am I missing an argument or something?
-
- Super MS/Extra'er
- Posts: 1072
- Joined: Fri Sep 16, 2011 5:29 am
- Location: Brisbane, Australia
- Contact:
Re: MS2 development/coding for dummies
Yep. You need to install the Development packages with Cygwin.TBI_Master wrote:So when 'make" returns a 'make: command not found'... Is because that package was not selected when installing cygwin?
I'm already in the ms2extra directory, Am I missing an argument or something?
G
Mazda MX5 + MS3 Pro
-
- Helpful MS/Extra'er
- Posts: 139
- Joined: Wed Aug 16, 2006 12:24 am
- Location: Brisbane, Australia
Re: MS2 development/coding for dummies
Hi,
I do embedded C,testing, calibrations etc for a paid living. Mostly Texas Instruments MSP430F and TMS320F MCU's. We have always just used a fully featured IDE that is basically download a 4gb package and install it, next next next, done click the right cpu and it 'just works'. I have used Hightide C for PIC18F, mplab for PIC16F asm. We also used minide with a HC12 at university. Any other time I have done work in this field I have always been spoon fed to get started. Install this install that, someone on hand to help out.
So right now I'm looking at my 2.1.0E zip with the source code in it. I have bloody no idea how to get it to work even with following the instructions.
#1 I have downloaded s12buildtools-win32.zip (filesize: (57,611,176 bytes))
#2 I have downloaded setup.exe from the www.cygwin.com
Which packages exactly do I need to get cygwin doing what it needs to? Are we just using cygwin because it includes the gcc compiler and someone has developed the s12 tools so that gcc works as required?
I do embedded C,testing, calibrations etc for a paid living. Mostly Texas Instruments MSP430F and TMS320F MCU's. We have always just used a fully featured IDE that is basically download a 4gb package and install it, next next next, done click the right cpu and it 'just works'. I have used Hightide C for PIC18F, mplab for PIC16F asm. We also used minide with a HC12 at university. Any other time I have done work in this field I have always been spoon fed to get started. Install this install that, someone on hand to help out.
So right now I'm looking at my 2.1.0E zip with the source code in it. I have bloody no idea how to get it to work even with following the instructions.
#1 I have downloaded s12buildtools-win32.zip (filesize: (57,611,176 bytes))
#2 I have downloaded setup.exe from the www.cygwin.com
Which packages exactly do I need to get cygwin doing what it needs to? Are we just using cygwin because it includes the gcc compiler and someone has developed the s12 tools so that gcc works as required?
1982 RX-7 12A, MSII V3.0, running ms2extra 2.1.0E
Series 5 RX-7 throttle bodies, 2xID725, 2x1600
Complete fuel,ignition, and electric fan control. 11.828@124.30mph
Series 5 RX-7 throttle bodies, 2xID725, 2x1600
Complete fuel,ignition, and electric fan control. 11.828@124.30mph
-
- Helpful MS/Extra'er
- Posts: 139
- Joined: Wed Aug 16, 2006 12:24 am
- Location: Brisbane, Australia
Re: MS2 development/coding for dummies
OK following these instructions I got it closer to working than I have before but its still not working. Here is what I get.
I downloaded and installed the entire 'devel' options and all dependencies that it asked me to do. I extracted tools.tar.gzip into c:\cygwin\ and it added all the files to the /usr/ directory.
Does anyone know whats not working right?
I downloaded and installed the entire 'devel' options and all dependencies that it asked me to do. I extracted tools.tar.gzip into c:\cygwin\ and it added all the files to the /usr/ directory.
Does anyone know whats not working right?
1982 RX-7 12A, MSII V3.0, running ms2extra 2.1.0E
Series 5 RX-7 throttle bodies, 2xID725, 2x1600
Complete fuel,ignition, and electric fan control. 11.828@124.30mph
Series 5 RX-7 throttle bodies, 2xID725, 2x1600
Complete fuel,ignition, and electric fan control. 11.828@124.30mph
-
- Super MS/Extra'er
- Posts: 1072
- Joined: Fri Sep 16, 2011 5:29 am
- Location: Brisbane, Australia
- Contact:
Re: MS2 development/coding for dummies
You untar into the root / directory, not into /usr ..... ??Jobro wrote:OK following these instructions I got it closer to working than I have before but its still not working. Here is what I get.
I downloaded and installed the entire 'devel' options and all dependencies that it asked me to do. I extracted tools.tar.gzip into c:\cygwin\ and it added all the files to the /usr/ directory.
Does anyone know whats not working right?
G
Mazda MX5 + MS3 Pro