Your dream ECU
#61
Junior Member
Join Date: Feb 2007
Location: 11368 miles from where i would like to be
Posts: 269
Total Cats: 92
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
What I will say is that in my experience, if the maintainers are diligent, community driven projects actually tend to produce MUCH better code than commercial solutions.
<snip>
Having 150 people tell you that your code looks like **** on the internet makes you shape up quick if you want it to be included![wink](https://www.miataturbo.net/images/smilies/wink.gif)
There are a lot of problems with the MS codebase.
1) I shouldn't have to dig through 1300 lines of global variables and memory map structures to get to the definition of main() in a file called ms2_extra_main.c.<snip>
2) WHY THE **** ARE THERE SO MANY GLOBAL VARIABLES.<snip>
3) Your main loop shouldn't be 2000 lines long. Y U NO FUNCTION!?! <snip>
4) There is no layering. Good embedded software is layered (in fact, all good software is layered). <snip>
5) Theyoveruse GOTO statements.<snip>
6) They use assembly in completely unnecessary places.<snip>
<snip>
Having 150 people tell you that your code looks like **** on the internet makes you shape up quick if you want it to be included
![wink](https://www.miataturbo.net/images/smilies/wink.gif)
There are a lot of problems with the MS codebase.
1) I shouldn't have to dig through 1300 lines of global variables and memory map structures to get to the definition of main() in a file called ms2_extra_main.c.<snip>
2) WHY THE **** ARE THERE SO MANY GLOBAL VARIABLES.<snip>
3) Your main loop shouldn't be 2000 lines long. Y U NO FUNCTION!?! <snip>
4) There is no layering. Good embedded software is layered (in fact, all good software is layered). <snip>
5) They
6) They use assembly in completely unnecessary places.<snip>
Standard ms function sig these days is void abc(void) :-) Hilarious. Unless you're a maintainer, or user.
Fred.
#62
I identify as a bear.
![](/mt2011/images_td/ranks/supporter1.gif)
![](/mt2011/images_td/ranks/smod.png)
iTrader: (8)
Join Date: Sep 2005
Location: Chicago. (The less-murder part.)
Posts: 33,206
Total Cats: 6,707
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
Modular high-level code is easy to create and a nightmare to debug.
#63
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
Irony: my feeble old mind finds the MS1 code much easier to comprehend than the new stuff, since it's all written in assembly as a single, monolithic listing. No need to go chasing through a dozen different .c files while attempting to trace the flow of the code through a typical cycle.
Modular high-level code is easy to create and a nightmare to debug.
Modular high-level code is easy to create and a nightmare to debug.
#64
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
There are a lot of problems with the MS codebase.
1) I shouldn't have to dig through 1300 lines of global variables and memory map structures to get to the definition of main()
...
2) WHY THE **** ARE THERE SO MANY GLOBAL VARIABLES.
3) Your main loop shouldn't be 2000 lines long. Y U NO FUNCTION!?!
4) There is no layering.
5) They overuse GOTO statements.
6) They use assembly in completely unnecessary places.
1) I shouldn't have to dig through 1300 lines of global variables and memory map structures to get to the definition of main()
...
2) WHY THE **** ARE THERE SO MANY GLOBAL VARIABLES.
3) Your main loop shouldn't be 2000 lines long. Y U NO FUNCTION!?!
4) There is no layering.
5) They overuse GOTO statements.
6) They use assembly in completely unnecessary places.
- Why do you think the devs fell into that?
- Maybe the MS3 is much better?
#65
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
I agree, however the problem with CAN is that its not suitable for time critical applications. For example, if you want to activate a high-current device at a specific crank angle, you can't. Or to put more scientifically, you can try, but you are not guaranteed to apply it in the correct time frame.
I can't comment on that as all of the community projects I'm involved in are related to embedded systems. What I will say is that in my experience, if the maintainers are diligent, community driven projects actually tend to produce MUCH better code than commercial solutions. People tend to get in a tight feedback loop in their company, with no external criticism, and commit bullshit. Having 150 people tell you that your code looks like **** on the internet makes you shape up quick if you want it to be included ![wink](https://www.miataturbo.net/images/smilies/wink.gif)
![wink](https://www.miataturbo.net/images/smilies/wink.gif)
#66
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
I've looked at the MS code once or twice, and yeah, it's pretty ugly.
--Ian
#67
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
I never delved into the MS code, so I didn't realize the above. Early in my working life I've programmed in C for embedded systems. I'm a hardware, not a software weenie (my wares are hard), but your list describes newbie mistakes (I knew enough to avoid), or the classic "hardware engineers writing code" problem.
![Thefinger](https://www.miataturbo.net/images/smilies/thefinger.gif)
- Why do you think the devs fell into that?
Can't speak to MS3 as I've not seen the code.
Irony: my feeble old mind finds the MS1 code much easier to comprehend than the new stuff, since it's all written in assembly as a single, monolithic listing. No need to go chasing through a dozen different .c files while attempting to trace the flow of the code through a typical cycle.
Example: on startup, a cortex M3 walks through the data section of the binary and copies the contents from flash to ram.
This is the standard STM CMSIS implementation:
Code:
Reset_Handler: /* Copy the data segment initializers from flash to SRAM */ movs r1, #0 b LoopCopyDataInit CopyDataInit: ldr r3, =_sidata ldr r3, [r3, r1] str r3, [r0, r1] adds r1, r1, #4 LoopCopyDataInit: ldr r0, =_sdata ldr r3, =_edata adds r2, r0, r1 cmp r2, r3 bcc CopyDataInit ldr r2, =_sbss b LoopFillZerobss /* Zero fill the bss segment. */ FillZerobss: movs r3, #0 str r3, [r2], #4 LoopFillZerobss: ldr r3, = _ebss cmp r2, r3 bcc FillZerobss /* Call the clock system intitialization function.*/ bl SystemInit /* Call the application's entry point.*/ bl main bx lr
Code:
void reset_handler(void) { volatile unsigned *src, *dest; for (src = &_data_loadaddr, dest = &_data; dest < &_edata; src++, dest++) *dest = *src; while (dest < &_ebss) *dest++ = 0; /* Call the application's entry point. */ main(); }
![Giggle](https://www.miataturbo.net/images/smilies/gay.gif)
Modular high-level code is easy to create and a nightmare to debug.
Thread
Thread Starter
Forum
Replies
Last Post
bigmackloud
Miata parts for sale/trade
19
01-08-2021 11:24 AM
Motorsport-Electronics
ECUs and Tuning
0
09-05-2015 08:02 AM