nuttx 中断栈配置

1、某块stm32单板跑nuttx系统,出现异常挂起,分析发现中断栈已经用完,需要调整中断栈大小

up_hardfault: PANIC!!! Hard fault: 40000000
up_assert: Assertion failed at file:armv7-m/up_hardfault.c line: 171 task: hpwork
up_dumpstate: sp:     240074c8
up_dumpstate: IRQ stack:
up_dumpstate:   base: 240074e8
up_dumpstate:   size: 000002ec
up_dumpstate:   used: 000002ec
up_stackdump: 240074c0: 00000003 080ddec7 080ddea5 080e7119 00000010 2400742c 000000ff 00000000
up_stackdump: 240074e0: 0000002f 080dde2b deadbeef 30000010 00000001 00000000 00000000 0000ffff
up_dumpstate: sp:     080ea1c9
up_dumpstate: User stack:
up_dumpstate:   base: 30001ee8
up_dumpstate:   size: 00000fec
up_dumpstate:   used: 00000358
up_registerdump: R0: 0811b2d8 00000358 000000ab 300008fc 2400747c 0811b3b7 240041e8 24005264
up_registerdump: R8: 00000358 300007b0 30001e48 00000000 300008fc 00000000 2400747c 0811b3b7
up_registerdump: xPSR: 2400747c BASEPRI: 00000000 CONTROL: 00000000
up_registerdump: EXC_RETURN: 080e4253
up_taskdump: Idle Task: PID=0 Stack Used=0 of 0
up_taskdump: hpwork: PID=1 Stack Used=856 of 4076
up_taskdump: lpwork: PID=2 Stack Used=632 of 4076
up_taskdump: init: PID=3 Stack Used=2088 of 2484
up_taskdump: mc_att_control: PID=197 Stack Used=1272 of 1676
up_taskdump: mc_pos_control: PID=199 Stack Used=656 of 1876
up_taskdump: gps: PID=106 Stack Used=888 of 1372
up_taskdump: navigator: PID=203 Stack Used=888 of 1572
up_taskdump: mavlink_if0: PID=140 Stack Used=1648 of 2420
up_taskdump: mavlink_rcv_if0: PID=141 Stack Used=944 of 2100
up_taskdump: commander_low_prio: PID=209 Stack Used=584 of 2996
up_taskdump: sensors: PID=120 Stack Used=1624 of 1980
up_taskdump: commander: PID=122 Stack Used=2832 of 3548
up_taskdump: mavlink_if1: PID=157 Stack Used=1624 of 2388
up_taskdump: mavlink_rcv_if1: PID=158 Stack Used=944 of 2100

up_taskdump: ekf2: PID=191 Stack Used=4968 of 5780

2、单板的nuttx配置文件与中断栈相关的配置,需要调整CONFIG_ARCH_INTERRUPTSTACK配置项的大小

#
# Interrupt options
#
CONFIG_ARCH_HAVE_INTERRUPTSTACK=y
CONFIG_ARCH_INTERRUPTSTACK=750
CONFIG_ARCH_HAVE_HIPRI_INTERRUPT=y

CONFIG_ARCH_HIPRI_INTERRUPT=y


3、nuttx\arch\arm\src\armv7-m\gnu\up_exception.S文件里面分配了中断栈

/************************************************************************************
 *  Name: g_intstackalloc/g_intstackbase
 *
 * Description:
 *   Shouldn't happen
 *
 ************************************************************************************/
#if CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
.global g_intstackalloc
.global g_intstackbase
.align 8
g_intstackalloc:
.skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
g_intstackbase:
.size g_intstackalloc, .-g_intstackalloc
#endif
      .end








你可能感兴趣的:(stm32,nuttx)