Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Miosix Kernel
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
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
Avionics
Software Development
Miosix Kernel
Commits
b439a601
Commit
b439a601
authored
4 months ago
by
Federico
Browse files
Options
Downloads
Patches
Plain Diff
Print IRQ number in unexpectedInterrupt for debugging purposes as suggested by Emilio Corigliano
parent
463dd1c3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
miosix/arch/cpu/common/cortexMx_interrupts.cpp
+15
-6
15 additions, 6 deletions
miosix/arch/cpu/common/cortexMx_interrupts.cpp
with
15 additions
and
6 deletions
miosix/arch/cpu/common/cortexMx_interrupts.cpp
+
15
−
6
View file @
b439a601
...
...
@@ -76,11 +76,11 @@ const unsigned int numInterrupts=MIOSIX_NUM_PERIPHERAL_IRQ;
/**
* \internal
* To enable interrupt registration at run-time and interrupt arg pointer
* passing, we use one
p
f these structs per peripheral interrupt allocated in RAM
* passing, we use one
o
f these structs per peripheral interrupt allocated in RAM
*/
struct
IrqForwardingEntry
{
//NOTE: a constexpr constructo
s
can be used to perform static initialization
//NOTE: a constexpr constructo
r
can be used to perform static initialization
//of the table entries, but this uses a lot of Flash memory to store the
//initialization values. We thus opted to leave the table uninitialized
//and add the IRQinitIrqTable function that provides space efficient
...
...
@@ -244,8 +244,12 @@ void IRQinitIrqTable() noexcept
for
(
unsigned
int
i
=
0
;
i
<
numInterrupts
;
i
++
)
{
//Initialize all interrupts to a default priority and handler
//Initialize all interrupts to a default priority and handler and store
//the interrupt number as arg for debugging use in unexpectedInterrupt
irqForwardingTable
[
i
].
handler
=&
unexpectedInterrupt
;
#ifdef WITH_ERRLOG
irqForwardingTable
[
i
].
arg
=
reinterpret_cast
<
void
*>
(
i
);
#endif //WITH_ERRLOG
NVIC_SetPriority
(
static_cast
<
IRQn_Type
>
(
i
),
defaultIrqPriority
);
}
}
...
...
@@ -266,7 +270,9 @@ void IRQunregisterIrq(unsigned int id, void (*handler)(void*), void *arg) noexce
||
irqForwardingTable
[
id
].
arg
!=
arg
)
errorHandler
(
INTERRUPT_REGISTRATION_ERROR
);
irqForwardingTable
[
id
].
handler
=
unexpectedInterrupt
;
irqForwardingTable
[
id
].
arg
=
nullptr
;
#ifdef WITH_ERRLOG
irqForwardingTable
[
id
].
arg
=
reinterpret_cast
<
void
*>
(
id
);
#endif //WITH_ERRLOG
NVIC_DisableIRQ
(
static_cast
<
IRQn_Type
>
(
id
));
NVIC_ClearPendingIRQ
(
static_cast
<
IRQn_Type
>
(
id
));
}
...
...
@@ -669,10 +675,13 @@ void __attribute__((naked)) PendSV_Handler()
restoreContext
();
}
static
void
unexpectedInterrupt
(
void
*
)
static
void
unexpectedInterrupt
(
void
*
arg
)
{
#ifdef WITH_ERRLOG
IRQerrorLog
(
"
\r\n
***Unexpected peripheral interrupt
\r\n
"
);
auto
entryNum
=
reinterpret_cast
<
unsigned
int
>
(
arg
);
IRQerrorLog
(
"
\r\n
***Caught unregistered interrupt number "
);
printUnsignedInt
(
entryNum
);
IRQerrorLog
(
"
\r\n
"
);
#endif //WITH_ERRLOG
IRQsystemReboot
();
}
...
...
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