Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cortex-m-rtfm-klee
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
KLEE
cortex-m-rtfm-klee
Commits
b65b2126
Commit
b65b2126
authored
7 years ago
by
Henrik Tjäder
Browse files
Options
Downloads
Plain Diff
Merge branch 'klee' of gitlab.henriktjader.com:KLEE/cortex-m-rtfm-klee into klee
parents
172ae071
560b34d3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
klee.py
+131
-0
131 additions, 0 deletions
klee.py
with
131 additions
and
0 deletions
klee.py
0 → 100644
+
131
−
0
View file @
b65b2126
#!/usr/bin/env python
import
gdb
import
os
import
sys
import
struct
from
subprocess
import
call
import
subprocess
import
glob
# gdb helper functions
def
gdb_continue
():
gdb
.
execute
(
"
continue
"
)
def
gdb_cyccnt_enable
():
# Enable cyccnt
gdb
.
execute
(
"
mon mww 0xe0001000 1
"
)
def
gdb_cyccnt_disable
():
# Disble cyccnt
gdb
.
execute
(
"
mon mww 0xe0001000 0
"
)
def
gdb_cyccnt_reset
():
# Reset cycle counter to 0
gdb
.
execute
(
"
mon mww 0xe0001004 0
"
)
def
gdb_cyccnt_read
():
# Read cycle counter
return
int
(
gdb
.
execute
(
"
mon mdw 0xe0001004
"
,
False
,
True
).
strip
(
'
\n
'
).
strip
(
'
0xe000012004:
'
).
strip
(
'
,
'
).
strip
(),
16
)
def
gdb_cyccnt_write
(
num
):
# Write to cycle counter
gdb
.
execute
(
'
mon mww 0xe0001004 %r
'
%
num
)
def
gdb_call
(
task
):
# call task
print
(
"
#### call task %s
"
%
task
)
gdb
.
execute
(
'
call %s
'
%
"
stub_
"
+
task
+
"
()
"
)
print
(
"
<<<<<<<<<<<<<<<<< after call >>>>>>>>>>>>>>>>>
"
)
def
gdb_setup
():
# Commands for making GDB scriptable
print
(
"
gbd init
"
)
gdb
.
execute
(
"
set confirm off
"
)
gdb
.
execute
(
"
set pagination off
"
)
gdb
.
execute
(
"
set verbose off
"
)
gdb
.
execute
(
"
set height 0
"
)
# gdb.execute("set unwindonsignal off")
gdb
.
execute
(
"
set unwindonsignal on
"
)
# Event handling
# GDB event, called on breakpoint
def
stop_event
(
evt
):
print
(
"
#### stop event %r
"
%
evt
)
try
:
ceiling
=
int
(
gdb
.
parse_and_eval
(
"
ceiling
"
).
cast
(
gdb
.
lookup_type
(
'
u8
'
)))
print
(
"
ceiling %r
"
%
ceiling
)
gdb_continue
()
except
gdb
.
error
:
print
(
"
#### return
"
)
gdb
.
post_event
(
next
)
next
()
def
next
():
global
task_nr
global
tasks
task_nr
=
task_nr
+
1
if
task_nr
==
len
(
tasks
):
print
(
"
------------ all done ---------
"
)
return
print
(
"
-------------- start {}-------------
"
.
format
(
task_nr
))
gdb_call
(
tasks
[
task_nr
-
1
])
print
(
"
-------------- finshed {}-------------
"
.
format
(
task_nr
))
next
()
# def next_event(next):
# global task_nr
# global tasks
# if task_nr == tasks.lenght():
# print("vvvvvvvvvvvvvvvvv")
# return
# print("-------------- start {}-------------".format(task_nr))
# gdb_call(tasks[t_nr])
# gdb.post_event(next)
# globals
tasks
=
[
"
EXTI2
"
,
"
EXTI3
"
,
"
EXTI1
"
]
task_nr
=
0
print
(
"
simple python script started
"
)
gdb_setup
()
gdb
.
events
.
stop
.
connect
(
stop_event
)
next
()
# gdb.events.next.connect(next_event)
# gdb.post_event(next)
# for t_nr, t_index in enumerate(tasks):
# busy = True
# sad = False
# try:
# gdb_call(tasks[t_nr])
# except:
# print("############ call failed #############")
# while busy:
# gdb_continue()
# while sad:
# pass
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