尝试切换板目标时 Zephyr 构建错误

Zephyr build error when trying to switch board target

我正在尝试为板 A 和板 B 构建 zephyr 示例代码(即构建是为代码 A 编写的,但我需要更改它以便它与板 B 一起工作)。我不断遇到这个错误,我不确定如何克服它。我已将 /board/soc/dts 子文件夹替换为适合我的板的文件。我更改了 Makefile 以针对我的开发板,它成功找到了它。

这是错误:

cmake -B build -DBOARD=my_project_name ./
-- Using out-of-tree SOC definition
-- Zephyr version: 2.2.0
-- Found PythonInterp: /opt/homebrew/bin/python3.6 (found suitable version "3.6.2", minimum required is "3.6") 
-- git describe failed: fatal: Not a git repository (or any of the parent directories): .git;
   BUILD_VERSION is left undefined
-- Selected BOARD my_project_name
-- Found west: /usr/local/bin/west (found suitable version "0.7.2", minimum required is "0.6.0")
-- Loading /Users/my_name/file_dir/Firmware/projects/my_project_name/boards/arm/my_project_name/my_project_name.dts as base
Devicetree header saved to '/Users/my_name/file_dir/Firmware/projects/my_project_name/build/zephyr/include/generated/devicetree_unfixed.h'
Parsing /Users/my_name/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/Kconfig
Loaded configuration '/Users/my_name/file_dir/Firmware/projects/my_project_name/boards/arm/my_project_name/my_project_name_defconfig'
Merged configuration '/Users/my_name/file_dir/Firmware/projects/my_project_name/prj.conf'
Configuration saved to '/Users/my_name/file_dir/Firmware/projects/my_project_name/build/zephyr/.config'
Kconfig header saved to '/Users/my_name/file_dir/Firmware/projects/my_project_name/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /Users/my_name/file_dir/third-party/toolchains/gcc-arm-none-eabi-8-2018/arm-gcc-macos/bin/arm-none-eabi-gcc
-- Cache files will be written to: /Users/my_name/Library/Caches/zephyr
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/my_name/file_dir/Firmware/projects/my_project_name/build
make -C build
Scanning dependencies of target driver_validation_h_target
[  1%] Generating include/generated/driver-validation.h
[  1%] Built target driver_validation_h_target
Scanning dependencies of target kobj_types_h_target
[  2%] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h
[  2%] Built target kobj_types_h_target
Scanning dependencies of target syscall_list_h_target
[  2%] Generating misc/generated/syscalls.json
[  3%] Generating include/generated/syscall_dispatch.c, include/generated/syscall_list.h
[  5%] Built target syscall_list_h_target
Scanning dependencies of target offsets
[  6%] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj
In file included from /Users/my_name/file_dir/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/arch/arm/include/aarch32/cortex_m/stack.h:23,
                 from /Users/my_name/file_dir/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/arch/arm/include/kernel_arch_data.h:33,
                 from /Users/my_name/file_dir/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/arch/arm/core/offsets/offsets_aarch32.c:26,
                 from /Users/my_name/file_dir/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/arch/arm/core/offsets/offsets.c:12:
/Users/my_name/file_dir/third-party/zephyr/zephyr_rtos/v2.2.0/zephyr/include/arch/arm/aarch32/cortex_m/cmsis.h:92:2: error: #error "DT_NUM_IRQ_PRIO_BITS and __NVIC_PRIO_BITS are not set to the same value."
 #error "DT_NUM_IRQ_PRIO_BITS and __NVIC_PRIO_BITS are not set to the same value."
  ^~~~~
make[3]: *** [zephyr/CMakeFiles/offsets.dir/arch/arm/core/offsets/offsets.c.obj] Error 1
make[2]: *** [zephyr/CMakeFiles/offsets.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [zephyr_project] Error 2

我已经检查以确保 soc.h#include <devicetree.h>。我不确定我现在还能尝试什么,所以感谢您的帮助。谢谢!

找到解决方案:我必须将 dts_fixup.h 添加到我的 soc 文件夹底部。