huojianchaoyy opened a new pull request, #21683: URL: https://github.com/apache/nuttx/pull/21683
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary `BOARD_CRASHDUMP_CUSTOM` is one entry of the "BOARD crashdump method" choice, together with the core dump targets (`BOARD_COREDUMP_SYSLOG`, `BOARD_COREDUMP_BLKDEV`, `BOARD_COREDUMP_MTDDEV`). `dump_fatal_info()` therefore calls either `board_crashdump()` or `coredump_dump()`. A board that keeps its own crash record with `board_crashdump()`, e.g. in battery-backed SRAM, cannot also produce a core dump. - **sched/misc/assert: fix nxstyle errors**: blank lines after declarations, so that the file passes checkpatch. No functional change. - **boards/Kconfig: allow BOARD_CRASHDUMP_CUSTOM with a core dump method**: `BOARD_CRASHDUMP_CUSTOM` becomes a separate option after the choice. When it is enabled, `board_crashdump()` is called first, then the core dump of the selected method, if any. ## Impact - Kconfig: `BOARD_CRASHDUMP_CUSTOM` moves out of the choice, its name does not change. A configuration that selected it keeps it enabled and the choice falls back to its default `BOARD_CRASHDUMP_NONE`, so only `board_crashdump()` is called, as before (see the olddefconfig test below). No in-tree defconfig sets `BOARD_CRASHDUMP_CUSTOM`. - Behavior only changes when `BOARD_CRASHDUMP_CUSTOM` and a core dump method are both enabled, which was not possible before. - No API change. ## Testing Host: Ubuntu 22.04 x86_64, Arm GNU Toolchain 13.2.rel1, GCC 13.4.0 (sim), CMake 3.23 + Ninja. Runtime test on QEMU 6.2 `mps2-an500`. `./tools/checkpatch.sh -c -u -m -g HEAD~2..HEAD` passes. `nucleo-f429zi:nsh` (it implements `board_crashdump()` in `stm32_bbsram.c`) with `CONFIG_STM32_BKPSRAM=y CONFIG_STM32_BBSRAM=y CONFIG_STM32_SAVE_CRASHDUMP=y CONFIG_BOARD_CRASHDUMP_CUSTOM=y CONFIG_COREDUMP=y CONFIG_BOARD_COREDUMP_SYSLOG=y`: Before, the choice keeps only one of them: ``` CONFIG_BOARD_COREDUMP_SYSLOG=y # CONFIG_BOARD_CRASHDUMP_CUSTOM is not set # CONFIG_BOARD_CRASHDUMP_NONE is not set ``` After, both are set and `dump_fatal_info()` calls both: ``` CONFIG_BOARD_COREDUMP_SYSLOG=y # CONFIG_BOARD_CRASHDUMP_NONE is not set CONFIG_BOARD_CRASHDUMP_CUSTOM=y $ arm-none-eabi-objdump -d nuttx | awk '/<dump_fatal_info>:/,/^$/' | grep -E 'bl.*<(board_crashdump|coredump_dump|syslog_flush)>' 80078e8: f009 f8fc bl 8010ae4 <syslog_flush> 80078fe: f007 f9df bl 800ecc0 <board_crashdump> 8007906: f001 f841 bl 800898c <coredump_dump> 800790a: f009 f8eb bl 8010ae4 <syslog_flush> ``` Old configuration with only `BOARD_CRASHDUMP_CUSTOM` selected in the choice, after `olddefconfig`: ``` # CONFIG_BOARD_COREDUMP_SYSLOG is not set # CONFIG_BOARD_COREDUMP_BLKDEV is not set # CONFIG_BOARD_COREDUMP_MTDDEV is not set CONFIG_BOARD_CRASHDUMP_NONE=y CONFIG_BOARD_CRASHDUMP_CUSTOM=y ``` `mps2-an500:nsh` with `CONFIG_COREDUMP=y CONFIG_BOARD_COREDUMP_SYSLOG=y CONFIG_NSH_DISABLE_MW=n` on QEMU, crash with `mw 0xf0000000=1`: the core dump is written as before. ``` arm_busfault: PANIC!!! Bus Fault: ... coredump_dump_syslog: Start coredump: ... coredump_dump_syslog: Finish coredump. hex formatted ``` `sim:nsh` builds. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
