Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marek
firmware
Commits
4b847348
Commit
4b847348
authored
5 years ago
by
Mateusz Zalega
Browse files
Options
Downloads
Patches
Plain Diff
faultscreen: coding style
Signed-off-by:
Mateusz Zalega
<
mateusz@appliedsourcery.com
>
parent
16dda79a
Branches
msgctl/faultscreen
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/card10/faultscreen.c
+58
-46
58 additions, 46 deletions
lib/card10/faultscreen.c
lib/card10/faultsplash.c
+28
-28
28 additions, 28 deletions
lib/card10/faultsplash.c
with
86 additions
and
74 deletions
lib/card10/faultscreen.c
+
58
−
46
View file @
4b847348
...
...
@@ -12,33 +12,39 @@
#include
"core1.h"
struct
regs_t
{
unsigned
int
pc
;
unsigned
int
sp
;
unsigned
int
lr
;
unsigned
int
pc
;
unsigned
int
sp
;
unsigned
int
lr
;
}
static
regs
;
#define LOAD_REGS() \
__asm__ __volatile__( \
"ldr %0, [sp, #24] \n" \
"ldr %1, [sp, #20] \n" \
"mov %2, sp \n" \
: "=r" (regs.pc), \
"=r" (regs.lr), \
"=r" (regs.sp) \
)
static
void
generic_handler
(
const
char
*
reason
)
{
char
lines
[
3
][
64
];
Core1_Stop
();
__disable_irq
();
snprintf
(
lines
[
0
],
sizeof
(
lines
[
0
]),
"pc: 0x%08x"
,
regs
.
pc
);
snprintf
(
lines
[
1
],
sizeof
(
lines
[
1
]),
"sp: 0x%08x"
,
regs
.
sp
);
snprintf
(
lines
[
2
],
sizeof
(
lines
[
2
]),
"lr: 0x%08x"
,
regs
.
lr
);
gfx_copy_region
(
&
display_screen
,
0
,
0
,
160
,
80
,
GFX_RLE_MONO
,
faultsplash_rle_len
,
faultsplash_rle
);
#define LOAD_REGS() \
__asm__ __volatile__( \
"ldr %0, [sp, #24] \n" \
"ldr %1, [sp, #20] \n" \
"mov %2, sp \n" \
: "=r"(regs.pc), "=r"(regs.lr), "=r"(regs.sp))
static
void
generic_handler
(
const
char
*
reason
)
{
char
lines
[
3
][
64
];
Core1_Stop
();
__disable_irq
();
snprintf
(
lines
[
0
],
sizeof
(
lines
[
0
]),
"pc: 0x%08x"
,
regs
.
pc
);
snprintf
(
lines
[
1
],
sizeof
(
lines
[
1
]),
"sp: 0x%08x"
,
regs
.
sp
);
snprintf
(
lines
[
2
],
sizeof
(
lines
[
2
]),
"lr: 0x%08x"
,
regs
.
lr
);
gfx_copy_region
(
&
display_screen
,
0
,
0
,
160
,
80
,
GFX_RLE_MONO
,
faultsplash_rle_len
,
faultsplash_rle
);
Color
black
=
gfx_color
(
&
display_screen
,
BLACK
);
Color
white
=
gfx_color
(
&
display_screen
,
WHITE
);
...
...
@@ -50,35 +56,41 @@ static void generic_handler(const char *reason) {
gfx_update
(
&
display_screen
);
}
static
void
NMI_Handler_
(
void
)
{
LOAD_REGS
();
generic_handler
(
"NMI Fault"
);
static
void
NMI_Handler_
(
void
)
{
LOAD_REGS
();
generic_handler
(
"NMI Fault"
);
}
static
void
HardFault_Handler_
(
void
)
{
LOAD_REGS
();
generic_handler
(
"HardFault"
);
static
void
HardFault_Handler_
(
void
)
{
LOAD_REGS
();
generic_handler
(
"HardFault"
);
}
static
void
MemManage_Handler_
(
void
)
{
LOAD_REGS
();
generic_handler
(
"MemMgmtFault"
);
static
void
MemManage_Handler_
(
void
)
{
LOAD_REGS
();
generic_handler
(
"MemMgmtFault"
);
}
static
void
BusFault_Handler_
(
void
)
{
LOAD_REGS
();
generic_handler
(
"BusFault"
);
static
void
BusFault_Handler_
(
void
)
{
LOAD_REGS
();
generic_handler
(
"BusFault"
);
}
static
void
UsageFault_Handler_
(
void
)
{
LOAD_REGS
();
generic_handler
(
"UsageFault"
);
static
void
UsageFault_Handler_
(
void
)
{
LOAD_REGS
();
generic_handler
(
"UsageFault"
);
}
void
card10_set_fault_handlers
(
void
)
{
NVIC_SetVector
(
NonMaskableInt_IRQn
,
NMI_Handler_
);
NVIC_SetVector
(
HardFault_IRQn
,
HardFault_Handler_
);
NVIC_SetVector
(
MemoryManagement_IRQn
,
MemManage_Handler_
);
NVIC_SetVector
(
BusFault_IRQn
,
BusFault_Handler_
);
NVIC_SetVector
(
UsageFault_IRQn
,
UsageFault_Handler_
);
void
card10_set_fault_handlers
(
void
)
{
NVIC_SetVector
(
NonMaskableInt_IRQn
,
NMI_Handler_
);
NVIC_SetVector
(
HardFault_IRQn
,
HardFault_Handler_
);
NVIC_SetVector
(
MemoryManagement_IRQn
,
MemManage_Handler_
);
NVIC_SetVector
(
BusFault_IRQn
,
BusFault_Handler_
);
NVIC_SetVector
(
UsageFault_IRQn
,
UsageFault_Handler_
);
}
This diff is collapsed.
Click to expand it.
lib/card10/faultsplash.c
+
28
−
28
View file @
4b847348
#include
"faultsplash.h"
const
unsigned
char
faultsplash_rle
[]
=
{
0x7f
,
0x50
,
0x83
,
0x0f
,
0x82
,
0x7f
,
0x0d
,
0x83
,
0x0f
,
0x82
,
0x7f
,
0x1d
,
0x82
,
0x7f
,
0x1f
,
0x82
,
0x7f
,
0x1f
,
0x82
,
0x7f
,
0x12
,
0x82
,
0x09
,
0x82
,
0x7f
,
0x14
,
0x82
,
0x09
,
0x82
,
0x7f
,
0x09
,
0x82
,
0x11
,
0x83
,
0x7f
,
0x0b
,
0x82
,
0x11
,
0x83
,
0x7f
,
0x0f
,
0x82
,
0x07
,
0x82
,
0x7f
,
0x16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
0x17
,
0x82
,
0x02
,
0x82
,
0x02
,
0x83
,
0x73
,
0x8c
,
0x16
,
0x82
,
0x02
,
0x82
,
0x02
,
0x83
,
0x72
,
0x81
,
0x0c
,
0x84
,
0x07
,
0x85
,
0x7f
,
0x03
,
0x82
,
0x0c
,
0x84
,
0x07
,
0x86
,
0x7f
,
0x02
,
0x82
,
0x0c
,
0x84
,
0x07
,
0x86
,
0x7f
,
0x82
,
0x12
,
0x87
,
0x7f
,
0x06
,
0x82
,
0x12
,
0x87
,
0x7f
,
0x06
,
0x82
,
0x24
,
0x82
,
0x78
,
0x82
,
0x24
,
0x82
,
0x78
,
0x82
,
0x24
,
0x82
,
0x78
,
0x82
,
0x16
,
0x83
,
0x04
,
0x82
,
0x07
,
0x82
,
0x76
,
0x82
,
0x16
,
0x83
,
0x04
,
0x82
,
0x07
,
0x82
,
0x70
,
0x8f
,
0x0d
,
0x82
,
0x12
,
0x82
,
0x6e
,
0x8f
,
0x0d
,
0x82
,
0x12
,
0x82
,
0x6e
,
0x8f
,
0x0b
,
0x82
,
0x09
,
0x82
,
0x0b
,
0x82
,
0x6c
,
0x8f
,
0x0b
,
0x82
,
0x09
,
0x82
,
0x0b
,
0x82
,
0x6c
,
0x8f
,
0x0b
,
0x82
,
0x09
,
0x82
,
0x0b
,
0x82
,
0x6c
,
0x8f
,
0x7f
,
0x12
,
0x8f
,
0x7f
,
0x0d
,
0x98
,
0x12
,
0x82
,
0x74
,
0x98
,
0x12
,
0x82
,
0x70
,
0xa1
,
0x7f
,
0xa1
,
0x7f
,
0xa1
,
0x7f
,
0xa1
,
0x7f
,
0xa1
,
0x7d
,
0xa5
,
0x7b
,
0xa5
,
0x7b
,
0xa5
,
0x7b
,
0xa5
,
0x7a
,
0xa6
,
0x78
,
0x89
,
0x02
,
0x9f
,
0x76
,
0x89
,
0x02
,
0x9f
,
0x76
,
0xaa
,
0x76
,
0xaa
,
0x76
,
0x87
,
0x02
,
0xa1
,
0x76
,
0x87
,
0x02
,
0xa1
,
0x76
,
0x87
,
0x02
,
0xa1
,
0x76
,
0x87
,
0x02
,
0xa1
,
0x76
,
0x87
,
0x02
,
0xa1
,
0x76
,
0x87
,
0x02
,
0xa1
,
0x76
,
0x87
,
0x02
,
0xa1
,
0x76
,
0xaa
,
0x76
,
0xaa
,
0x76
,
0xaa
,
0x76
,
0x89
,
0x02
,
0x9f
,
0x76
,
0x89
,
0x02
,
0x9f
,
0x79
,
0xa5
,
0x7b
,
0xa5
,
0x7b
,
0xa5
,
0x7b
,
0x8b
,
0x02
,
0x98
,
0x7b
,
0x8b
,
0x02
,
0x98
,
0x7d
,
0xa1
,
0x7f
,
0xa1
,
0x7f
,
0xa1
,
0x7f
,
0xa1
,
0x7f
,
0xa1
,
0x7f
,
0x04
,
0x98
,
0x7f
,
0x09
,
0x98
,
0x7f
,
0x0e
,
0x8f
,
0x7f
,
0x12
,
0x8f
,
0x7f
,
0x7f
,
0x7f
,
0x7f
,
0x7f
,
0x7f
,
0x06
};
const
size_t
faultsplash_rle_len
=
302
;
const
size_t
faultsplash_width
=
160
;
const
size_t
faultsplash_height
=
80
;
const
size_t
faultsplash_width
=
160
;
const
size_t
faultsplash_height
=
80
;
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