Bootloader Tutorial – build failed

Sysprogs forums Forums VisualGDB Bootloader Tutorial – build failed

This topic contains 10 replies, has 3 voices, and was last updated by  support 1 month, 2 weeks ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #25008

    JStolle
    Participant

    Hi,

    I tried to follow the tutorial for an embedded bootloader with msbuild. However if I select “rebuild main application” there is the following error “Build failed: arm-eabi-ld.exe exited with code 1”.

    I then copied the bootloader tutorial from github and got the same problem.

    The only change to the cloned program was the start-project definition, as it was originally on the bootloader I had to set it to the main application.

    I am using Visual Studio 2017 professional 15.9.12 and Visual GDB Custom Edition 5.4R5.

    Any idea what I am doing wrong?

    Greetings

    Jan

     

    #25009

    support
    Keymaster

    Hi,

    Please check the built log (View->Output). It will show the output from ld.exe (GNU linker) that should contain more details about the cause of the error.

    #25010

    JStolle
    Participant

    Hi,

    it seems the Bootloader.bin file is missing, when building the two projects separately it gets generated. With rebuild however it gets deleted and is not regenerated(or deleted immideately after generation – hard to see), although the compilation itself happens for both projects.

    So is there some general setting ( like only-delete-bin-files-at-first-rebuild? ) I am missing?

    Greetings

    Jan

    #25011

    JStolle
    Participant

    As I do not have the hardware to debug the original tutorial program this is the result of the debugging of my own program (based on the tutorial) with the same problem:

    If I build the two programs (bootloader, main app) separately I do not get an error. But when debugging it does start at disassembly (Starting point seems to be the reset-vector of the main application) and gets stuck at some point, therefore returning to the reset vector. I am however not able to get to a breakpoint either in the bootloader or the main app.

    (Reset Target after programming is set).

    When debugging the bootloader as standalone the _app_start address and the _estack seem correct in the debugger.

    Also in the Embedded Memory Explorer of the main application I can see the .bootldr section with the correct range, but it says “Other” inside with the indication that the space has been lost due to padding between symbols. Is there another way to see the memory of the combined programs?

    Greetings

    Jan

    <hr />

    I rebuild the whole program using gnu make and the bootloader makefile tutorial. This seems to work without a problem.

    • This reply was modified 3 months, 3 weeks ago by  JStolle.
    #25013

    support
    Keymaster

    In order to solve the build issues please double-check that the bootloader project is set as a build dependency for the main project (step 19 of the tutorial). Otherwise Visual Studio will try to build both projects in parallel and will indeed not work.

    To solve the entry point issue when debugging, please set the “reset after programming FLASH” checkbox in debug settings (step 23 of the same tutorial).

    #25037

    JStolle
    Participant

    Hi,

    I checked, but step 19  had been done. Build dependencies are looking good and the build itself is going well – first bootloader, then application, but at the linking at the end of both builds, the bootloader.bin is missing:

     

    ….

    1>stm32f4xx_ll_utils.c
    1>Linking ../VisualGDB/Debug/Bootloader…
    1>——————- Memory utilization report ——————-
    1>Used FLASH: 2676 bytes out of 1024KB (0%)
    1>Used SRAM: 44 bytes out of 128KB (0%)
    1>Used CCMRAM: 0 bytes out of 64KB (0%)
    2>—— Neues Erstellen gestartet: Projekt: MainApplication, Konfiguration: Debug VisualGDB ——
    2>LEDBlink.cpp

    ….

    2>stm32f4xx_ll_utils.c
    2>C:\SysGCC\arm-eabi\bin\arm-eabi-ld.exe: cannot find C:/Users/jan.stolle/source/repos/BootloaderDemo/VisualGDB/Debug/Bootloader.bin: No such file or directory
    2>C:\Users\jan.stolle\source\repos\BootloaderDemo\MainApplication\bootloader.props(4,2): error : Build failed: arm-eabi-ld.exe exited with code 1

    As written before, that program has been cloned directly from the git-hub repository. It is working if built separate, but not if done using the rebuild-function on the main-application. I can live with that, but it is a bit bothersome.

     

    Regarding the entry point, it was my mistake. I misread the tutorial and changed the stackpointer of the bootloader instead of the main-application. That part has been fixed and is working.

    • This reply was modified 3 months, 2 weeks ago by  JStolle.
    #25044

    support
    Keymaster

    Good to know the entry point works.

    Regarding bootloader.bin, please try enabling verbose logging via Tools->Options->Projects and Solutions->Build and Run->MSBuild Project Output Verbosity -> Diagnostic.

    This should produce a detailed build log showing the project build order and also when the .bin file is generated and when it is used by another project. If it doesn’t help, please feel free to post it here and we will try to help you get it to work.

    #25496

    CrzyRndm
    Participant

    Have been having an identical issue to @jstolle with rebuild deleting the bootloader binary before it can be used

    From the diagnostic logs, the bootloader build finishes at line 2278, and then at the start of the firmware project (Line 4045) it records that output file as part of the clean for the second project

    1> <GCC PATH>\sysgcc\7.2.0\arm-eabi\bin\arm-eabi-objcopy.exe -O binary ../VisualGDB/Debug/bootloader ../VisualGDB/Debug/bootloader.bin

    2> Done executing task “CppClean”.
    2> Task “WriteLinesToFile”
    2> Task Parameter:File=VisualGDB\Debug\firmware.Build.CppClean.log
    2> Task Parameter:
    2> Lines=
    2> <PROJECT>\visualgdb\debug\bootloader.bin

    bootloader.bin file is not mentioned again until the bootloader.props commands are involed

    Additionally, the commands in the tutorial “bootloader.props” aren’t complete in a very frustrating way. If the bootloader project is modified for any reason, the bootldr section for the firmware project will be empty (map file shows *(.bootldr) immediately followed by “FILL …”). A manual clean of the binary folder is required before it will work as expected again. This is extremely non-obvious as it appears to work once, and then fail repeatedly with no setup changes

    • This reply was modified 1 month, 3 weeks ago by  CrzyRndm.
    • This reply was modified 1 month, 3 weeks ago by  CrzyRndm.
    #25499

    support
    Keymaster

    Hi,

    Please double-check that the main project properly references the bootloader project (per step 11 of the tutorial).

    You can also download the source code of the projects shown in the bootloader tutorial here (we have just rechecked rebuilding and it did work as expected): https://github.com/sysprogs/tutorials/tree/master/visualgdb/ARM/BootloaderDemo

    #25500

    CrzyRndm
    Participant

    cloned bootloader demo, reproduced both issues

    1. rebuild application -> failed, bootloader.bin missing
    2. build bootloader, then application -> build passes, map showes bootloader section isn’t just 0xFF / contains code
    3. Rebuild bootloader, build application -> build passes, map shows bootloader section is all 0xFF / contains no code

    As a side note, the first issue (step #1 failing) is not present if

    • the bootloader is built in release, and the application in debug (both projects)
    • seperate clean/build steps are used (only affects rebuild)

    The second issue (no bootloader code after rebuild) I haven’t found a solution past deleting all the files in VisualGDB/<Build>/*. Just deleting the application or temporary file (*.bootldr-o) has no effect

    • This reply was modified 1 month, 3 weeks ago by  CrzyRndm.
    • This reply was modified 1 month, 3 weeks ago by  CrzyRndm.
    Attachments:
    You must be logged in to view attached files.
    #25515

    support
    Keymaster

    Thanks for the details and sorry for the confusion. We have rechecked everything and found the root cause of the problem.

    When the main application is rebuilt, the “clean” stage of the build deletes the built files from the project output directory, following the regular Visual Studio logic. This also results in deletion of the .bin file previously built by the bootloader project.

    The easiest way to fix this would be to edit the “Extensions to delete on clean” field for the main project, replacing *.bin with $(TargetName).bin. This will ensure that cleaning (or rebuilding) of the main project won’t affect the .bin file produced by the tutorial project.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.