Sysprogs forums › Forums › VisualGDB › Bootloader Tutorial – build failed
Tagged: bootloader binary
- This topic has 15 replies, 5 voices, and was last updated 4 years, 4 months ago by support.
-
AuthorPosts
-
May 23, 2019 at 14:51 #25008JStolleParticipant
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
May 23, 2019 at 17:46 #25009supportKeymasterHi,
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.
May 24, 2019 at 06:43 #25010JStolleParticipantHi,
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
May 24, 2019 at 08:20 #25011JStolleParticipantAs 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 5 years, 7 months ago by JStolle.
May 24, 2019 at 17:33 #25013supportKeymasterIn 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).
May 31, 2019 at 08:21 #25037JStolleParticipantHi,
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 1As 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 5 years, 7 months ago by JStolle.
June 3, 2019 at 06:02 #25044supportKeymasterGood 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.
July 29, 2019 at 00:07 #25496CrzyRndmParticipantHave 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
July 29, 2019 at 00:46 #25499supportKeymasterHi,
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
July 29, 2019 at 05:29 #25500CrzyRndmParticipantcloned bootloader demo, reproduced both issues
- rebuild application -> failed, bootloader.bin missing
- build bootloader, then application -> build passes, map showes bootloader section isn’t just 0xFF / contains code
- 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 5 years, 5 months ago by CrzyRndm.
- This reply was modified 5 years, 5 months ago by CrzyRndm.
Attachments:
You must be logged in to view attached files.July 29, 2019 at 17:55 #25515supportKeymasterThanks 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.
September 21, 2019 at 18:08 #25855WeParticipantI checked “Extensions to delete on clean” of main app project,it’s already $(TargetName).bin since using the newest demo project.
However,generated bin doesn’t include bootloader no matter rebuild or clean then rebuild,Bug not fixed,:(
If I clean Bootloader.bin20.rsp|*.bootldr-0|*.bootldr-rename.rsp manually(clean project won’t delete these 3 files),then build sln,generated bin is all right.
Maybe you should config to delete these middlewares after merging.Could it be done in .props?
September 21, 2019 at 19:59 #25863supportKeymasterNormally, deleting those files should not be necessary. Generally, the easiest way to troubleshoot it would be to clone our bootloader example from Github, ensure that it works as expected and compare your project to it.
Another way would be to try tracing the MSBuild tasks involved in the building by turning on verbose MSBuild logging (Tools->Options->Projects and Solutions->Build and Run):
- The BuildBootloaderLinkerInputs should run before the Link task
- The <path>.bootldr-o file should be added as an input to the Link task (see step 14 of the tutorial)
- The .link.rsp file for the main application should include the .bootldr-o file and the .bootldr-o file should not be empty (you can check its contents using the arm-eabi-objdump tool).
August 27, 2020 at 06:17 #28908chris250ParticipantHi all,
I am having this same issue. I am using the latest project. I have followed all the steps in this thread, but the bootloader.bin file is still being cleaned.
Is there anything else I can try?
Thanks
August 27, 2020 at 07:38 #28909chris250Participant@support
I have found my issue. The example bootloader.props file in Step 14 on the example page is wrong (https://visualgdb.com/tutorials/tutorials/arm/bootloader/msbuild/).
Diffing between the github version and the one on the example page shows that the line:
CommandFormat="--rename-section .data=.bootldr < $@"
Should read:
CommandFormat="--rename-section .data=.bootldr $< $@"
- This reply was modified 4 years, 4 months ago by support. Reason: formatting
-
AuthorPosts
- You must be logged in to reply to this topic.