add the FAQ about hardfault

This commit is contained in:
supperthomas 2021-02-18 06:23:53 +08:00
parent 51c492881a
commit 5c73b3e6e9
4 changed files with 55 additions and 8 deletions

View File

@ -132,4 +132,54 @@ nrf5x
下面提供一种擦写softdevice的方法。在keil中选择softdevice Erase的FLASH算法这个时候就烧写之前可以擦除之前的softdevice。
![image-20201017194935643](docs/images/softdevice_erase.png)
![image-20201017194935643](docs/images/softdevice_erase.png)
### 2.如果在使用softdevice的时候连上手机时候出现一些hardfault
如下所示:
```
psr: 0x8100000f
r00: 0x00000000
r01: 0x200034e6
r02: 0x00000000
r03: 0x200034dc
r04: 0x200034dc
r05: 0x00000000
r06: 0x200034e6
r07: 0xdeadbeef
r08: 0xdeadbeef
r09: 0xdeadbeef
r10: 0xdeadbeef
r11: 0xdeadbeef
r12: 0x00000000
lr: 0x000369af
pc: 0x00036972
hard fault on handler
```
这个hardfault发生在SOFTDEVICE内部由于代码不开源这边尝试了修改如下函数可以不触发hardfault。
```
rt_hw_interrupt_disable PROC
EXPORT rt_hw_interrupt_disable
;MRS r0, PRIMASK
;CPSID I
BX LR
ENDP
;/*
; * void rt_hw_interrupt_enable(rt_base_t level);
; */
rt_hw_interrupt_enable PROC
EXPORT rt_hw_interrupt_enable
;MSR PRIMASK, r0
BX LR
ENDP
```

View File

@ -314,8 +314,8 @@ menu "On-chip Peripheral Drivers"
endif
config BSP_USING_SPI
bool "Enable SPI"
select RT_USING_PIN
default y
select RT_USING_SPI
default n
if BSP_USING_SPI
config NRFX_SPI_ENABLED

View File

@ -53,9 +53,6 @@ void SysTick_Configuration(void)
void rt_hw_board_init(void)
{
rt_hw_interrupt_enable(0);
// sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
/* Activate deep sleep mode */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
SysTick_Configuration();

View File

@ -21,8 +21,8 @@ extern int __bss_end__;
#define HEAP_BEGIN ((void *)&__bss_end__)
#endif
#define HEAP_SIZE 16*1024
#define HEAP_END (HEAP_BEGIN + HEAP_SIZE)
#define HEAP_END (MCU_SRAM_END_ADDRESS)
void rt_hw_board_init(void);