Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
e7020e_2019
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
Model registry
Operate
Environments
Monitor
Incidents
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
Ridge
e7020e_2019
Commits
ba4e9199
Commit
ba4e9199
authored
6 years ago
by
Ridge
Browse files
Options
Downloads
Patches
Plain Diff
bare3_2
parent
4e47498a
No related branches found
No related tags found
No related merge requests found
Pipeline
#136
canceled
6 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/bare3.rs
+23
-9
23 additions, 9 deletions
examples/bare3.rs
with
23 additions
and
9 deletions
examples/bare3.rs
+
23
−
9
View file @
ba4e9199
...
@@ -18,8 +18,11 @@ use cortex_m_semihosting::{hprint, hprintln};
...
@@ -18,8 +18,11 @@ use cortex_m_semihosting::{hprint, hprintln};
#[entry]
#[entry]
fn
main
()
->
!
{
fn
main
()
->
!
{
hprintln!
(
"bare3"
)
.unwrap
();
hprintln!
(
"bare3"
)
.unwrap
();
let
s
=
"ABCD"
;
let
s
:
&
str
=
"ABCD"
;
let
bs
=
s
.as_bytes
();
let
bs
:
&
[
u8
]
=
s
.as_bytes
();
let
c
:
&
u8
;
let
i
:
i32
;
let
a
:
[
u8
;
4
];
hprintln!
(
"s = {}"
,
s
)
.unwrap
();
hprintln!
(
"s = {}"
,
s
)
.unwrap
();
hprintln!
(
"bs = {:?}"
,
bs
)
.unwrap
();
hprintln!
(
"bs = {:?}"
,
bs
)
.unwrap
();
...
@@ -36,7 +39,7 @@ fn main() -> ! {
...
@@ -36,7 +39,7 @@ fn main() -> ! {
hprintln!
(
""
)
.unwrap
();
hprintln!
(
""
)
.unwrap
();
let
a
=
[
65u8
;
4
];
a
=
[
65u8
;
4
];
//let mut a = [0u8; 4];
//let mut a = [0u8; 4];
hprintln!
(
""
)
.unwrap
();
hprintln!
(
""
)
.unwrap
();
...
@@ -52,27 +55,38 @@ fn main() -> ! {
...
@@ -52,27 +55,38 @@ fn main() -> ! {
//
//
// 1. What is the output in the `openocd` (Adapter Output) console?
// 1. What is the output in the `openocd` (Adapter Output) console?
//
//
// ** your answer here **
// bare3
// s = ABCD
// bs = [65, 66, 67, 68]
// iterate over slice
// 65,66,67,68,iterate iterate using (raw) indexing
// 65,
// 66,
// 67,
// 68,
//
//
// a = AAAA
//
//
// What is the type of `s`?
// What is the type of `s`?
//
//
//
** your answer here **
//
type string
//
//
// What is the type of `bs`?
// What is the type of `bs`?
//
//
//
** your answer here **
//
u8 byte array
//
//
// What is the type of `c`?
// What is the type of `c`?
//
//
//
** your answer here **
//
Pointer for an u8 element in the bs array.
//
//
// What is the type of `a`?
// What is the type of `a`?
//
//
//
** your answer here **
//
it's an array of u8
//
//
// What is the type of `i`?
// What is the type of `i`?
//
//
//
** your answer here **
//
a int variable, i32
//
//
// Commit your answers (bare3_1)
// Commit your answers (bare3_1)
//
//
...
...
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