【问题标题】:About Meson, Cross File and STM32关于介子、交叉文件和STM32
【发布时间】:2020-10-29 09:13:58
【问题描述】:

我有一些关于使用介子交叉编译 STM32 的问题。我是介子的新手,并尝试用它编译 STM32 代码。我找到了这个存储库https://github.com/hwengineer/STM32F3Discovery-meson-example 并尝试改变它我需要它。

我的交叉文件是这样的

[binaries]
c       = 'arm-none-eabi-gcc'
cpp     = 'arm-none-eabi-g++'
ld      = 'arm-none-eabi-ld'
ar      = 'arm-none-eabi-ar'
as      = 'arm-none-eabi-as'
size    = 'arm-none-eabi-size'
objdump = 'arm-none-eabi-objdump'
objcopy = 'arm-none-eabi-objcopy'
strip   = 'arm-none-eabi-strip'
gdb     = 'arm-none-eabi-gdb'
terminal= 'x-terminal-emulator'
openocd = '/usr/local/bin/openocd'

exe_wrapper = 'meson_exe_wrapper.sh'

[properties]
c_args      = [
               '-mthumb',                   # define language
               #------------------------------------
               '-fshort-enums',             # otherwise errors at linking...
               '-fmessage-length=0',        # all error warnings in a single line (default 72)
               '-fsigned-char',             # char is per default unsigned
               '-ffunction-sections',       # each function to a seperate section ==> Code-optimization / deletion
               '-fdata-sections',           # each variable to a seperate section ==> Code-optimization / deletion

              '-Wall',
               '-ffreestanding',
               #------------------------------------
               # '-flto',
               ]

c_link_args = [
                '-nostdlib',             # do not import the standard library's
               # '-flto',
              ]

[host_machine]
system     = 'none'
cpu_family = 'arm'
cpu        = 'cortex-m3'
endian     = 'little'

但是当我尝试编译介子时会给出这个

Build type: native build
Project name: thermometer_with_meson
Project version: undefined
C compiler for the host machine: cc (gcc 10.2.0 "cc (GCC) 10.2.0")
C linker for the host machine: cc ld.bfd 2.35
Host machine cpu family: x86_64
Host machine cpu: x86_64

主机应该是arm cortex-m3,但是好像有错误。

为什么介子忽略交叉文件?为什么主机是 x86-64?

顺便说一句,它给出了这样的错误,因为 x86_64 应该是 x86-64。

【问题讨论】:

    标签: cross-compiling stm32 meson-build


    【解决方案1】:

    据我所知,您在输出日志中有:

    Build type: native build
    

    但是,您应该:

    Build type: cross build
    

    所以,检查构建是如何配置的,你应该设置交叉文件来设置构建目录,然后用于构建:

    $ meson build/ --cross-file cross_file.build
    $ ninja -C build/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-25
      • 2011-08-20
      • 2018-09-10
      • 1970-01-01
      • 1970-01-01
      • 2011-05-26
      相关资源
      最近更新 更多