smartfusion2 softconsole hardfault
1、按照 SoftConsole v4.0 and Libero SoC v11.7 新建工程
2、main 函数里 ,只有 GPIO 初始化函数
3、仿真进入直接 hardfault

4、 调试 日志
fpServer v17 waiting for incoming connections on the port 3334 with API v5 Info : 1 1756010362874 microsemi_flashpro_server.c:1751 microsemi_flashpro_initialize() FlashPro ports available: E2008INI13 Info : 2 1756010362874 microsemi_flashpro_server.c:1752 microsemi_flashpro_initialize() FlashPro port selected: E2008INI13 xPack OpenOCD (Microchip SoftConsole build), x86_64 Open On-Chip Debugger 0.10.0+dev-00859-g95a8cd9b5-dirty (2020-10-19-17:30) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html M2S010 Info : only one transport option; autoselect 'jtag' do_board_reset_init Info : Listening on port 6666 for tcl connections Info : Listening on port 4444 for telnet connections Info : No Embedded FlashPro6 (revision B) devices found Info : clock speed 6000 kHz Info : JTAG tap: M2S010.tap tap/device found: 0x3f8031cf (mfg: 0x0e7 (GateField), part: 0xf803, ver: 0x3) Info : JTAG tap: M2S010.tap disabled Info : JTAG tap: M2S010.cpu enabled Info : Cortex-M3 IDCODE = 0x4ba00477 Info : M2S010.cpu: hardware has 6 breakpoints, 4 watchpoints Info : Listening on port 3333 for gdb connections Started by GNU MCU Eclipse Info : accepting 'gdb' connection on tcp/3333 target halted due to debug-request, current mode: Handler HardFault xPSR: 0xa1000003 pc: 0x00000380 msp: 0x2000ffb8 target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x00000190 msp: 0x20010000 target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x00000190 msp: 0x20010000 Info : Microsemi SmartFusion2 eNVM - writing 7056 (0x1b90) bytes to address 0x60000000 (. = 1024 bytes) ....... target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x00000190 msp: 0x20010000 target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x00000190 msp: 0x20010000 ===== arm v7m registers (0) r0 (/32): 0x60015A80 (1) r1 (/32): 0x20014000 (2) r2 (/32): 0xFFFEC000 (3) r3 (/32): 0x00000000 (4) r4 (/32): 0x00000000 (5) r5 (/32): 0x00000000 (6) r6 (/32): 0x00000000 (7) r7 (/32): 0x2000FFB0 (8) r8 (/32): 0x00000000 (9) r9 (/32): 0x00000000 (10) r10 (/32): 0x00000000 (11) r11 (/32): 0x00000000 (12) r12 (/32): 0x00000000 (13) sp (/32): 0x20010000 (14) lr (/32): 0xFFFFFFFF (15) pc (/32): 0x00000190 (16) xPSR (/32): 0x01000000 (17) msp (/32): 0x20010000 (18) psp (/32): 0x200008F8 (19) primask (/1): 0x00 (20) basepri (/8): 0x00 (21) faultmask (/1): 0x00 (22) control (/2): 0x00 ===== Cortex-M DWT registers
5、解决问题方法1: 插入串口初始化代码
进入 hardfault 的代码:

不进入hardfault 的代码:只是增加了串口初始化!

6、解决方法二: project config ,不要勾选 use newlib-nano

可以成功 进入 main

WHY? 2025年8月24日12点56分 星期天
浙公网安备 33010602011771号