Fred's firmware development diary

Official FreeEMS vanilla firmware development, the heart and soul of the system!
User avatar
Fred
Moderator
Posts: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fred's firmware development diary

Post by Fred »

:D :D :D :D :D :D :D :D :D :D RAM paging works!! :D :D :D :D :D :D :D :D :D :D

Right, many places to change from flash references to ram ones.

The release tomorrow will be running out of ram with flash burning code too!

Look forward to some cool releases over the next few weeks and months!

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: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fred's firmware development diary

Post by Fred »

:-)

It's been running from RAM for half an hour now. All things work sweetly.

I've partly implemented FULL table switching. By full I mean full, ie, the ECU code can use upto 8 full size 1kB tables during it's business, and 4k of other small tables and tunable items, and at the flick of a switch it uses an entirely different configuration for ALL of it. Pretty sweet IMO. We COULD carry this through to total switchability, but I don't see the value in being able to change cylinder count etc with a switch... so we probably won't. This means the basic non live tunable config will live purely in flash and there will be only one copy. All tunable data in small tables and large tables will be fully duplicated such that you could run a totally different fuel or boost or XYZ setup very quickly.

The code now uses ALL of the RAM available to it for something or other (still room to grow for the stack and variables though).

And to think, ms1 has 512 bytes of RAM, and ms2 4kB of RAM, man it must suck to try to code flexible rich features into that environment. No wonder the code is complex and impossible to understand.

Currently ours looks like this :

6kB for variables and stack
1kB tx buffer
1kB rx buffer
4kB window :
8 large 1kB tables spread over 2 pages : 3x VE, 1x Lambda, 2x Fuel advance, 2x Ign advance
1 4kB page of tunable config = 64 16x2x16bit 2d tables OR 256 8x2x8bit 2d tables or some combination etc
the above is duplicated fully in the other 3 pages.

Very sweet stuff :-)

The best part is the code to do this is tiny and simple to understand! Awesome.

Perhaps I'll play with Sean's flash burning stuff tomorrow and maybe put some serial code in to receive blocks of data and burn them? Optimistic maybe, but we'll see what happens!

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: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fred's firmware development diary

Post by Fred »

Eclipse pointers :

In order for completion and click through functions to work, check the "index all option :

Image

In order to avoid a dirty great Debug directory full of bogus build files, do the following :

Image

IE, uncheck "generate make file" and change Debug to src.

Additionally you can turn off auto building etc so it doesn't go building for you all the time. I prefer to run it in a terminal though as you can visibly see every files progress that way. Eclipse hides that, but it should indicate any issues. I didn't try broken code to see what happens, but it is nice that command line clean cleans eclipse build artifacts this way. No more 1.5 meg files from Sean now! :-)

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: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fred's firmware development diary

Post by Fred »

Well, it's been a LONG time coming, but here it is, 0.0.16 FlashGordon :-)

Proudly brought to you by SeanK and FredC! In association with a bunch of other people who stick their nose in where required often enough.

With an increase of content of around 25% when zipped she is starting to become and adult :-)

44k of flash image to burn down, ram paging, flash burning, serial stuff, wheel stuff, ideal gas laws, etc etc, mostly broken/half finished, but still, getting there! :-)

https://sourceforge.net/project/showfil ... _id=630951

