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
fcff65b6
Commit
fcff65b6
authored
8 years ago
by
Martine Lenders
Browse files
Options
Downloads
Patches
Plain Diff
od: quick-fix for newlib-nano
parent
0c22fffc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
sys/include/od.h
+6
-1
6 additions, 1 deletion
sys/include/od.h
sys/od/od.c
+4
-0
4 additions, 0 deletions
sys/od/od.c
tests/od/main.c
+2
-0
2 additions, 0 deletions
tests/od/main.c
tests/od/tests/01-run.py
+3
-0
3 additions, 0 deletions
tests/od/tests/01-run.py
with
15 additions
and
1 deletion
sys/include/od.h
+
6
−
1
View file @
fcff65b6
...
...
@@ -114,7 +114,12 @@ extern "C" {
#define OD_FLAGS_LENGTH_1 (0x0010)
/**< 1 byte */
#define OD_FLAGS_LENGTH_2 (0x0020)
/**< 2 byte */
#define OD_FLAGS_LENGTH_4 (0x0000)
/**< 4 byte and default */
#define OD_FLAGS_LENGTH_8 (0x0080)
/**< 8 byte */
/**
* @brief 8 byte
*
* @warning not working with newlib-nano
*/
#define OD_FLAGS_LENGTH_8 (0x0080)
#define OD_FLAGS_LENGTH_CHAR (OD_FLAGS_LENGTH_1)
/**< alias for OD_FLAGS_LENGTH_1 */
#define OD_FLAGS_LENGTH_SHORT (0x0002)
/**< sizeof(short) byte */
#define OD_FLAGS_LENGTH_LONG (0x0004)
/**< sizeof(long) byte */
...
...
This diff is collapsed.
Click to expand it.
sys/od/od.c
+
4
−
0
View file @
fcff65b6
...
...
@@ -303,12 +303,16 @@ static void _print_date(const void *data, size_t offset, char *format, uint8_t l
break
;
case
8
:
#ifndef MODULE_NEWLIB
if
(
flags
&
OD_FLAGS_BYTES_INT
)
{
printf
(
format
,
((
int64_t
*
)
data
)[
offset
]);
}
else
{
printf
(
format
,
((
uint64_t
*
)
data
)[
offset
]);
}
#else
printf
(
"%s"
,
format
);
#endif
break
;
...
...
This diff is collapsed.
Click to expand it.
tests/od/main.c
+
2
−
0
View file @
fcff65b6
...
...
@@ -143,6 +143,7 @@ int main(void)
OD_FLAGS_BYTES_HEX
|
OD_FLAGS_LENGTH_4
));
/* Test different 8-byte-wise byte formats */
#ifndef MODULE_NEWLIB
CALL
(
od
(
long_str
,
sizeof
(
long_str
),
OD_WIDTH_DEFAULT
,
OD_FLAGS_BYTES_INT
|
OD_FLAGS_LENGTH_8
));
CALL
(
od
(
long_str
,
sizeof
(
long_str
),
OD_WIDTH_DEFAULT
,
...
...
@@ -151,6 +152,7 @@ int main(void)
OD_FLAGS_BYTES_UINT
|
OD_FLAGS_LENGTH_8
));
CALL
(
od
(
long_str
,
sizeof
(
long_str
),
OD_WIDTH_DEFAULT
,
OD_FLAGS_BYTES_HEX
|
OD_FLAGS_LENGTH_8
));
#endif
/* Test different char-wise byte formats */
CALL
(
od
(
long_str
,
sizeof
(
long_str
),
OD_WIDTH_DEFAULT
,
...
...
This diff is collapsed.
Click to expand it.
tests/od/tests/01-run.py
+
3
−
0
View file @
fcff65b6
...
...
@@ -13,6 +13,9 @@ sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import
testrunner
def
testfunc
(
child
):
# check if running with newlib
print
(
"
ATTENTION: This script is currently not suitable for non-native platforms
"
)
# test data width vs. output width discrepency
child
.
expect_exact
(
r
'
od(short_str, sizeof(short_str), OD_WIDTH_DEFAULT, 0)
'
)
child
.
expect_exact
(
r
'
000000000 000000041101
'
)
...
...
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