ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Четверг
21 ноября
1338201
yни (08.08.2023 11:04, просмотров: 567)
Подскажите, как скомпоновать doom так, чтобы он вошёл в STM32F429-DISC1. Пытаюсь собрать проект при помощи cmake и не выходит так же как с make. Секция bss почему-то перезаполняется, хотя вроде бы собирается всё по аналогии. 

Исходники (cmake): https://github.com/ViacheslavMezentsev/demo-stm32-cmake/tree/main/stm32f4xx/doom
Исходники (make): https://github.com/floppes/stm32doom

Мой результат:

c:/users/v.mezentsev/scoop/apps/gcc-arm-none-eabi/current/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: doom.elf section `.bss' will not fit in region `ram'

c:/users/v.mezentsev/scoop/apps/gcc-arm-none-eabi/current/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: region `ram' overflowed by 62136 bytes

Memory region Used Size Region Size %age Used

rom: 397876 B 2 MB 18.97%

ram: 324280 B 256 KB 123.70%

sdram: 7 MB 7892 KB 90.83%

collect2.exe: error: ld returned 1 exit status

ninja: build stopped: subcommand failed.

build finished with error(s).


Результат с make:

Memory region Used Size Region Size %age Used

rom: 456132 B 2 MB 21.75%

ram: 149608 B 256 KB 57.07%

sdram: 7516004 B 7892 KB 93.00%

generating ../Debug/stm32doom.hex ...

arm-none-eabi-objcopy -O ihex ../Debug/stm32doom.elf ../Debug/stm32doom.hex

generating ../Debug/stm32doom.bin ...

arm-none-eabi-objcopy -O binary ../Debug/stm32doom.elf ../Debug/stm32doom.bin

generating ../Debug/stm32doom.lss ...

arm-none-eabi-objdump -h -S ../Debug/stm32doom.elf > ../Debug/stm32doom.lss

arm-none-eabi-size --format=berkeley ../Debug/stm32doom.elf

text data bss dec hex filename

456132 62132 7603476 8121740 7bed8c ../Debug/stm32doom.elf


Не могу понять как в bss попали данные из rom при "прочих равных". Что-то не так, но не ясно где. Код взят тот же, ld-файл тоже. Изменено только окружение сборки (make -> cmake).

Пример сборки при помощи make:

arm-none-eabi-gcc -mthumb -mtune=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -fcommon -Wall -DDEBUG_ -DSTM32F4XX -DUSE_STDPERIPH_DRIVER -DSTM32F429_439xx -g -I ../src -I chocdoom -I ../lib/stm32 -I ../lib/us

b -I ../lib/fatfs -O2 -c ../lib/usb/usbh_stdreq.c -o ../Debug/usb/usbh_stdreq.o

compiling ../lib/usb/usbh_usr.c ...

arm-none-eabi-gcc -mthumb -mtune=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -fcommon -Wall -DDEBUG_ -DSTM32F4XX -DUSE_STDPERIPH_DRIVER -DSTM32F429_439xx -g -I ../src -I chocdoom -I ../lib/stm32 -I ../lib/us

b -I ../lib/fatfs -O2 -c ../lib/usb/usbh_usr.c -o ../Debug/usb/usbh_usr.o

compiling ../lib/fatfs/diskio.c ...

arm-none-eabi-gcc -mthumb -mtune=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -fcommon -Wall -DDEBUG_ -DSTM32F4XX -DUSE_STDPERIPH_DRIVER -DSTM32F429_439xx -g -I ../src -I chocdoom -I ../lib/stm32 -I ../lib/us

b -I ../lib/fatfs -O2 -c ../lib/fatfs/diskio.c -o ../Debug/fatfs/diskio.o

compiling ../lib/fatfs/fatfs.c ...

arm-none-eabi-gcc -mthumb -mtune=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -fcommon -Wall -DDEBUG_ -DSTM32F4XX -DUSE_STDPERIPH_DRIVER -DSTM32F429_439xx -g -I ../src -I chocdoom -I ../lib/stm32 -I ../lib/us

b -I ../lib/fatfs -O2 -c ../lib/fatfs/fatfs.c -o ../Debug/fatfs/fatfs.o

compiling ../lib/fatfs/fatfs_sdcard.c ...

arm-none-eabi-gcc -mthumb -mtune=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -fcommon -Wall -DDEBUG_ -DSTM32F4XX -DUSE_STDPERIPH_DRIVER -DSTM32F429_439xx -g -I ../src -I chocdoom -I ../lib/stm32 -I ../lib/us

b -I ../lib/fatfs -O2 -c ../lib/fatfs/fatfs_sdcard.c -o ../Debug/fatfs/fatfs_sdcard.o

compiling ../lib/fatfs/fatfs_usbdisk.c ...

arm-none-eabi-gcc -mthumb -mtune=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -fcommon -Wall -DDEBUG_ -DSTM32F4XX -DUSE_STDPERIPH_DRIVER -DSTM32F429_439xx -g -I ../src -I chocdoom -I ../lib/stm32 -I ../lib/us

b -I ../lib/fatfs -O2 -c ../lib/fatfs/fatfs_usbdisk.c -o ../Debug/fatfs/fatfs_usbdisk.o

compiling ../lib/fatfs/ff.c ...

arm-none-eabi-gcc -mthumb -mtune=cortex-m4 -march=armv7e-m -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -fcommon -Wall -DDEBUG_ -DSTM32F4XX -DUSE_STDPERIPH_DRIVER -DSTM32F429_439xx -g -I ../src -I chocdoom -I ../lib/stm32 -I ../lib/us

b -I ../lib/fatfs -O2 -c ../lib/fatfs/ff.c -o ../Debug/fatfs/ff.o

linking ../Debug/stm32doom.elf ...


То же для cmake из файла compile_commands.json:

"directory": "C:/github/demo-stm32-cmake/stm32f4xx/doom/build/Debug",

"command": "C:\\Users\\v.mezentsev\\scoop\\apps\\gcc-arm-none-eabi\\current\\bin\\arm-none-eabi-gcc.exe --sysroot=C:/Users/v.mezentsev/scoop/apps/gcc-arm-none-eabi/current/arm-none-eabi -DDEBUG_ -DSTM32F429_439xx -DSTM32F4XX -DUSE_STDPERIPH_DRIVER -IC:/github/demo-stm32-cmake/stm32f4xx/doom/cmsis/include -IC:/github/demo-stm32-cmake/stm32f4xx/doom/device/include -IC:/github/demo-stm32-cmake/stm32f4xx/doom/driver/inc -IC:/github/demo-stm32-cmake/stm32f4xx/doom/fatfs/inc -IC:/github/demo-stm32-cmake/stm32f4xx/doom/usbhost/inc -IC:/github/demo-stm32-cmake/stm32f4xx/doom/chocdoom/inc -IC:/github/demo-stm32-cmake/stm32f4xx/doom/user/inc -IC:/github/demo-stm32-cmake/stm32f4xx/doom -g -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -fcommon -fdata-sections -ffunction-sections -Wall -O2 -c -o CMakeFiles\\doom.dir\\fatfs\\src\\fatfs_sdcard.c.obj -c C:\\github\\demo-stm32-cmake\\stm32f4xx\\doom\\fatfs\\src\\fatfs_sdcard.c",

"file": "C:\\github\\demo-stm32-cmake\\stm32f4xx\\doom\\fatfs\\src\\fatfs_sdcard.c",

"output": "CMakeFiles\\doom.dir\\fatfs\\src\\fatfs_sdcard.c.obj"