From: Richard Pennington <rich@pennware.com>
To: musl@lists.openwall.com
Subject: Bare metal musl data points.
Date: Sat, 06 Dec 2014 09:51:17 -0600 [thread overview]
Message-ID: <548325F5.2050205@pennware.com> (raw)
Hi,
A few examples of bare metal musl in action.
The simplest main(). No I/O. Just startup code and libc initialization:
dev main 367 % cat main.c
int main()
{
}
dev main 357 % size main
text data bss dec hex filename
5358 2080 33156 40594 9e92 main
dev main 368 % make run
Running main
enter 'control-A x' to exit QEMU
audio: Could not init `oss' audio driver
The simplest hello world example in C. Polled serial I/O:
dev hello 371 % cat main.c
#include <stdio.h>
int main()
{
printf("hello world\n");
}
dev hello 361 % size hello
text data bss dec hex filename
26377 2228 34204 62809 f559 hello
dev hello 370 % make run
Running hello
enter 'control-A x' to exit QEMU
audio: Could not init `oss' audio driver
hello world
Hello world again in C++. Yikes!
dev hellocpp 373 % cat main.cpp
#include <iostream>
int main()
{
std::cout << "hello world" << std::endl;
}
dev hellocpp 363 % size hellocpp
text data bss dec hex filename
1327518 2568 43600 1373686 14f5f6 hellocpp
calhost.localdomain hellocpp 374 % make run
Running hellocpp
enter 'control-A x' to exit QEMU
audio: Could not init `oss' audio driver
hello world
A full ELK build with file system, virtual memory, etc.:
/* ELK running as a VM enabled OS.
*/
#include <sys/cdefs.h>
#include <stdio.h>
#include "command.h"
int main(int argc, char **argv)
{
setprogname("elk");
printf("%s started. Type \"help\" for a list of commands.\n",
getprogname());
// Enter the kernel command processor.
do_commands(getprogname());
}
dev elk 377 % size elk
text data bss dec hex filename
223830 3456 54540 281826 44ce2 elk
dev elk 379 % make run
Running elk
enter 'control-A x' to exit QEMU
audio: Could not init `oss' audio driver
elk started. Type "help" for a list of commands.
elk % ps
Total pages: 7936 (32505856 bytes), Free pages: 7926 (32464896 bytes)
PID TID TADR STATE PRI NAME
0 0 0x800452e8 RUNNING 1 kernel
0 2 0x8004ae54 IDLE 3 [idle0]
elk % date
Thu Jan 1 00:00:31 1970
elk %
[~] main%
Fun stuff.
Rich
http://ellcc.org
reply other threads:[~2014-12-06 15:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=548325F5.2050205@pennware.com \
--to=rich@pennware.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).