This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 57fc63382b62e4bc1da4e71f7cd1e8229440bead
Author: Jerzy Kasenberg <jerzy.kasenb...@codecoup.pl>
AuthorDate: Wed Apr 20 16:38:09 2022 +0200

    mcu/nrf5340: Add syscfg for interrupt stack size
    
    Interrupt stack size was hardcoded to 432 bytes.
    Now it can be changed by MAIN_STACK_SIZE syscfg value.
    
    Signed-off-by: Jerzy Kasenberg <jerzy.kasenb...@codecoup.pl>
---
 .../src/arch/cortex_m33/gcc_startup_nrf5340.s      |  6 ++++-
 hw/mcu/nordic/nrf5340/startup/syscfg.yml           | 29 ++++++++++++++++++++++
 .../src/arch/cortex_m33/gcc_startup_nrf5340_net.s  |  6 ++++-
 hw/mcu/nordic/nrf5340_net/startup/syscfg.yml       | 29 ++++++++++++++++++++++
 4 files changed, 68 insertions(+), 2 deletions(-)

diff --git 
a/hw/mcu/nordic/nrf5340/startup/src/arch/cortex_m33/gcc_startup_nrf5340.s 
b/hw/mcu/nordic/nrf5340/startup/src/arch/cortex_m33/gcc_startup_nrf5340.s
index dc842e09b..54d776d7b 100644
--- a/hw/mcu/nordic/nrf5340/startup/src/arch/cortex_m33/gcc_startup_nrf5340.s
+++ b/hw/mcu/nordic/nrf5340/startup/src/arch/cortex_m33/gcc_startup_nrf5340.s
@@ -20,10 +20,14 @@ NOTICE: This file has been modified by Nordic Semiconductor 
ASA.
 
 */
 
+#include "syscfg/syscfg.h"
+
     .syntax unified
     .arch armv8-m.main
 
-#define __STACK_SIZE 432
+#if MYNEWT_VAL(MAIN_STACK_SIZE)
+#define __STACK_SIZE MYNEWT_VAL(MAIN_STACK_SIZE)
+#endif
 #define __HEAP_SIZE 0
 #define __STARTUP_CLEAR_BSS
 
diff --git a/hw/mcu/nordic/nrf5340/startup/syscfg.yml 
b/hw/mcu/nordic/nrf5340/startup/syscfg.yml
new file mode 100644
index 000000000..191d0db2a
--- /dev/null
+++ b/hw/mcu/nordic/nrf5340/startup/syscfg.yml
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+    MAIN_STACK_SIZE:
+        description: >
+            Stack size (in bytes) to use in startup code.
+            For bootloader it's main stack, for application this stack is used 
by interrupts
+            and exceptions.
+        value: 432
+
+syscfg.vals.BOOT_LOADER:
+    # MCUboot code uses a lot of stack
+    MAIN_STACK_SIZE: 1024
diff --git 
a/hw/mcu/nordic/nrf5340_net/startup/src/arch/cortex_m33/gcc_startup_nrf5340_net.s
 
b/hw/mcu/nordic/nrf5340_net/startup/src/arch/cortex_m33/gcc_startup_nrf5340_net.s
index 8a2c0fc54..c10d73da3 100644
--- 
a/hw/mcu/nordic/nrf5340_net/startup/src/arch/cortex_m33/gcc_startup_nrf5340_net.s
+++ 
b/hw/mcu/nordic/nrf5340_net/startup/src/arch/cortex_m33/gcc_startup_nrf5340_net.s
@@ -20,10 +20,14 @@ NOTICE: This file has been modified by Nordic Semiconductor 
ASA.
 
 */
 
+#include "syscfg/syscfg.h"
+
     .syntax unified
     .arch armv8-m.main
 
-#define __STACK_SIZE 432
+#if MYNEWT_VAL(MAIN_STACK_SIZE)
+#define __STACK_SIZE MYNEWT_VAL(MAIN_STACK_SIZE)
+#endif
 #define __HEAP_SIZE 0
 #define __STARTUP_CLEAR_BSS
 
diff --git a/hw/mcu/nordic/nrf5340_net/startup/syscfg.yml 
b/hw/mcu/nordic/nrf5340_net/startup/syscfg.yml
new file mode 100644
index 000000000..191d0db2a
--- /dev/null
+++ b/hw/mcu/nordic/nrf5340_net/startup/syscfg.yml
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+syscfg.defs:
+    MAIN_STACK_SIZE:
+        description: >
+            Stack size (in bytes) to use in startup code.
+            For bootloader it's main stack, for application this stack is used 
by interrupts
+            and exceptions.
+        value: 432
+
+syscfg.vals.BOOT_LOADER:
+    # MCUboot code uses a lot of stack
+    MAIN_STACK_SIZE: 1024

Reply via email to