Change list :
0.0.16 (FlashGordon) 11:12am 6/10/08 - NZ time
Fred: Removed reference to TX0 pin S1 from portHISR()
Fred: Used fuel pump pin for portHISR() indicator
Fred: Removed flow control pin function from pin out definition
Fred: Added tachometer function to pin out definition
Fred: Moved User LED flash to RTC to free MDC ISR for Tacho use
Fred: Fixed Makefile dumps section
Fred: Added configurable tacho output
Fred: Fixed RPM calc to use correct variable scale
Fred: Fixed scheduler to always sample ADCs
Fred: Made baud configurable (default 115200)
Fred: Added more runtimes to struct and code to populate them
Fred: Added latencies struct and code to populate them
Fred: Changed broken sync code to be more simple
Fred: Refactored sleep function to allow more range
Fred: Added micro second sleep function
Fred: Moved reset variables to a function
Fred: Added flash globals temporary file
Fred: Added dwell spread sheet
Fred: Added injector dead time spread sheet
Fred: Added tables for IDT and dwell vs voltage
Fred: Added table lookup for unsigned short 2d 16 long
Fred: Added overflow check for reference PW
Fred: Changed table functions to return values directly
Fred: Removed duplicate MAT storage call
Fred: Moved flag clear for RTI to front
Fred: Reduced Ram to 6k to allow 2k of minor data and 4k window of big tables
Fred: Reduced Ram to 5k to allow 1k of flash burn buffer 2k of minor data and 4k window of big tables
Fred: Added more MAP sensor and other definitions to the globalDefines file
Fred: Modified Makefile to compile hand written assembly with C cleanly
Fred: Renamed stoichOct to stoichAFROct
Fred: Updated IAT and CHT tables to use correct bias resistor value of 2.7k
Fred: Reformatted pinout doc and added two columns for bootload and reset states
Fred: Moved ADC pins to final locations on bank 0
Fred: Merged in Seans Flash changes :
Sean: Added flash related header and source files
Sean: Added assembly to load code to stack for burning own flash
Sean: Added flash erase function
Sean: Added flash word write function
Sean: Added flash write aligned block function
Sean: Documented flash functionality in the code
Fred: Added output to makefile to see each operation type
Fred: Removed #define from all constants C files
Fred: Added main table unions
Fred: Added ram regions for the purpose of aligning large blocks of data
Fred: Added include and memcpy references to bring data up into ram
Fred: Added RPAGE to header to allow paging of tables in and out of visible space
Fred: Added paged tuning blocks such that table switching almost changes a full tune
Fred: Migrated small tables into struct for paging
Fred: Split flash into 5 blocks to ensure no overflow occurs in smalltables
Fred: Created mechanism to ensure paged data is retrieved correctly by implementing basis of table switching
Fred: Moved all references to tables to ram copies
Fred: Split flash again for fixed config block.
Fred: General formatting and file name and content changes
Fred: Shifted tunable configs to structs for paging
Fred: Moved copy from flash to ram to start of init
Fred: Future comms pseudo code added
Fred: Various spelling fixes
Please note, I have NOT updated the pin out doc in the way required. All in good time my friends, not long to wait now :-)

Onwards and upwards!

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: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fred's firmware development diary

Post by Fred »

Just a side note :

The current release contains about 11 thousand lines of code! That's what, about 1200/ month or 300 per week, or 40 per day which isn't bad going really.

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: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fred's firmware development diary

Post by Fred »

Well, just checking in to say that I've been working on the receive functionality tonight on the train and at home. I'll try to make more progress on that tomorrow morning, and have it ready to rock n roll for the weekend. After that I need to do the send stuff, and then do and internal loopback test code and send stuff to it in packets and listen to see it come back. Once those are ready we can setup some uber basic stuff under that and program ram and burn flash with it :-) It'll be rough going at first because there will be no gui however it shouldn't be too bad to do some isolated "yip, it works" testing etc.

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: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fred's firmware development diary

Post by Fred »

Just a little debug, and some test code to write and we should have a listening EMS. I have an issue in my logic that is meaning all of my code is being optimised out. I'll figure that out tonight or tomorrow and get some real life testing done rather than reading asm to figure out if it will work (which is all I can do on the train!).

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: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fred's firmware development diary

Post by Fred »

I've got the receive code as ready as I can. Now I need some send code (tomorrow mornings job) and some test code, and I can try it out. Once I know it works I can fill in some details of specific functionality to be available for tuning stuff.

Plus of course, this weekend I WILL sit down and figure out the pins and ignition/fuel pump drive stuff properly.

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: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fred's firmware development diary

Post by Fred »

This morning I set a new benchmark in productivity! I was coding STANDING up on the crowded tube train amongst the other sweaty suited people. How "geek" is that? :-)

I actually tried to do that the other day on the big train with my laptop... but it was no go, my arm started to drop off. the eee on the other hand i can hold and reach the keys at the same time. So sweet. Also, listening to music from it the whole way too. Go that 6 hour battery!

I got some good serial send code written this morning. Good stuff, and I'll probably get some testing done tonight if I'm lucky :-)

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: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Fred's firmware development diary

Post by Fred »

I've written the test code to fit them together and removed a few little bugs that I could see. I'm not confident that the code is perfect like I usually am, but I'll look it over on the big screen soon and try it on the hardware and see what happens :-)

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