ARM Cortex-M Microcontroller startup files
Timo Sintonen via Digitalmars-d
digitalmars-d at puremagic.com
Fri May 1 00:44:49 PDT 2015
On Thursday, 30 April 2015 at 23:59:18 UTC, Jens Bauer wrote:
> On Thursday, 30 April 2015 at 21:35:44 UTC, Mike wrote:
>> On Thursday, 30 April 2015 at 21:08:22 UTC, Jens Bauer wrote:
>>> Thus I would expect the hook to be somewhere in vfprintf ?
>>
>> As Timo said, eventually, what printf needs is the `write`
>> syscall. The C library needs to be ported to the hardware in
>> question. That requires implementing all the syscalls the the
>> C library needs: `write` for printf, `sbrk` for malloc,
>> etc...
>> (http://wiki.osdev.org/Porting_Newlib#newlib.2Flibc.2Fsys.2Fmyos.2Fsyscalls.c)
>> Sometimes the toolchain vendors provide this, sometimes the
>> programmer has to do it.
>
> Uhm, in that case, why not supply a weakref dummy, eg.
> functions that can be overridden.
> Thus stat, open, fstat, lseek, read, write, isatty, close, link
> and unlink just do nothing at all.
> If the MCU has a file-system, then it can implement those as
> strong refs.
> Same about gettimeofday, getpid, execve, fork, kill - Often
> there's only a single thread and no possibility for loading and
> executing a named program.
> -So it should be fairly easy to change newlib 'requirements' to
> 'optional'. :)
>
> I feel like trying this out, perhaps when the new light comes.
> ;)
Please do not make yet another c compiler. Make a D compiler.
File system support can be an option that can be selected. A file
in D is an object. Try to think object oriented way.
More information about the Digitalmars-d
mailing list