Porting my code to the hcs12c64/c128

Official FreeEMS vanilla firmware development, the heart and soul of the system!
davebmw
LQFP144 - On Top Of The Game
Posts: 331
Joined: Sun Jul 13, 2008 2:58 pm
Location: South Wales, UK

Re: Porting my code to the hcs12c64/c128

Post by davebmw »

Fred wrote:Would anyone with ms2 hardware and some knowledge of code like to take it upon themselves to keep a branch of my code open and up to date to be run on the existing ms2 hardware? I would like to see MS users with a true open source alternative at some point, and the sooner the port develops, the easier it will be to keep it up to spec.

I don't think it is worth me spending my time on this at the moment when there are other things that need doing, but it would make a nice easy casual project for someone else IMO.

It would need to be ignition free and/or limited cylinder count and modified, but the basic fuel pulsing code is 100% compatible with a suitable header and memory.x and linker scripts etc.

Volunteers?

Admin.
I have an MS2 V3.0 that works well, and i'm willing to experiment on it somewhat to get 6 COP and 2, 3 or 6 injector outputs if possible.

I'm a newbie as far as C goes but i'm willing to learn.
93'BMW 325is M50B25TU, Rebuilt 06/06, JE10.5:1, polish&port. Scorpion BB, K&N CAI, TEJ21 WBO2, '07 M3 Evo 18" 225F, 255R, EBC Kevlar, Bilstien Sprint, Polyflex. Head rebuild Oct'08, OEM+FSE FPR, MS2v3.0_DJB Custom, Extra 2.0.1
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Porting my code to the hcs12c64/c128

Post by Fred »

If you do do this, you will need to maintain and organise your own paging mechanism such that you can effectively organise the memory and RT tune the things required. You'll have to keep different copies of a number of files, or perhaps we could integrate it into the build procedure? Those files include (but are not limited to) :

Linker script
memory.x
memory.h
structs.h
enginePositionISRs.c
fuelInjectorISRs.c
init.c or init.h or both

etc. some could be deferred with intelligent #ifdef use, but not all...

It's a lot of work, but would be a good experiment to wet your feet in C and embedded software to port it across. All the internal code etc will run fine on anything.

You've just inspired an idea that would make your job more easy. I'll put some work into that later today. A hardware abstraction layer of #defines that I considered using some time ago. It would be very worthwhile adding that in regardless, so I'll probably do that soonish.

If you see the last post on the last page you will see that I said it's not going to be worth it. Probably that is true, but there is no harm in trying :-) you can always abandon the effort if it ends up too much work at a later date.

Cheers,

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!
davebmw
LQFP144 - On Top Of The Game
Posts: 331
Joined: Sun Jul 13, 2008 2:58 pm
Location: South Wales, UK

Re: Porting my code to the hcs12c64/c128

Post by davebmw »

Fred wrote:If you do do this, you will need to maintain and organise your own paging mechanism such that you can effectively organise the memory and RT tune the things required. You'll have to keep different copies of a number of files, or perhaps we could integrate it into the build procedure? Those files include (but are not limited to) :

Linker script
memory.x
memory.h
structs.h
enginePositionISRs.c
fuelInjectorISRs.c
init.c or init.h or both

etc. some could be deferred with intelligent #ifdef use, but not all...

It's a lot of work, but would be a good experiment to wet your feet in C and embedded software to port it across. All the internal code etc will run fine on anything.

You've just inspired an idea that would make your job more easy. I'll put some work into that later today. A hardware abstraction layer of #defines that I considered using some time ago. It would be very worthwhile adding that in regardless, so I'll probably do that soonish.

If you see the last post on the last page you will see that I said it's not going to be worth it. Probably that is true, but there is no harm in trying :-) you can always abandon the effort if it ends up too much work at a later date.

Cheers,

Fred.
Morning Fred

I spent some time last night downloading the compler and tools linked to by your site and spent some time playing about with it, I now have a bit more of an understanding of the way the code is structured and c files are called etc.
what i'm doing in work now is researching some of the functions and syntax.
Its quite enlightening this C stuff! :)
93'BMW 325is M50B25TU, Rebuilt 06/06, JE10.5:1, polish&port. Scorpion BB, K&N CAI, TEJ21 WBO2, '07 M3 Evo 18" 225F, 255R, EBC Kevlar, Bilstien Sprint, Polyflex. Head rebuild Oct'08, OEM+FSE FPR, MS2v3.0_DJB Custom, Extra 2.0.1
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Porting my code to the hcs12c64/c128

Post by Fred »

Cool :-)

I've said this before, and I'll say it again, but if anything is less than clear in the code, please let me know what and why so I can do something about either changing it to be clear or documenting it better.

I've tried pretty hard to make it clear, but there is definitely room for improvement. The next version already has quite a few changes, and before it comes out will have quite a few more too :-)

The implementation is thus far designed to be as simple as possible while still being effective and reasonably fast. If something doesn't make sense or needs work, feel free to post about it :-)

In fact, feel free to (try to?) fix it and submit a patch or diff-able replacement file :-)

Let me know if there is anything else you need.

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!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Porting my code to the hcs12c64/c128

Post by Fred »

The code is now WAY past the point where it COULD have been ported to the smaller inferior device. Because it can never happen now, I'm locking this thread to force it to sink to the bottom of the section.

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!
Locked