Closed Fabien-Chouteau closed 4 years ago
Yes, that file is used with the CMSIS headers together with the preprocessor. It provides the data arrays that are used in the Ada code (via Interfaces.C).
As I said on twitter, I would first make a static library from the cpp code:
CPPSTATICLIB=libstm32cpp.a
$(CPPSTATICLIB): $(CPPOBJECTS)
ar ru $@ $^
ranlib $@
and then call gprbuild to build the Ada application that uses the cpp lib:
$(APPFOLDER)/bin/$(OUTPUT).elf: $(CPPSTATICLIB)
gprbuild -P my_project.gpr
my_project.gpr
:
project My_Project is
for Languages use ("Ada");
for Source_Dirs use (...)
for Target use "arm-eabi";
for Runtime ("Ada") use "zfp-cortex-m4f";
[...]
package Linker is
for Switches ("Ada") use ("-lstm32cpp");
end Linker;
Something like that.
Note that you can most likely also compile the cpp file with gprbuild and don't need the Makefile at all.
I would very much prefer it to not have to dynamically create project files just to keep gprbuild happy.
I'm still exploring ways to make cross-compiling with GNAT work, but so far it basically seems needlessly complicated compared to doing the same with any other language.
I nearly got things working using the local toolchain's gnatmake. Gnatlink still errors out with ELF relocation issues, presumably due to toolchain issues.
I'm more tempted to take this even more low-level with just arm-eabi-gcc and no gnatmake, gprbuild or any such poorly documented abstractions. At this point I'm severely frustrated with using those tools and how they do not really fix issues, but just create new, interesting ones.
I would very much prefer it to not have to dynamically create project files just to keep gprbuild happy.
The project file is always the same, not dynamic.
I'm still exploring ways to make cross-compiling with GNAT work, but so far it basically seems needlessly complicated compared to doing the same with any other language.
Which other languages for instance?
Hi Maya,
There only this one CPP file in the project? https://github.com/MayaPosch/Nodate/blob/9440750e420aab7631007c629d557d8e358565c3/arch/stm32/Makefile.ada#L76