Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
klee-examples
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
Samuel Karlsson
klee-examples
Commits
c2e88a26
Commit
c2e88a26
authored
5 years ago
by
Per
Browse files
Options
Downloads
Patches
Plain Diff
runner refactoring
parent
4de57d13
Branches
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
examples/f401_break.rs
+0
-32
0 additions, 32 deletions
examples/f401_break.rs
runner/Cargo.toml
+3
-0
3 additions, 0 deletions
runner/Cargo.toml
runner/src/main.rs
+51
-40
51 additions, 40 deletions
runner/src/main.rs
runner/test000001.ktest
+0
-0
0 additions, 0 deletions
runner/test000001.ktest
with
54 additions
and
72 deletions
examples/f401_break.rs
deleted
100644 → 0
+
0
−
32
View file @
4de57d13
// minimal example for the stm32-f401 (and the f4 series)
//! Prints "Hello, world!" on the host console using semihosting
#![no_main]
#![no_std]
extern
crate
panic_halt
;
use
stm32f4
::
stm32f401
as
stm32
;
use
cortex_m
::
asm
;
use
cortex_m_rt
::
entry
;
#[entry]
fn
main
()
->
!
{
asm
::
bkpt
();
loop
{}
}
// See RM0368 Reference Manual for details
// https://www.st.com/content/ccc/resource/technical/document/reference_manual/5d/b1/ef/b2/a1/66/40/80/DM00096844.pdf/files/DM00096844.pdf/jcr:content/translations/en.DM00096844.pdf
//
// Memory map is given in `memory.x`, in particular we define:
// 96k RAM starting at 0x2000_0000, and
// 256k Flash starting at 0x0800_0000
//
// Run in separate terminal:
// openocd -f openocd.cfg
//
// cargo run --example f401_minimal --features f4 --target thumbv7em-none-eabihf
// This is the way!
This diff is collapsed.
Click to expand it.
runner/Cargo.toml
+
3
−
0
View file @
c2e88a26
...
...
@@ -10,3 +10,6 @@ edition = "2018"
probe-rs
=
{
path
=
"../../probe-rs/probe-rs"
,
version
=
"0.3.0"
}
ktest
=
{
path
=
"../ktest"
,
version
=
"0.1.0"
}
failure
=
"0.1.6"
[lib]
name
=
"runner"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
runner/src/main.rs
+
51
−
40
View file @
c2e88a26
...
...
@@ -13,6 +13,8 @@ use probe_rs::{
target
::
info
::{
self
,
ChipInfo
},
};
// don't look at this, its just testing some stuff...
// le byte order
fn
main
()
{
println!
(
"read ktest file"
);
...
...
@@ -52,26 +54,25 @@ fn main() {
// println!("... done");
let
cpu_info
=
session
.target
.core
.reset_and_halt
(
&
mut
session
.probe
)
.unwrap
();
println!
(
"Core stopped at address 0x{:08x}"
,
cpu_info
.pc
);
// let data = session.probe.read32(0x0000_0000).unwrap();
// println!("stack 0x{:08x}", data);
let
data
=
session
.probe
.read32
(
0x0000_000
0
)
.unwrap
();
println!
(
"
stack
0x{:08x}"
,
data
);
//
let data = session.probe.read32(0x0000_000
4
).unwrap();
//
println!("
reset
0x{:08x}", data);
let
data
=
session
.probe
.read32
(
0x0000_0004
)
.unwrap
();
println!
(
"reset 0x{:08x}"
,
data
);
// run_to_halt(&mut session);
run_to_halt
(
&
mut
session
);
cycnt_enable
(
&
mut
session
);
cycnt_reset
(
&
mut
session
);
run_to_halt
(
&
mut
session
);
let
cyccnt
=
cycnt_read
(
&
mut
session
);
println!
(
"cyccnt {}"
,
cyccnt
);
run_to_halt
(
&
mut
session
);
// cycnt_enable(&mut session);
// cycnt_reset(&mut session);
// let cyccnt = cycnt_read(&mut session);
// println!("cyccnt {}", cyccnt);
// run_to_halt(&mut session);
// let cyccnt = cycnt_read(&mut session);
// println!("cyccnt {}", cyccnt);
// run_to_halt(&mut session);
// session
// .target
...
...
@@ -94,23 +95,15 @@ fn main() {
// let cpu_info = session.target.core.step(&mut session.probe).unwrap();
// println!("Core stopped at address 0x{:08x}", cpu_info.pc);
// for (name, data) in ktest.objects {
// println!("run {}", name);
// session.target.core.run(&mut session.probe).unwrap();
// session
// .target
// .core
// .wait_for_core_halted(&mut session.probe)
// .unwrap();
// let cpu_info = session.target.core.halt(&mut session.probe).unwrap();
// println!("Core stopped at address 0x{:08x}", cpu_info.pc);
reset_and_halt
(
&
mut
session
);
run_to_halt
(
&
mut
session
);
// set_symbolic(&mut session, &data);
// }
for
(
name
,
data
)
in
ktest
.objects
{
set_symbolic
(
&
mut
session
,
&
data
);
run_to_halt
(
&
mut
session
);
}
//
println!("done
and run
");
println!
(
"done"
);
// session.target.core.run(&mut session.probe).unwrap();
// session
...
...
@@ -122,6 +115,20 @@ fn main() {
// println!("breapoint reached");
}
// resets the target and run
fn
reset_and_run
(
session
:
&
mut
Session
)
{
session
.target.core
.reset
(
&
mut
session
.probe
)
.unwrap
();
}
// resets the target and halts
fn
reset_and_halt
(
session
:
&
mut
Session
)
{
session
.target
.core
.reset_and_halt
(
&
mut
session
.probe
)
.unwrap
();
}
fn
read_bkpt
(
session
:
&
mut
Session
)
->
Option
<
u8
>
{
// try to read the program counter
let
pc_value
=
session
...
...
@@ -170,14 +177,18 @@ fn run_to_halt(session: &mut Session) {
}
session
.target.core
.run
(
&
mut
session
.probe
)
.unwrap
();
println!
(
"running"
);
session
.target
.core
.wait_for_core_halted
(
&
mut
session
.probe
)
.unwrap
();
match
session
.target.core
.wait_for_core_halted
(
&
mut
session
.probe
)
{
Ok
(
_
)
=>
{
print!
(
"Hit breakpoint :"
,);
}
Err
(
DebugProbeError
::
Timeout
)
=>
{
print!
(
"Timeout :"
);
}
Err
(
err
)
=>
panic!
(
"internal error:{:?}"
,
err
),
}
let
cpu_info
=
session
.target.core
.halt
(
&
mut
session
.probe
)
.unwrap
();
println!
(
"
Run:
Core stopped at address 0x{:08x}"
,
cpu_info
.pc
);
println!
(
"Core stopped at address 0x{:08x}"
,
cpu_info
.pc
);
}
// index is the oject number
fn
set_symbolic
(
session
:
&
mut
Session
,
data
:
&
[
u8
])
{
...
...
@@ -189,8 +200,8 @@ fn set_symbolic(session: &mut Session, data: &[u8]) {
println!
(
"r0 0x{:08x}"
,
r0
);
println!
(
"object {:?}"
,
data
);
session
.target.core
.step
(
&
mut
session
.probe
)
.unwrap
();
//
let r0 = session.probe.write_block8(r0, data).unwrap();
//
session.target.core.step(&mut session.probe).unwrap();
let
r0
=
session
.probe
.write_block8
(
r0
,
data
)
.unwrap
();
}
fn
open_probe
()
->
MasterProbe
{
...
...
This diff is collapsed.
Click to expand it.
runner/test000001.ktest
deleted
100644 → 0
+
0
−
0
View file @
4de57d13
File deleted
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