LINUX.ORG.RU

История изменений

Исправление snake266, (текущая версия) :

Это же нужно больше для автоматизации сборки, я пока руками собраю библиотеку, потом добавлю правило для проверки сборки libopencm3. А так, на момент компиляции библиотека лежит на месте.

$ find libopencm3/lib/ -name "*.a"
libopencm3/lib/libopencm3_stm32f1.a
$ make
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -std=c99 -Wall -Wextra -Wshadow  -MD -O0  -DSTM32F1 -nostartfiles -nostdlib -I./libopencm3/include -Tstm32f1.ld -L./libopencm3/lib -lopencm3_stm32f1 -mcpu=cortex-m3 -mthumb --specs=nosys.specs main.c -o bin.elf
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: /tmp/ccqB2Ya6.o: in function `main':
main.c:(.text+0x2a): undefined reference to `rcc_periph_clock_enable'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x38): undefined reference to `gpio_set_mode'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x42): undefined reference to `gpio_clear'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x4c): undefined reference to `gpio_toggle'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x5e): undefined reference to `gpio_toggle'
collect2: error: ld returned 1 exit status
make: *** [Makefile:30: all] Error 1

Ну и даже если добавить, то ничего не меняется:

+ LIB = $(LIB_PATH)/libopencm3_stm32f1.a
- all:
+ all: $(LIB)
$ make
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -std=c99 -Wall -Wextra -Wshadow  -MD -O0  -DSTM32F1 -nostartfiles -nostdlib -I./libopencm3/include -Tstm32f1.ld -L./libopencm3/lib -lopencm3_stm32f1 -mcpu=cortex-m3 -mthumb --specs=nosys.specs main.c -o bin.elf
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: /tmp/ccggLm2s.o: in function `main':
main.c:(.text+0x2a): undefined reference to `rcc_periph_clock_enable'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x38): undefined reference to `gpio_set_mode'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x42): undefined reference to `gpio_clear'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x4c): undefined reference to `gpio_toggle'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x5e): undefined reference to `gpio_toggle'
collect2: error: ld returned 1 exit status
make: *** [Makefile:30: all] Error 1

Исходная версия snake266, :

Это же нужно больше для автоматизации сборки, я один раз руками собрал библиотеку и уже не думаю об этом. А так, на момент компиляции библиотека лежит на месте.

$ find libopencm3/lib/ -name "*.a"
libopencm3/lib/libopencm3_stm32f1.a
$ make
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -std=c99 -Wall -Wextra -Wshadow  -MD -O0  -DSTM32F1 -nostartfiles -nostdlib -I./libopencm3/include -Tstm32f1.ld -L./libopencm3/lib -lopencm3_stm32f1 -mcpu=cortex-m3 -mthumb --specs=nosys.specs main.c -o bin.elf
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: /tmp/ccqB2Ya6.o: in function `main':
main.c:(.text+0x2a): undefined reference to `rcc_periph_clock_enable'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x38): undefined reference to `gpio_set_mode'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x42): undefined reference to `gpio_clear'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x4c): undefined reference to `gpio_toggle'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x5e): undefined reference to `gpio_toggle'
collect2: error: ld returned 1 exit status
make: *** [Makefile:30: all] Error 1

Ну и даже если добавить, то ничего не меняется:

+ LIB = $(LIB_PATH)/libopencm3_stm32f1.a
- all:
+ all: $(LIB)
$ make
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -std=c99 -Wall -Wextra -Wshadow  -MD -O0  -DSTM32F1 -nostartfiles -nostdlib -I./libopencm3/include -Tstm32f1.ld -L./libopencm3/lib -lopencm3_stm32f1 -mcpu=cortex-m3 -mthumb --specs=nosys.specs main.c -o bin.elf
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: /tmp/ccggLm2s.o: in function `main':
main.c:(.text+0x2a): undefined reference to `rcc_periph_clock_enable'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x38): undefined reference to `gpio_set_mode'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x42): undefined reference to `gpio_clear'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x4c): undefined reference to `gpio_toggle'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: main.c:(.text+0x5e): undefined reference to `gpio_toggle'
collect2: error: ld returned 1 exit status
make: *** [Makefile:30: all] Error 1