【问题标题】:Trouble with arm-none-eabi-gcc during compilation on Mac OS (M1)在 Mac OS (M1) 上编译期间出现 arm-none-eabi-gcc 问题
【发布时间】:2023-02-18 04:44:01
【问题描述】:
  • 上下文:

我正在使用带有 M1 pro 处理器的 Mac OS Monterey (12.5.1)

安装了最新版本的 Xcode

我正在尝试构建一个图像以在 raspberry pi 中使用它并尝试与 Piface LED 屏幕进行交互。 使用 PI OS,我在 config.txt 中加载我自己的内核 (.img)

我正在尝试用 (gcc) 编译 carm-none-eabi通过生成文件:

MAINFILE = a2p1
OBJS    =  lib/piface.o
OBJS    += lib/rpi-gpio.o lib/rpi-armtimer.o lib/rpi-interrupts.o lib/rpi-systimer.o 
OBJS    += lib/startup.o lib/syscalls.o 
OBJS    += $(MAINFILE).o

ELF     = $(MAINFILE).elf
MAIN    = $(MAINFILE).img

CROSS   = arm-none-eabi-
CC      = $(CROSS)gcc
AS      = $(CROSS)as
SIZE    = $(CROSS)size
OCOPY   = $(CROSS)objcopy

CFLAGS  = -march=armv8-a+crc -mtune=cortex-a53 -mfpu=vfp -mfloat-abi=soft -ffunction-sections -fdata-sections -fno-common -g -std=gnu99 -Wall -Wextra -Os -Ilib -DRPI3=1 -DIOBPLUS=1

LFLAGS  = -static -nostartfiles -lc -lgcc -specs=nano.specs -Wl,--gc-sections -lm
LSCRIPT = lib/rpi3.ld

LDFLAGS += -u _printf_float

.PHONY: all clean run

all: $(MAIN)

%.o: %.c
    $(CC) $(CFLAGS) -c -o $@ $^

$(ELF): $(OBJS)
    $(CC) -T $(LSCRIPT) $(CFLAGS) $(LFLAGS) $(LDFLAGS) -o $@ $^
    $(SIZE) $@
    
$(MAIN): $(ELF)
    $(OCOPY) $< -O binary $@

clean:
    rm -f $(MAIN) $(ELF) $(OBJS)

run: $(MAIN)

我以这种方式使用“端口”安装了 arm-none-eabi-gcc:

sudo 端口安装 arm-none-eabi-gcc

  • 这是我的错误:

找不到 -lc_nano:没有那个文件或目录

/opt/local/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld : can not find -lg_nano : No such file or directory

/opt/local/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld : can not find -lc_nano : No such file or directory

  • 错误是如何发生的: 当编译器试图运行它时(我想这是链接步骤):

arm-none-eabi-gcc -T lib/rpi3.ld -march=armv8-a+crc -mtune=cortex-a53 -mfpu=vfp -mfloat-abi=soft -ffunction-sections -fdata-sections -fno-common -g -std=gnu99 -Wall -Wextra -Os -Ilib -DRPI3=1 -DIOBPLUS=1 -static -nostartfiles -lc -lgcc -specs=nano.specs -Wl,--gc-sections -lm -u _printf_float -o a2p1.elf lib/piface.o lib/rpi-gpio.o lib/rpi-armtimer.o lib/rpi-interrupts .o lib/rpi-systimer.o lib/startup.o lib/syscalls.o a2p1.o

【问题讨论】:

    标签: c macos makefile compiler-errors arm


    【解决方案1】:

    我在端口上遇到了同样的问题,将其删除并改用:

    brew install --cask gcc-arm-embedded

    (https://formulae.brew.sh/cask/gcc-arm-embedded)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-24
      • 1970-01-01
      • 1970-01-01
      • 2019-06-19
      相关资源
      最近更新 更多