Re: which object orient language is most suitable for embedded programming?
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Mon, 27 Nov 2006 09:57:37 -0500
David Brown wrote:
CBFalconer wrote:
David Brown wrote:
... snip ...
What's wrong with writing your own startups? I do that regularly,
in C projects. It's a matter of getting the code you want for your
application, right from the start - I have different requirements
at different times, depending on whether code is running from
flash, or from ram, or some mixture. I write my startups in C -
there is no assembly after setting up the stack pointer and jumping
to the C code. Even the zeroing of the BSS is done in C.
You can do much better if you ban recursive calls to main. Then
the initial call in main can be to an init operation, and from then
on the code loaded is dependant on what is actually needed,
assuming fine modularization of the run time library.
Ban recursive calls to main? Does that imply that people sometimes
write code that *does* recursively call main ?!?
The C standard allows it. Principally used for obfuscation.
There are some things that may need to be done before main - on larger
systems, you might have to set up chip selects or initialise SDRAM
before anything else. These sorts of tasks can be handled by a boot
loader of some sort, but can just as well be done by some pre-main C
code that sets up memory, and perhaps copies the software from slow
flash into fast sdram, initialises .bss and .data, and any other very
low-level hardware. Then comes main(), and a series of initXXX() calls
to bring up the rest of the system.
We are talking about embedded systems here and ROM mounted code.
All the 'boot' has to do is set the stack pointer, and possibly
pass a pair of values defining the limits of memory. You can even
avoid the stack pointer setting by doing a jump to main. The call
to 'init' can be done with another jump, passing the return address
in a register. No need for argc and argv because everything starts
on power-on. This is all standards compatible for non-hosted
systems.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
.
- Follow-Ups:
- References:
- which object orient language is most suitable for embedded programming?
- From: ***
- Re: which object orient language is most suitable for embedded programming?
- From: Tim Wescott
- Re: which object orient language is most suitable for embedded programming?
- From: Donald
- Re: which object orient language is most suitable for embedded programming?
- From: Vladimir Vassilevsky
- Re: which object orient language is most suitable for embedded programming?
- From: David Brown
- Re: which object orient language is most suitable for embedded programming?
- From: Vladimir Vassilevsky
- Re: which object orient language is most suitable for embedded programming?
- From: Peter Dickerson
- Re: which object orient language is most suitable for embedded programming?
- From: Vladimir Vassilevsky
- Re: which object orient language is most suitable for embedded programming?
- From: David Brown
- Re: which object orient language is most suitable for embedded programming?
- From: CBFalconer
- Re: which object orient language is most suitable for embedded programming?
- From: David Brown
- which object orient language is most suitable for embedded programming?
- Prev by Date: Re: problems with I2c
- Next by Date: Re: Need suggestion on GNU toolchain selection
- Previous by thread: Re: which object orient language is most suitable for embedded programming?
- Next by thread: Re: which object orient language is most suitable for embedded programming?
- Index(es):