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
2edfcdfc
Commit
2edfcdfc
authored
6 years ago
by
Federico Pellegrin
Browse files
Options
Downloads
Patches
Plain Diff
tests/periph_flashpage: add automated test for flash peripheral
parent
99e75948
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/periph_flashpage/main.c
+30
-0
30 additions, 0 deletions
tests/periph_flashpage/main.c
tests/periph_flashpage/tests/01-run.py
+20
-0
20 additions, 0 deletions
tests/periph_flashpage/tests/01-run.py
with
50 additions
and
0 deletions
tests/periph_flashpage/main.c
+
30
−
0
View file @
2edfcdfc
...
...
@@ -290,6 +290,35 @@ static int cmd_test(int argc, char **argv)
return
0
;
}
/**
* @brief Does a write and verify test on last page available
*
* @note Since every hardware can have different flash layouts for
* automated testing we always write to the last page available
* so we are independent of the size or layout
*/
static
int
cmd_test_last
(
int
argc
,
char
**
argv
)
{
(
void
)
argc
;
(
void
)
argv
;
char
fill
=
'a'
;
for
(
unsigned
i
=
0
;
i
<
sizeof
(
page_mem
);
i
++
)
{
page_mem
[
i
]
=
(
uint8_t
)
fill
++
;
if
(
fill
>
'z'
)
{
fill
=
'a'
;
}
}
if
(
flashpage_write_and_verify
((
int
)
FLASHPAGE_NUMOF
-
2
,
page_mem
)
!=
FLASHPAGE_OK
)
{
puts
(
"error verifying the content of last page"
);
return
1
;
}
puts
(
"wrote local page buffer to last flash page"
);
return
0
;
}
static
const
shell_command_t
shell_commands
[]
=
{
{
"info"
,
"Show information about pages"
,
cmd_info
},
{
"dump"
,
"Dump the selected page to STDOUT"
,
cmd_dump
},
...
...
@@ -302,6 +331,7 @@ static const shell_command_t shell_commands[] = {
{
"erase"
,
"Erase the given page buffer"
,
cmd_erase
},
{
"edit"
,
"Write bytes to the local page buffer"
,
cmd_edit
},
{
"test"
,
"Write and verify test pattern"
,
cmd_test
},
{
"test_last"
,
"Write and verify test pattern on last page available"
,
cmd_test_last
},
{
NULL
,
NULL
,
NULL
}
};
...
...
This diff is collapsed.
Click to expand it.
tests/periph_flashpage/tests/01-run.py
0 → 100755
+
20
−
0
View file @
2edfcdfc
#!/usr/bin/env python3
# Copyright (C) 2018 Federico Pellegrin <fede@evolware.org>
#
# 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.
import
sys
from
testrunner
import
run
def
testfunc
(
child
):
# writes and verifies the last page of the flash
child
.
sendline
(
"
test_last
"
)
child
.
expect_exact
(
'
wrote local page buffer to last flash page
'
)
if
__name__
==
"
__main__
"
:
sys
.
exit
(
run
(
testfunc
))
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