Tagged: bootloader binary
May 23, 2019 at 14:51 #25008
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?
JanMay 23, 2019 at 17:46 #25009
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 #25010
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?
JanMay 24, 2019 at 08:20 #25011
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?
I rebuild the whole program using gnu make and the bootloader makefile tutorial. This seems to work without a problem.
May 24, 2019 at 17:33 #25013
- This reply was modified 1 year ago by JStolle.
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).May 31, 2019 at 08:21 #25037
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>——————- 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>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.
June 3, 2019 at 06:02 #25044
- This reply was modified 12 months ago by JStolle.
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.July 29, 2019 at 00:07 #25496
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:
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 changesJuly 29, 2019 at 00:46 #25499
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/BootloaderDemoJuly 29, 2019 at 05:29 #25500
cloned 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 10 months ago by CrzyRndm.
- This reply was modified 10 months ago by CrzyRndm.
Attachments:You must be logged in to view attached files.July 29, 2019 at 17:55 #25515
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.September 21, 2019 at 18:08 #25855
I 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 #25863
Normally, 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).
You must be logged in to reply to this topic.