Skip to content
GitLab
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
b5bc5de5
Commit
b5bc5de5
authored
May 20, 2016
by
Thanassis Tsiodras
Browse files
Committed portable memchecking functionality used during RASTA tests
parent
375bea4b
Pipeline
#226
skipped
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
OAR/Makefile
View file @
b5bc5de5
...
...
@@ -40,7 +40,8 @@ SRC= \
init.c
\
task1.c
\
task2.c
\
common.c
common.c
\
memcheck.c
SUFFIX
=
$(CFG)
.
$(FPU_SUFFIX)
.
$(LEON)
...
...
OAR/src/init.c
View file @
b5bc5de5
...
...
@@ -18,6 +18,7 @@ rtems_task Init(rtems_task_argument argument)
rtems_id
Task_id
[
TASKS
];
/* task ids */
int
i
;
memcheck
();
g_init_task_id
=
rtems_task_self
();
for
(
i
=
0
;
i
<
TASKS
;
i
++
)
{
...
...
OAR/src/memcheck.c
0 → 100644
View file @
b5bc5de5
#include
<stdint.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
"system.h"
void
memcheck
()
{
uint32_t
patterns
[]
=
{
0x0
,
0xFFFFFFFF
,
0xAAAAAAAA
,
0x55555555
,
0xAA55AA55
,
0x55AA55AA
,
};
size_t
space
=
512
*
1024
;
void
*
p
=
malloc
(
space
);
int
i
;
printf
(
"[MEMCHECK] Detecting memory available"
);
while
(
p
)
{
free
(
p
);
printf
(
"."
);
fflush
(
stdout
);
space
+=
1024
*
1024
;
p
=
malloc
(
space
);
}
space
-=
1024
*
1024
;
printf
(
"
\n
[MEMCHECK] Memory available: %dK
\n
"
,
space
/
1024
);
p
=
malloc
(
space
);
if
(
!
p
)
{
puts
(
"[MEMCHECK] Unexpected heap error. Aborting..."
);
fflush
(
stdout
);
exit
(
1
);
}
for
(
i
=
0
;
i
<
sizeof
(
patterns
)
/
sizeof
(
patterns
[
0
]);
i
++
)
{
printf
(
"[MEMCHECK] Checking memory with pattern: 0x%x...
\n
"
,
(
unsigned
)
patterns
[
i
]);
uint32_t
*
pw
=
p
;
unsigned
words
=
space
/
4
;
// Writing the pattern
while
(
words
--
)
{
*
pw
++
=
patterns
[
i
];
}
pw
=
p
;
words
=
space
/
4
;
// Verifying the pattern
while
(
words
--
)
{
if
(
*
pw
!=
patterns
[
i
])
{
printf
(
"[MEMCHECK] Failed with pattern 0x%x at offset 0x%x
\n
"
,
(
unsigned
)
patterns
[
i
],
(
unsigned
)
pw
);
fflush
(
stdout
);
exit
(
1
);
}
pw
++
;
}
}
free
(
p
);
}
OAR/src/system.h
View file @
b5bc5de5
...
...
@@ -8,6 +8,7 @@ rtems_task Task1_EntryPoint(rtems_task_argument argument);
rtems_task
Task2_EntryPoint
(
rtems_task_argument
argument
);
void
task_begin
(
int
task_no
);
void
task_end
(
int
task_no
);
void
memcheck
(
void
);
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 64
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment