STM32F407进入HardFault_Handler,串口已经输出相关代码,请高手看看怎么解决?【增加堆栈空间不管用】

2019-07-20 23:24发布

如题,我的407跑不多久就进入硬件错误中断了,中断中我已经输出的重要信息,如下图所示,哪位看看是哪里出问题了

附:开始时进硬件中断,后把堆栈从0x2000改为了0x4000,还是不行。系统跑了ucos II,每个任务堆栈128B

2016-03-16_134209.png


下面是输出的相关信息:
[mw_shl_code=applescript,true]  unsigned int stacked_r0;
  unsigned int stacked_r1;
  unsigned int stacked_r2;
  unsigned int stacked_r3;
  unsigned int stacked_r12;
  unsigned int stacked_lr;
  unsigned int stacked_pc;
  unsigned int stacked_psr;

  unsigned int stacked_bfar;
  unsigned int stacked_cfsr;
  unsigned int stacked_hfsr;
  unsigned int stacked_dfsr;
  unsigned int stacked_afsr;
  unsigned int stacked_scb_shcsr;

  stacked_r0 = ((unsigned long) hardfault_args[0]);
  stacked_r1 = ((unsigned long) hardfault_args[1]);
  stacked_r2 = ((unsigned long) hardfault_args[2]);
  stacked_r3 = ((unsigned long) hardfault_args[3]);

  stacked_r12 = ((unsigned long) hardfault_args[4]);
  stacked_lr = ((unsigned long) hardfault_args[5]);
  stacked_pc = ((unsigned long) hardfault_args[6]);
  stacked_psr = ((unsigned long) hardfault_args[7]);

  stacked_bfar = (*((volatile unsigned long *)(0xE000ED38)));
  stacked_cfsr = (*((volatile unsigned long *)(0xE000ED28)));
  stacked_hfsr = (*((volatile unsigned long *)(0xE000ED2C)));
  stacked_dfsr = (*((volatile unsigned long *)(0xE000ED30)));
  stacked_afsr = (*((volatile unsigned long *)(0xE000ED3C)));
  stacked_scb_shcsr = SCB->SHCSR;

  printf (" [Hard fault handler - all numbers in hex] ");
  printf ("R0 = %x ", stacked_r0);
  printf ("R1 = %x ", stacked_r1);
  printf ("R2 = %x ", stacked_r2);
  printf ("R3 = %x ", stacked_r3);
  printf ("R12 = %x ", stacked_r12);
  printf ("LR [R14] = %x subroutine call return address ", stacked_lr);
  printf ("PC [R15] = %x program counter ", stacked_pc);
  printf ("PSR = %x ", stacked_psr);

  printf ("BFAR = %x ", stacked_bfar);
  printf ("CFSR = %x ", stacked_cfsr);
  printf ("HFSR = %x ", stacked_hfsr);
  printf ("DFSR = %x ", stacked_dfsr);
  printf ("AFSR = %x ", stacked_afsr);
  printf ("SCB_SHCSR = %x ", stacked_scb_shcsr);

  while (1);[/mw_shl_code]
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。