Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Thanassis Tsiodras
RTEMS-build-workflows
Commits
3ef9bdd4
Commit
3ef9bdd4
authored
Mar 18, 2016
by
Thanassis Tsiodras
Browse files
Working with Sebastian's version (4.12)
parent
5ab0a41b
Pipeline
#43
skipped
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
OAR/Makefile
0 → 100644
View file @
3ef9bdd4
# Configuration section
#
# Use environment variables if found, otherwise fallback to sane defaults
RTEMS_MAKEFILE_PATH
?=
/opt/rtems-4.12-2016.03.18.NONFPU/sparc-rtems4.12/leon3
RTEMS_LIB
=
${RTEMS_MAKEFILE_PATH}
/lib
CROSS_PREFIX
=
sparc-rtems4.12
# Detect the platform (last part of the path of RTEMS_MAKEFILE_PATH - e.g. leon3, leon2, etc)
PLATFORM
=
$(
shell
sh
-c
"echo
${RTEMS_MAKEFILE_PATH}
| sed 's,^.*/,,'"
)
# The directories containing the source files, separated by ':'
VPATH
=
src
# If not selected, compile debug version of binary (no optimizations)
ifeq
($(CFG),)
CFG
=
debug
endif
# If not explicitely selected (with 'make FPU=1'), compile for FPU emulation
ifeq
($(FPU),)
FPU
=
0
endif
# Your source files: regardless of where they reside in the source tree,
# VPATH will locate them...
NONFPU_SRC
=
\
init.c
FPU_SRC
=
\
task1.c
# Build a Dependency list and an Object list, by replacing the .c
# extension to .d for dependency files, and .o for object files.
NONFPU_DEP
=
$(
patsubst
%.c, deps.
$(CFG)
/NONFPU_%.d,
${NONFPU_SRC}
)
FPU_DEP
=
$(
patsubst
%.c, deps.
$(CFG)
/FPU_%.d,
${FPU_SRC}
)
NONFPU_OBJ
=
$(
patsubst
%.c, objs.
$(CFG)
/NONFPU_%.o,
${NONFPU_SRC}
)
FPU_OBJ
=
$(
patsubst
%.c, objs.
$(CFG)
/FPU_%.o,
${FPU_SRC}
)
# Your final binary
TARGET
=
fputest
# What compiler to use for generating dependencies:
# it will be invoked with -MM -MP
CC
=
${CROSS_PREFIX}
-gcc
CDEP
=
${CC}
# What include flags to pass to the compiler
INCLUDEFLAGS
=
-I
src
# Compilation flags (common)
COMMON
+=
-B
${RTEMS_LIB}
-specs
bsp_specs
-qrtems
\
-mcpu
=
leon3
-DBSP_leon3
\
-ffunction-sections
-fdata-sections
-Wall
\
-Wmissing-prototypes
-Wimplicit-function-declaration
\
-Wstrict-prototypes
-Wnested-externs
# Separate compile options per configuration
ifeq
($(CFG),debug)
CFLAGS
+=
${COMMON}
-g
-D_DEBUG
${INCLUDEFLAGS}
-msoft-float
else
CFLAGS
+=
${COMMON}
-g
-O2
${INCLUDEFLAGS}
-msoft-float
endif
# Should we generate native FPU instructions for the FPU_SRC?
ifeq
($(FPU),1)
CFLAGS
:=
$(
shell
bash
-c
"echo
${CFLAGS}
| sed 's,-msoft-float,,'"
)
CFLAGS_FPU
:=
${CFLAGS}
else
CFLAGS_FPU
:=
${CFLAGS}
LDFLAGS
+=
-msoft-float
endif
# A common link flag for all configurations
LDFLAGS
+=
${COMMON}
-Wl
,--gc-sections
all
:
inform bin.$(CFG)/${TARGET}
inform
:
ifneq
($(CFG),release)
ifneq
($(CFG),debug)
@
echo
"Invalid configuration "
$(CFG)
" specified."
@
echo
"You must specify a configuration when running make, e.g."
@
echo
"make CFG=debug"
@
echo
@
echo
"Possible choices for configuration are 'release' and 'debug'"
@
exit
1
endif
endif
bin.$(CFG)/${TARGET}
:
${NONFPU_OBJ} ${FPU_OBJ} | inform
@
mkdir
-p
$(
dir
$@
)
ifeq
($(V),1)
$(CC)
-g
-o
$@
$^
${LDFLAGS}
else
@
echo
[
LD]
$@
@
$(CC)
-g
-o
$@
$^
${LDFLAGS}
endif
ifeq
($(CFG),release)
@
${CROSS_PREFIX}
-objcopy
--only-keep-debug
$@
${
@
}
.debug
@
${CROSS_PREFIX}
-strip
$@
endif
@
echo
Built with RTEMS at
${RTEMS_LIB}
for
${PLATFORM}
.
objs.$(CFG)/NONFPU_%.o
:
%.c
@
mkdir
-p
$(
dir
$@
)
ifeq
($(V),1)
$(CC)
-c
$(CFLAGS)
-o
$@
$<
else
@
echo
[
CC]
$@
@
$(CC)
-c
$(CFLAGS)
-o
$@
$<
endif
objs.$(CFG)/FPU_%.o
:
%.c
@
mkdir
-p
$(
dir
$@
)
ifeq
($(V),1)
$(CC)
-c
$(CFLAGS_FPU)
-o
$@
$<
else
@
echo
[
CC]
$@
@
$(CC)
-c
$(CFLAGS_FPU)
-o
$@
$<
endif
deps.$(CFG)/NONFPU_%.d
:
%.c
@
mkdir
-p
$(
dir
$@
)
@
echo
Generating dependencies
for
$<
@
set
-e
;
$(CDEP)
-MM
-MP
$(INCLUDEFLAGS)
$<
>
$@
.
$$$$
;
\
sed
's,\($*\)\.o[ :]*,objs.
$(CFG)
\/NONFPU_\1.o $@ : ,g'
<
$@
.
$$$$
>
$@
;
\
rm
-f
$@
.
$$$$
deps.$(CFG)/FPU_%.d
:
%.c
@
mkdir
-p
$(
dir
$@
)
@
echo
Generating dependencies
for
$<
@
set
-e
;
$(CDEP)
-MM
-MP
$(INCLUDEFLAGS)
$<
>
$@
.
$$$$
;
\
sed
's,\($*\)\.o[ :]*,objs.
$(CFG)
\/NONFPU_\1.o $@ : ,g'
<
$@
.
$$$$
>
$@
;
\
rm
-f
$@
.
$$$$
clean
:
@
rm
-rf
\
deps.debug objs.debug bin.debug
\
deps.release objs.release bin.release
# Unless "make clean" is called, include the dependency files
# which are auto-generated. Don't fail if they are missing
# (-include), since they will be missing in the first invocation!
ifneq
($(MAKECMDGOALS),clean)
-include
${NONFPU_DEP}
-include
${FPU_DEP}
endif
OAR/src/init.c
0 → 100644
View file @
3ef9bdd4
/*
* Example initialization file - spawns 2 native FPU tasks
*
*/
#define CONFIGURE_INIT
#define TASKS 2
#include "system.h"
#include <stdio.h>
rtems_task
Init
(
rtems_task_argument
argument
)
{
rtems_status_code
status
;
rtems_name
Task_name
[
TASKS
];
/* task names */
rtems_id
Task_id
[
TASKS
];
/* task ids */
int
i
;
for
(
i
=
0
;
i
<
TASKS
;
i
++
)
{
// Initialize Task name
Task_name
[
i
]
=
rtems_build_name
(
'T'
,
'T'
,
"0"
+
i
/
10
,
"0"
+
i
%
10
);
// Create Task
status
=
rtems_task_create
(
Task_name
[
i
],
(
rtems_task_priority
)
2
,
RTEMS_MINIMUM_STACK_SIZE
,
RTEMS_DEFAULT_MODES
,
RTEMS_FLOATING_POINT
,
// use RTEMS_DEFAULT_ATTRIBUTES for non-native FPU tasks
&
Task_id
[
i
]);
if
(
status
!=
RTEMS_SUCCESSFUL
)
{
printf
(
"Failed to rtems_task_create... status:%0x
\n
"
,
status
);
rtems_task_delete
(
RTEMS_SELF
);
}
// Start Task
status
=
rtems_task_start
(
Task_id
[
i
],
Task_EntryPoint
,
i
);
}
printf
(
"Parent task sleeps for a second...
\n
"
);
rtems_task_wake_after
(
100
);
printf
(
"Parent task bids adieu...
\n
"
);
rtems_task_delete
(
RTEMS_SELF
);
}
OAR/src/system.h
0 → 100644
View file @
3ef9bdd4
#include <rtems/score/types.h>
#include <rtems/rtems/types.h>
#include <rtems/rtems/tasks.h>
rtems_task
Init
(
rtems_task_argument
argument
);
rtems_task
Task_EntryPoint
(
rtems_task_argument
argument
);
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 64
#define CONFIGURE_TICKS_PER_TIMESLICE 100
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#include <rtems/confdefs.h>
OAR/src/task1.c
0 → 100644
View file @
3ef9bdd4
#include "system.h"
#include <stdio.h>
rtems_task
Task_EntryPoint
(
rtems_task_argument
argument
)
{
int
task_no
=
(
int
)
argument
;
printf
(
"Inside task %d...
\n
"
,
task_no
);
int
j
;
double
d
=
task_no
;
for
(
j
=
0
;
j
<
10000
;
j
++
)
{
int
k
;
for
(
k
=
0
;
k
<
10000
;
k
++
)
d
+=
1
.
001
;
d
*=
1
.
0001
;
}
printf
(
"Computed value by task %d was %ld
\n
"
,
task_no
,
(
long
)
d
);
rtems_task_delete
(
RTEMS_SELF
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment