Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multipass
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
derf
multipass
Commits
5085f973
Commit
5085f973
authored
5 years ago
by
Daniel Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Resume execution after power loss
parent
a2f5c26a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/transactiontest/main.cc
+3
-1
3 additions, 1 deletion
src/app/transactiontest/main.cc
src/app/transactiontest/util.S
+33
-18
33 additions, 18 deletions
src/app/transactiontest/util.S
with
36 additions
and
19 deletions
src/app/transactiontest/main.cc
+
3
−
1
View file @
5085f973
...
...
@@ -42,10 +42,12 @@ int main(void)
gpio
.
setup
();
kout
.
setup
();
//restore_state();
gpio
.
led_on
(
0
);
gpio
.
input
(
GPIO
::
p4_5
,
1
);
asm_load_all
();
kout
<<
"Hello, World!"
<<
endl
;
arch
.
idle_loop
();
...
...
This diff is collapsed.
Click to expand it.
src/app/transactiontest/util.S
+
33
−
18
View file @
5085f973
...
...
@@ -8,12 +8,18 @@ stack_backup:
sp_backup
:
.
space
2
backup_cookie
:
.
space
2
asm_save_all
:
dint
.
irp
reg
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
push
r
\
reg
.
endr
mov
#
1234
h
,
r10
mov
r10
,
&bac
kup_cookie
mov
r1
,
&
sp_backup
mov
#
1
c00h
,
r10
...
...
@@ -34,6 +40,15 @@ save_sram_word:
asm_load_all
:
dint
push
r11
mov
&bac
kup_cookie
,
r11
cmp
#
1234
h
,
r11
jeq
do_load_all
pop
r11
eint
ret
do_load_all
:
; restore SRAM from backup
mov
#
stack_backup
,
r10
mov
#
1
c00h
,
r11
...
...
@@ -59,32 +74,32 @@ load_sram_word:
asm_load_mem
:
dint
; save return address in r4
mov
@
r1
,
r4
; restore SRAM from backup
push
r11
mov
&bac
kup_cookie
,
r11
cmp
#
1234
h
,
r11
jeq
do_load_mem
pop
r11
eint
ret
do_load_mem
:
push
r10
push
r9
; restore SRAM from backup, excluding current stack frame
mov
r1
,
r9
sub
6
,
r9
mov
#
stack_backup
,
r10
mov
#
1
c00h
,
r11
load_sram_word2
:
mov
@
r10
+,
0
(
r11
)
add
#
2
,
r11
cmp
#
1
c00h
+
2048
,
r11
cmp
r9
,
r11
jlo
load_sram_word2
; restore stack pointer
mov
&
sp_backup
,
r1
; restore old register contents
.
irp
reg
,
11
,
10
,
9
,
8
,
7
,
6
,
5
pop
r
\
reg
.
endr
; load return address, that is, the address this function was called from.
; This is not the address which called asm_save_all -- we only want to restore memory contents, not re-execute everything
mov
r4
,
2
(
r1
)
; load remaining register content
pop
r4
pop
r9
pop
r10
pop
r11
eint
ret
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