浏览代码

Merge pull request #4346 from supperthomas/ci_test

[bsp/nrf5x] add the FAQ about hardfault
Bernard Xiong 4 年之前
父节点
当前提交
17ee3d2c08

+ 51 - 1
bsp/nrf5x/README.md

@@ -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
+```
+
+
+

+ 1 - 2
bsp/nrf5x/nrf52832/board/board.h

@@ -21,8 +21,7 @@ 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);
 

+ 2 - 2
bsp/nrf5x/nrf52840/board/Kconfig

@@ -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

+ 0 - 3
bsp/nrf5x/nrf52840/board/board.c

@@ -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();
 

+ 2 - 2
bsp/nrf5x/nrf52840/board/board.h

@@ -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);