User forums > Embedded development
Looking for example of "Post-build steps"
christobal:
--- Quote from: Pavel_47 on December 01, 2016, 04:57:17 pm ---For the moment I can't build entire projects.
Build generates errors for reasons that I don't understand for the moment.
Without doubt the GNU Tools ARM Embedded tool-chain isn't properly integrated into Code::Blocks ... but it's the subject of my other post published earlier.
--- End quote ---
It's not an issue with the ARM GCC integration into Code::Blocks. I assume that you are new to Embedded programming...
Compared to PC applications, you have to do some extra work that cannot be provided by the Compiler toolchain, as it is dependent on the device that the code is intended to run. Additionally, on embedded targets there is a startup - code, which provides basically the functionality of an OS Loader. The startup code sets up the environment for your application and requires information from the linker script.
This means (if you want to start from scratch) that you have to provide some low-level routines and settings.
Your problem(s) seem to be:
The linker script doesn't seem to export the boundary addresses for the .bss section (check "target.ld"; it probably needs some adaption according to the processor derivate you want to use). The linker script should also define memory for stack and heap.
The boundary addresses are used by the startup code (crt0.o) to determine all variables that shall be cleared before main is entered. The startup code does also initialize the .data sections with pre-defined values. If you don't know about .bss and .data sections, the GCC linker (LD) manual and google can help you.
You should also check the crt0.S source to get a grasp about what is happening there. Maybe yo need/want to do some adaptions there as well, so you can provide your own crt0.S and pass the -nocrt0 option to the linker.
Your interrupt vector table is missing. It probably needs to be located at a certain position in memory, as the processor will jump to this location on any interrupt or trap event. From there the table should forward jump to your interrupt service routines. Some processors allow to have the interrupt table at an arbitrary (aligned) memory location. For this they provide a special register to set up the interrupt vector base address. The processors user manual can give you more information about the requirements for the interrupt system.
Keep in mind, that the Toolchain doesn't provide you with anything interrupt related (maybe except for example files). It is your job to initialize the Interrupt system if you want to use interrupts.
The _exit function is a stub routine that gives you the possibility to execute target dependent code before the processor halts. For now, it will suffice if you provide an empty routine, which does nothing. In embedded programming it is common that your main routine doesn't return anyway...
Pavel_47:
Thanks,
Yes, the problem is in divergence of names used in linker scripts from Code::Blocks and GNU Tools ARM Embedded.
I pointed my compiler executables to GNU Tools ARM Embedded bin directory. So, the linker uses libraries (e.g. crt0.o) also from GNU Tools ARM Embedded.
The crt0.o uses symbols __bss_start__ and __bss_end__, that are properly defined in
C:\Program Files (x86)\GNU Tools ARM Embedded\5.4 2016q3\share\gcc-arm-none-eabi\samples\ldscripts\gcc.ld
Whereas linker script is called from
C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\templates\wizard\arm\files\ARM-eval7t\ld\target.ld, where the similar symbols are __bss_start and __bss_end
Its location is defined here (highlighted in yellow):
I've tried to point to "custom" makefile from C:\Program Files (x86)\GNU Tools ARM Embedded\5.4 2016q3\share\gcc-arm-none-eabi\samples\src\cpp that calls gcc.ld script with correct symbols, but build failed:
Pavel_47:
Here I've just tried to build with toolchain executables from Code::Blocks bin.
I'm not sure if I correctly restituted the initial settings (i.e. executables for compiler, linker, etc.).
Anyway, errors occur:
BlueHazzard:
--- Quote ---Here I've just tried to build with toolchain executables from Code::Blocks bin.
--- End quote ---
this is bul**** you can't compile arm code with a x86 compiler (you can but you will get errors)
Also x86 don't need linker scripts...
--- Quote ---Whereas linker script is called from
C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\templates\wizard\arm\files\ARM-eval7t\ld\target.ld, where the similar symbols are __bss_start and __bss_end
Its location is defined here (highlighted in yellow):
--- End quote ---
No, it calls the linker script:
--- Code: ----T ld/target
--- End code ---
it calls the linker script from a sub folder of your project. Replace this script file with your appropriate linker file or fix the path in the linker settings
then, if you still get errors don't post screenshots. They waste space. Post the build log (from the build log tap) in code tags (the # symbol in the new post editor)
hope this helps
greetings
Pavel_47:
--- Quote from: BlueHazzard on December 03, 2016, 07:11:46 pm ---
--- Quote ---Here I've just tried to build with toolchain executables from Code::Blocks bin.
--- End quote ---
this is bul**** you can't compile arm code with a x86 compiler (you can but you will get errors)
Also x86 don't need linker scripts...
--- End quote ---
If I properly understood you, none executable, located in "C:\Program Files (x86)\CodeBlocks\MinGW\bin", can properly process (i.e. compile, link) ARM code. Correct ?
If this is correct in order to work with ARM targets, it's necessary to install "GNU Tools ARM Embedded" toolchain.
If these 2 above statements are correct, one question arises:
What could be the usage of the link scripts, located in "C:\Program Files (x86)\CodeBlocks\share\CodeBlocks\templates\wizard\arm\files\{ARM_platform_name}\ld\" directories if:
* these scripts are not compatible with crt0.o library, located in "GNU Tools ARM Embedded" toolchain
* there is no any linker, located in "C:\Program Files (x86)\CodeBlocks\MinGW\bin", capable to correctly process themThanks.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version