Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
402b60e3
Commit
402b60e3
authored
8 years ago
by
Vincent Dupont
Browse files
Options
Downloads
Patches
Plain Diff
tests: add thread_float test app
parent
06f0c144
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/thread_float/Makefile
+16
-0
16 additions, 0 deletions
tests/thread_float/Makefile
tests/thread_float/main.c
+110
-0
110 additions, 0 deletions
tests/thread_float/main.c
with
126 additions
and
0 deletions
tests/thread_float/Makefile
0 → 100644
+
16
−
0
View file @
402b60e3
APPLICATION
=
thread_float
include
../Makefile.tests_common
BOARD_INSUFFICIENT_MEMORY
:=
airfy-beacon arduino-uno arduino-duemilanove
\
alliope-mini cc2650stk chronos maple-mini
\
mbed_lpc1768 microbit msb-430 msb-430h nrf51dongle
\
nrf6310 nucleo-f031k6 nucleo-f042k6
\
opencm9-04 pca10000 pca10005 spark-core
\
stm32f0discovery weio yunjia-nrf51822
USEMODULE
+=
printf_float
USEMODULE
+=
xtimer
#DISABLE_MODULE += cortexm_fpu
include
$(RIOTBASE)/Makefile.include
This diff is collapsed.
Click to expand it.
tests/thread_float/main.c
0 → 100644
+
110
−
0
View file @
402b60e3
/*
* Copyright (C) 2017 OTA keys S.A.
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Thread test application
*
* @author Vincent Dupont <vincent@otakeys.com>
*
* @}
*/
#include
<stdio.h>
#include
"thread.h"
#include
"msg.h"
#include
"xtimer.h"
#include
"timex.h"
static
char
t1_stack
[
THREAD_STACKSIZE_MAIN
];
static
char
t2_stack
[
THREAD_STACKSIZE_MAIN
];
static
char
t3_stack
[
THREAD_STACKSIZE_MAIN
];
static
kernel_pid_t
p1
,
p2
,
p3
;
static
xtimer_t
timer
;
#define OFFSET (10 * XTIMER_BACKOFF)
static
mutex_t
lock
=
MUTEX_INIT
;
static
void
timer_cb
(
void
*
arg
)
{
(
void
)
arg
;
thread_yield
();
xtimer_set
(
&
timer
,
OFFSET
);
}
static
void
*
thread1
(
void
*
arg
)
{
(
void
)
arg
;
float
f
,
init
;
printf
(
"THREAD %"
PRIkernel_pid
" start
\n
"
,
thread_getpid
());
init
=
1
.
0
*
thread_getpid
();
f
=
init
;
while
(
1
)
{
for
(
unsigned
long
i
=
0
;
i
<
10000ul
;
i
++
)
{
f
=
f
+
1
.
0
/
f
;
}
mutex_lock
(
&
lock
);
printf
(
"T(%"
PRIkernel_pid
"): %f
\n
"
,
thread_getpid
(),
(
double
)
f
);
mutex_unlock
(
&
lock
);
init
+=
1
.
0
;
f
=
init
;
}
return
NULL
;
}
static
void
*
thread2
(
void
*
arg
)
{
(
void
)
arg
;
float
f
,
init
;
printf
(
"THREAD %"
PRIkernel_pid
" start
\n
"
,
thread_getpid
());
init
=
1
.
0
*
thread_getpid
();
f
=
init
;
while
(
1
)
{
for
(
unsigned
long
i
=
0
;
i
<
100000ul
;
i
++
)
{
f
=
f
+
1
.
0
/
f
;
}
init
+=
1
.
0
;
f
=
init
;
}
return
NULL
;
}
int
main
(
void
)
{
p1
=
thread_create
(
t1_stack
,
sizeof
(
t1_stack
),
THREAD_PRIORITY_MAIN
+
1
,
THREAD_CREATE_WOUT_YIELD
|
THREAD_CREATE_STACKTEST
,
thread1
,
NULL
,
"nr1"
);
p2
=
thread_create
(
t2_stack
,
sizeof
(
t2_stack
),
THREAD_PRIORITY_MAIN
+
1
,
THREAD_CREATE_WOUT_YIELD
|
THREAD_CREATE_STACKTEST
,
thread2
,
NULL
,
"nr2"
);
p3
=
thread_create
(
t3_stack
,
sizeof
(
t3_stack
),
THREAD_PRIORITY_MAIN
+
1
,
THREAD_CREATE_WOUT_YIELD
|
THREAD_CREATE_STACKTEST
,
thread1
,
NULL
,
"nr3"
);
puts
(
"THREADS CREATED
\n
"
);
timer
.
callback
=
timer_cb
;
xtimer_set
(
&
timer
,
OFFSET
);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment