Skip to content

Commit 2845d78

Browse files
committed
nrf54l: Make interrupt stack sizes configurable
1 parent 503cf64 commit 2845d78

4 files changed

Lines changed: 37 additions & 5 deletions

File tree

nrf54l_src/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,29 @@ light_tasking_nrf54l_app.LFCLK_Src = "LFRC"
219219
light_tasking_nrf54l_app.Time_Base_GRTC_IRQ = 0
220220
```
221221

222+
The following variables configure the interrupt stack sizes:
223+
224+
<table>
225+
<thead>
226+
<th>Variable</th>
227+
<th>Values</th>
228+
<th>Default</th>
229+
<th>Description</th>
230+
</thead>
231+
<tr>
232+
<td><tt>Interrupt_Stack_Size</tt></td>
233+
<td>Any positive integer</td>
234+
<td><tt>1024</tt></td>
235+
<td>Specifies the size of the primary stack used for interrupt handlers.</td>
236+
</tr>
237+
<tr>
238+
<td><tt>Interrupt_Secondary_Stack_Size</tt></td>
239+
<td>Any positive integer</td>
240+
<td><tt>128</tt></td>
241+
<td>Specifies the size of the secondary stack used for interrupt handlers.</td>
242+
</tr>
243+
</table>
244+
222245
### GPR Scenario Variables
223246

224247
The runtime project files expose `*_BUILD` and and `*_LIBRARY_TYPE` GPR

nrf54l_src/s-bbpara.ads

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@
4040

4141
-- This is the nRF54L15 (ARMv8-M) version of this package
4242

43+
pragma Restrictions (No_Elaboration_Code);
44+
4345
with System.BB.Board_Parameters;
4446
with System.BB.MCU_Parameters;
4547

48+
with NRF54_App_Runtime_Config;
49+
4650
package System.BB.Parameters is
47-
pragma No_Elaboration_Code_All;
4851
pragma Preelaborate (System.BB.Parameters);
4952

5053
Clock_Frequency : constant := Board_Parameters.Main_Clock_Frequency;
@@ -98,12 +101,14 @@ package System.BB.Parameters is
98101
-- Stacks --
99102
------------
100103

101-
Interrupt_Stack_Size : constant := 2 * 1024;
104+
Interrupt_Stack_Size : constant :=
105+
NRF54_App_Runtime_Config.Interrupt_Stack_Size;
102106
-- Size of each of the interrupt stacks in bytes. While there nominally is
103107
-- an interrupt stack per interrupt priority, the entire space is used as a
104108
-- single stack.
105109

106-
Interrupt_Sec_Stack_Size : constant := 128;
110+
Interrupt_Sec_Stack_Size : constant :=
111+
NRF54_App_Runtime_Config.Interrupt_Secondary_Stack_Size;
107112
-- Size of the secondary stack for interrupt handlers
108113

109114
Has_FPU : constant Boolean := True;

nrf54l_src/templates/alire.toml.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,8 @@ Enable_SWO = { type = "Boolean", default = true }
5757
Enable_Trace = { type = "Boolean", default = false }
5858
Enable_Glitch_Detector = { type = "Boolean", default = true }
5959

60+
Interrupt_Stack_Size = { type = "Integer", first = 1, default = 1024 }
61+
Interrupt_Secondary_Stack_Size = { type = "Integer", first = 1, default = 128 }
62+
6063
[[depends-on]]
6164
gnat_arm_elf = "^15"

nrf54l_src/templates/ravenscar_build.gpr.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,12 @@ project Ravenscar_Build is
122122
-- Always build System.BB.CPU_Primitives at -O2 as some targets may make
123123
-- use of inline assembly that rely on specific compiler behaviour to
124124
-- load constants that are not enabled at -O0.
125-
for Switches ("s-bbcppr.adb") use Target_Options.GNARL_ADAFLAGS & ("-O2");
125+
for Switches ("s-bbcppr.adb") use Target_Options.GNARL_ADAFLAGS
126+
& ("-O2", "-gnaty-d");
126127
-- Some runtime files need to be compiled with debug info, so that gdb
127128
-- is not blind.
128129
for Switches ("s-tasdeb.adb") use Target_Options.ALL_ADAFLAGS
129-
& ("-g", "-O0");
130+
& ("-g", "-O0", "-gnaty-d");
130131
end Compiler;
131132

132133
end Ravenscar_Build;

0 commit comments

Comments
 (0)