From 563c92e6d08c305cb9f7693818ecbe2a2dec527b Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 29 Nov 2018 20:43:06 -0500 Subject: hello world from initrd --- initrd/Makefile | 16 +++++++++++----- initrd/hello | 1 - initrd/init | Bin 0 -> 12524 bytes initrd/init.c | 14 ++++++++++++++ initrd/test | Bin 37024 -> 0 bytes initrd/test.c | 16 ---------------- 6 files changed, 25 insertions(+), 22 deletions(-) delete mode 100644 initrd/hello create mode 100755 initrd/init create mode 100644 initrd/init.c delete mode 100755 initrd/test delete mode 100644 initrd/test.c (limited to 'initrd') diff --git a/initrd/Makefile b/initrd/Makefile index 705ac6c..5946eee 100644 --- a/initrd/Makefile +++ b/initrd/Makefile @@ -1,6 +1,12 @@ +## +# A simple Makefile for building executables loadable by stmos. +# + +ARCH = arm-stmos- +CC = gcc -mcpu=cortex-m4 -mthumb -fsigned-char +CFLAGS = -Os -fPIE + all: - @arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -fsigned-char -Os \ - -nostdinc -nostdlib \ - -fdata-sections -ffunction-sections -Wl,--gc-sections \ - -I../src/pdclib/include -I../src/pdclib/platform/stmos/include \ - test.c ../src/pdclib/pdclib.a -s -o test + @$(ARCH)$(CC) $(CFLAGS) init.c -o init + @arm-stmos-strip init + diff --git a/initrd/hello b/initrd/hello deleted file mode 100644 index 5d437a5..0000000 --- a/initrd/hello +++ /dev/null @@ -1 +0,0 @@ -Hello, world!! diff --git a/initrd/init b/initrd/init new file mode 100755 index 0000000..3bc5fd8 Binary files /dev/null and b/initrd/init differ diff --git a/initrd/init.c b/initrd/init.c new file mode 100644 index 0000000..5ff4ae5 --- /dev/null +++ b/initrd/init.c @@ -0,0 +1,14 @@ +/** + * @file test.c + * Basic userland code to be loaded by stmos for program load testing. + */ + +#include + +int main(void) +{ + printf("Hello, world!\n"); + while (1); + return 0; +} + diff --git a/initrd/test b/initrd/test deleted file mode 100755 index 7bf8246..0000000 Binary files a/initrd/test and /dev/null differ diff --git a/initrd/test.c b/initrd/test.c deleted file mode 100644 index b79f315..0000000 --- a/initrd/test.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int main(void); - -void _start(void) -{ - exit(main()); -} - -int main(void) -{ - printf("Hello, world!\n"); - return 0; -} - -- cgit v1.2.3