dmitrystu / sboot_stm32

Secure USB DFU1.1 bootloader for STM32
Apache License 2.0
313 stars 67 forks source link

Compiling bootloader for stm32f103x8 #31

Closed TamojitSaha closed 3 years ago

TamojitSaha commented 3 years ago

Hello, I have installed the prerequisites as mentioned in order to compile bootloader. I have also correctly edited the MakeFile under the root directory as well in the ./usb directory here.

Attached below is compressed folder of the cloned repo after some adjustment in the file structure. sboot_stm32.zip

The directory structure looks like the following:

-<sboot_stm32>                   // as cloned locally
-<CMSIS_5>                       // as downloaded
       |
       +--  <CMSIS>
       +--  <Device>
       +--   .
       +--   .
       +--   .
       +--   <README.md>

After I ran make stm32f103x8, the output from the terminal is as follows:

D:\Documents\Projects\sboot_stm32>make stm32f103x8
Could Not Find D:\Documents\Projects\sboot_stm32\build\firmware*
Could Not Find D:\Documents\Projects\sboot_stm32\build\objfw\script.ld
make bootloader FWCPU='-mcpu=cortex-m3' \
                           FWSTARTUP='mcu/stm32f103.S' \
                           FWDEFS='STM32F1 STM32F103x6 USBD_ASM_DRIVER' \
                           LDPARAMS='ROMLEN=64K RAMLEN=20K'
make[1]: Entering directory `D:/Documents/Projects/sboot_stm32'
compiling src/arc4.c
compiling src/chacha.c
compiling src/gost.c
compiling src/raiden.c
compiling src/rc5.c
compiling src/speck.c
compiling src/xtea.c
compiling src/xtea1.c
compiling src/blowfish.c
compiling src/rtea.c
compiling src/rc6.c
compiling src/rijndael.c
compiling src/magma.c
compiling src/checksum.c
compiling src/crypto.c
assembling mcu/stm32f103.S
compiling src/descriptors.c
compiling src/bootloader.c
assembling src/rc5a.S
assembling src/chacha_a.S
assembling src/rc6a.S
building module usb
make[2]: Entering directory `D:/Documents/Projects/sboot_stm32/usb'
Could Not Find D:\Documents\Projects\sboot_stm32\usb\cdc_loop.*
make D:/Documents/Projects/sboot_stm32/build/objfw/libusb.a
make[3]: Entering directory `D:/Documents/Projects/sboot_stm32/usb'
compiling src/usbd_core.c
compiling src/usbd_stm32f103_devfs.c
src/usbd_stm32f103_devfs.c:64:13: note: #pragma message: PMA memory size is not defined. Use 512 bytes by default
     #pragma message "PMA memory size is not defined. Use 512 bytes by default"
             ^
compiling src/usbd_stm32f105_otgfs.c
compiling src/usbd_stm32f429_otgfs.c
compiling src/usbd_stm32f429_otghs.c
compiling src/usbd_stm32f446_otgfs.c
compiling src/usbd_stm32f446_otghs.c
compiling src/usbd_stm32l052_devfs.c
compiling src/usbd_stm32l100_devfs.c
compiling src/usbd_stm32l433_devfs.c
compiling src/usbd_stm32l476_otgfs.c
assembling src/usbd_stm32f103_devfs_asm.S
assembling src/usbd_stm32l052_devfs_asm.S
assembling src/usbd_stm32l100_devfs_asm.S
a - obj/usbd_core.o
a - obj/usbd_stm32f103_devfs.o
a - obj/usbd_stm32f105_otgfs.o
a - obj/usbd_stm32f429_otgfs.o
a - obj/usbd_stm32f429_otghs.o
a - obj/usbd_stm32f446_otgfs.o
a - obj/usbd_stm32f446_otghs.o
a - obj/usbd_stm32l052_devfs.o
a - obj/usbd_stm32l100_devfs.o
a - obj/usbd_stm32l433_devfs.o
a - obj/usbd_stm32l476_otgfs.o
a - obj/usbd_stm32f103_devfs_asm.o
a - obj/usbd_stm32l052_devfs_asm.o
a - obj/usbd_stm32l100_devfs_asm.o
make[3]: Leaving directory `D:/Documents/Projects/sboot_stm32/usb'
make[2]: Leaving directory `D:/Documents/Projects/sboot_stm32/usb'
make -f ldscript.mk ROMLEN=64K RAMLEN=20K OUTFILE=build/objfw/script.ld
make[2]: Entering directory `D:/Documents/Projects/sboot_stm32'
Building linker script
make[2]: Leaving directory `D:/Documents/Projects/sboot_stm32'
building bootloader
c:/program files (x86)/gnu tools arm embedded/4.9 2015q3/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld.exe: cannot open linker script file build/objfw/script.ld: No such file or directory
collect2.exe: error: ld returned 1 exit status
make[1]: *** [build/firmware.elf] Error 1
make[1]: Leaving directory `D:/Documents/Projects/sboot_stm32'
make: *** [stm32f103x8] Error 2

The linker file is not generated at the location as shown here

I would humbly request you and anyone who can shine some light on this to kindly help me out. in solving the error as shon above Thanks in advance for your time

TamojitSaha commented 3 years ago

I made few changes to Makefile in usb directory of this repo. I remove these line otherwise I was getting the following error: makefile:75: *** target pattern contains no '%'. Stop.

As I am using Windows platform I had to update my GNU Make to version 4.3. This can be done by executing choco install make. Then add the install path to the PATH variable.

The bootloader successfully compiled after that step.